# 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}/YACReaderLibrary
profile YACReaderLibrary @{exec_path} flags=(attach_disconnected,mediate_deleted) {
  include <abstractions/base>
  include <abstractions/bus-accessibility>
  include <abstractions/dconf-write>
  include <abstractions/desktop>
  include <abstractions/graphics>
  include <abstractions/nameservice-strict>
  include <abstractions/qt5-shader-cache>

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

  @{exec_path} mr,

  @{bin}/YACReader  rPx,
  @{open_path}      rPx -> child-open,

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

  /etc/machine-id r,

  owner @{user_books_dirs}/{,**} r,
  owner @{user_books_dirs}/**/.yacreaderlibrary/{,**} rwk,

  owner @{user_cache_dirs}/YACReader/ rw,
  owner @{user_cache_dirs}/YACReader/YACReaderLibrary/ rw,
  owner @{user_cache_dirs}/YACReader/YACReaderLibrary/** rwlk,

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

  owner @{tmp}/@{uuid} w,

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

  include if exists <local/YACReaderLibrary>
}

# vim:syntax=apparmor
