#! /bin/bash

ACTION="custompart-teams_apparmor"

# Add apparmor profile to trust Microsoft Teams in Firefox
logger -it "$ACTION" "Adding Microsoft Teams to firefox apparmor profile"
echo "$( get custom_partition.mountpoint )/teams/usr/bin/teams Uxr," > /etc/apparmor.d/abstractions/ubuntu-browsers.d/teams
echo '#include <abstractions/ubuntu-browsers.d/teams>' >> /etc/apparmor.d/abstractions/ubuntu-browsers.d/firefox

# reload apparmor only if it is enabled
if [ "$( get system.security.apparmor )" = "true" ] ; then
  logger -it "$ACTION" "Reloading apparmor profiles"
  systemctl reload apparmor.service
else
  logger -it "$ACTION" "Apparmor profiles disabled by setup"
fi

exit 0
