Files
operating-system/buildroot-external/rootfs-overlay/usr/libexec/hassos-apparmor
Pascal Vizeli 45c62716cb New way to install/run supervisor + plugins (#620)
* Use new layout for CLI/Supervisor

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>

* Fix install script

* Fix config

* Add docs

* Fix shellcheck

* Fix issue

* rename package

* Fix build

* Fix apparmor
2020-04-21 14:37:25 +02:00

39 lines
859 B
Bash
Executable File

#!/bin/sh
set -e
PROFILES_DIR="/mnt/data/supervisor/apparmor"
CACHE_DIR="${PROFILES_DIR}/cache"
REMOVE_DIR="${PROFILES_DIR}/remove"
# Check folder structure
mkdir -p "${PROFILES_DIR}"
mkdir -p "${CACHE_DIR}"
mkdir -p "${REMOVE_DIR}"
# Load/Update exists/new profiles
for profile in "${PROFILES_DIR}"/*; do
if [ ! -f "${profile}" ]; then
continue
fi
# Load Profile
if ! apparmor_parser -r -W -L "${CACHE_DIR}" "${profile}"; then
echo "[Error]: Can't load profile ${profile}"
fi
done
# Cleanup old profiles
for profile in "${REMOVE_DIR}"/*; do
if [ ! -f "${profile}" ]; then
continue
fi
# Unload Profile
if apparmor_parser -R -W -L "${CACHE_DIR}" "${profile}"; then
if rm "${profile}"; then
continue
fi
fi
echo "[Error]: Can't remove profile ${profile}"
done