# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/YACReader
profile YACReader @{exec_path} flags=(attach_disconnected,mediate_deleted) {
  include <abstractions/base>
  include <abstractions/audio-client>
  include <abstractions/dconf-write>
  include <abstractions/desktop>
  include <abstractions/graphics>
  include <abstractions/nameservice-strict>
  include <abstractions/qt5-settings-write>
  include <abstractions/qt5-shader-cache>
  include <abstractions/ssl_certs>

  network inet dgram,
  network inet6 dgram,
  network inet stream,
  network inet6 stream,
  network netlink raw,

  @{exec_path} mr,

  /usr/share/yacreader/{,**} r,

  /etc/machine-id r,

  owner @{user_books_dirs}/{,**} r,

  owner @{user_share_dirs}/YACReader/ rw,
  owner @{user_share_dirs}/YACReader/* r,
  owner @{user_share_dirs}/YACReader/YACReader/ rw,
  owner @{user_share_dirs}/YACReader/YACReader/** rwlk,

  /dev/shm/ r,

  owner @{PROC}/@{pid}/cmdline r,
  owner @{PROC}/@{pid}/mountinfo r,

  include if exists <local/YACReader>
}