Files
operating-system/buildroot-external/rootfs-overlay/usr/libexec/hassos-apparmor
Pascal Vizeli 60c9013535 Travis (#269)
* Update build-all.sh

* Delete ovf-create.sh

* Update patches.sh

* Update hdd-image.sh

* Create .travis.yml

* Update hdd-image.sh

* Update hdd-image.sh

* Update hdd-image.sh

* Update hdd-image.sh

* Update ota.sh

* Update post-build.sh

* Update post-image.sh

* Update rauc.sh

* Update rootfs-layer.sh

* Update hassos-cli

* Update hassos-supervisor

* Update hassos-config

* Update hassos-apparmor

* Update hassos-expand

* Update hassos-persists-journald

* Update hassos-rate

* Update hassos-hook.sh

* Update hassos-hook.sh

* Rename uboot-boot.sh to uboot-boot.ush

* Rename uboot-boot.sh to uboot-boot.ush

* Update hassos-hook.sh

* Rename uboot-boot.sh to uboot-boot.ush

* Rename uboot-boot.sh to uboot-boot.ush

* Update hassos-hook.sh

* Update odroid_c2_defconfig

* Update rpi0_w_defconfig

* Update rpi2_defconfig

* Update rpi3_64_defconfig

* Update rpi3_defconfig

* Update rpi_defconfig

* Update tinker_defconfig

* Update enter.sh

* Update .travis.yml
2018-11-30 16:22:04 +01:00

48 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
set -e
# Load configs
CONFIG_FILE=/mnt/data/hassos.json
# Read configs
PROFILES_DIR="$(jq --raw-output '.apparmor // empty' ${CONFIG_FILE})"
if [ -z "${PROFILES_DIR}" ]; then
exit 0
fi
PROFILES_DIR="/mnt/data/${PROFILES_DIR}"
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