diff options
Diffstat (limited to 'sysui/desktop/share/apparmor.sh')
-rwxr-xr-x | sysui/desktop/share/apparmor.sh | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/sysui/desktop/share/apparmor.sh b/sysui/desktop/share/apparmor.sh index 88baff83755e..4a91310b1a29 100755 --- a/sysui/desktop/share/apparmor.sh +++ b/sysui/desktop/share/apparmor.sh @@ -2,7 +2,7 @@ # This file is part of the LibreOffice project. # ------------------------------------------------------------------ # -# Copyright (C) 2015 Canonical Ltd. +# Copyright (C) 2016 Canonical Ltd. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this @@ -13,36 +13,39 @@ # ------------------------------------------------------------------ # This is a simple script to help get AppArmor working on different distros +# Generally these apparmor profiles target the latest LibreOffice INST_ROOT=$1 #Where libreoffice program folder can be found PROFILESFROM=$2 #Where the profile files are -INSTALLTO=$3 #Where should the apparmor profiles live (to be be linked to) -INSTALL=$4 #True means try to run sudo to link (doesn't reload profiles) +INSTALLTO=$3 #Where should the apparmor profiles (For manual use should be /etc/apparmor.d) +RESTART=$4 #Should we restart apparmor using service? -#For example to get this to work on Ubuntu 15.10 with stock LibreOffice: -# ./sysui/desktop/share/apparmor.sh /usr/lib/libreoffice/ sysui/desktop/apparmor/ /mnt/store/git/libo/instdir/apparmor-testing/ true +#Example uses: +#Ubuntu 16.04 with stock LibreOffice: +# sudo ./sysui/desktop/share/apparmor.sh /usr/lib/libreoffice/ sysui/desktop/apparmor/ /etc/apparmor.d/ true -#For example on Ubuntu 15.10, with built debs from the LibreOffice website -# At the current time you need run /opt/libreofficedev5.1/program/soffice.bin directly - splash screen doesn't work -# ./sysui/desktop/share/apparmor.sh /opt/libreofficedev5.1/ sysui/desktop/apparmor/ /mnt/store/git/libo/instdir/apparmor-testing/ true +#Ubuntu 16.04, with built debs from LibreOffice git +# sudo ./sysui/desktop/share/apparmor.sh /opt/libreofficedev5.2/ sysui/desktop/apparmor/ /etc/apparmor.d/ true -mkdir -p $INSTALLTO +#Ubuntu 16.04, running from git! +# sudo ./sysui/desktop/share/apparmor.sh /mnt/store/git/libo/instdir/ sysui/desktop/apparmor/ /etc/apparmor.d/ true #Need to convert / to . for profile names INST_ROOT_FORMAT=${INST_ROOT/\//} INST_ROOT_FORMAT=${INST_ROOT_FORMAT////.} -#Need to escale / for sed +#Need to escape / for sed INST_ROOT_SED=${INST_ROOT////\\/} for filename in `ls $PROFILESFROM` do tourl=$INSTALLTO$INST_ROOT_FORMAT$filename cat $PROFILESFROM$filename | sed "s/INSTDIR-/$INST_ROOT_SED/g" > $tourl - - if [ "$INSTALL" = true ] ; then - sudo rm /etc/apparmor.d/$INST_ROOT_FORMAT$filename - sudo ln -s $tourl /etc/apparmor.d/$INST_ROOT_FORMAT$filename - fi + echo "$tourl" done + +if [ "$RESTART" = true ] ; then + echo "Restarting AppArmor" + service apparmor restart +fi |