Browse Source

Check if apparmor is installed.

Raphael Schneeberger 7 years ago
parent
commit
d3d1b564e2
1 changed files with 13 additions and 4 deletions
  1. 13 4
      install/hst-install-debian.sh

+ 13 - 4
install/hst-install-debian.sh

@@ -283,6 +283,13 @@ if [ ! -e '/usr/lib/apt/methods/https' ]; then
     check_result $? "Can't install apt-transport-https"
 fi
 
+# Check if apparmor is installed
+if [ $(dpkg-query -W -f='${Status}' apparmor 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
+    apparmor='no'
+else
+    apparmor='yes'
+fi
+
 # Checking repository availability
 wget -q "https://$GPG/deb_signing.key" -O /dev/null
 check_result $? "No access to Hestia repository"
@@ -1102,10 +1109,12 @@ if [ "$named" = 'yes' ]; then
     chown root:bind /etc/bind/named.conf
     chmod 640 /etc/bind/named.conf
     aa-complain /usr/sbin/named 2>/dev/null
-    echo "/home/** rwm," >> /etc/apparmor.d/local/usr.sbin.named 2>/dev/null
-    service apparmor status >/dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        service apparmor restart
+    if [ "$apparmor" = 'yes' ]; then
+        echo "/home/** rwm," >> /etc/apparmor.d/local/usr.sbin.named 2>/dev/null
+        service apparmor status >/dev/null 2>&1
+        if [ $? -ne 0 ]; then
+            service apparmor restart
+        fi
     fi
     update-rc.d bind9 defaults
     service bind9 start