#!/bin/sh
#
#    Copyright (C) 2024 Luis Guzmán <ark@switnet.org>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
#

VERSION=1

. ./config

# Apply fix for pipewire on apparmor, see more at:
# https://bugs.launchpad.net/apparmor/+bug/2003702
patch_p1 $DATA/b5a7641dd3502fcfb897d3b96e197628b674ce3c.patch

# Add custom unconfined profiles for abrowser and icedove, deliberately patch
# upon an original upstream profile copy to force track original files and
# update patch accordinlgy, as it's an important security feature starting
# at upstream 23.10:
# https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces

cp profiles/apparmor.d/{thunderbird,icedove}
cp profiles/apparmor.d/{firefox,abrowser}
patch_p1 $DATA/add-unconfined-profile-firefox-icedove.patch

cp profiles/apparmor/profiles/extras/{firefox,abrowser}
patch_p1 $DATA/add-extra-abrowser-profile.patch
# Note: look for updates on abrowser.sh profile on each helper/patch change:
patch_p1 $DATA/update-profile-extra-firefox-sh.patch

changelog "Apply fix LP:2003702 for pidgin like clients. | Add unconfined profiles for firefox and icedove."

package
