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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/mimetype
profile mimetype @{exec_path} {
  include <abstractions/base>
  include <abstractions/perl>

  @{exec_path} r,
  /usr/bin/perl r,

  /usr/share/mime/**.xml r,
  /usr/share/mime/globs r,
  /usr/share/mime/aliases r,
  /usr/share/mime/magic r,

  owner @{user_share_dirs}/mime/**.xml r,
  owner @{user_share_dirs}/mime/globs r,
  owner @{user_share_dirs}/mime/aliases r,
  owner @{user_share_dirs}/mime/magic r,

  # To read files
  /** r,

  include if exists <local/mimetype>
}

# vim:syntax=apparmor
