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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/glib-compile-schemas
profile glib-compile-schemas /{,usr/}{,s}bin/glib-compile-schemas flags=(complain) {
  include <abstractions/base>
  include <abstractions/consoles>

  network inet stream,
  network inet6 stream,

  @{exec_path} mr,

  /usr/share/glib-2.0/schemas/{,*} r,
  /usr/share/glib-2.0/schemas/gschemas.compiled.@{rand6} rw,
  /usr/share/glib-2.0/schemas/gschemas.compiled rw,

  /usr/share/gnome-shell/extensions/*/schemas/org.gnome.shell.extensions.*.gschema.xml r,

  owner @{user_share_dirs}/gnome-shell/extension-updates/*/schemas/ r,
  owner @{user_share_dirs}/gnome-shell/extension-updates/*/schemas/gschemas.compiled rw,
  owner @{user_share_dirs}/gnome-shell/extension-updates/*/schemas/gschemas.compiled.@{rand6} rw,
  owner @{user_share_dirs}/gnome-shell/extension-updates/*/schemas/org.gnome.shell.extensions.*.gschema.xml r,

  include if exists <local/glib-compile-schemas>
}
