PKGDIR="/opt/isu"
RUNDIR="/run/isu"
+ISUCFG="isu.cfg"
# Public key will be checked only if below variable is set
#PUBKEY="/path/to/publickey.pem"
return 0
}
-install_mount_unit()
+setup_isu_run_dir()
{
- local isu_pkg_name="$1"
+ local isu_pkg_dir="$1"
+ local isu_pkg_name="$2"
+ local isu_pkg_run="$RUNDIR/$isu_pkg_name"
+
+ if ! mkdir -p "$isu_pkg_run/rootfs"; then
+ log "Unable to create needed directory hierarchy at $isu_pkg_run/rootfs - skipping ISU package"
+ return 1
+ fi
- if ! mkdir -p "$RUNDIR/$isu_pkg_name/rootfs"; then
- log "Unable to create directory to mount $isu_pkg_dir's rootfs - skipping ISU package"
+ if ! install -m0644 -o root -g root --context=_ "$isu_pkg_dir/$ISUCFG" "$isu_pkg_run/$ISUCFG"; then
+ log "Unable to setup essential ISU configuration - skipping ISU package"
return 1
fi
+}
+
+install_mount_unit()
+{
+ local isu_pkg_name="$1"
+
+ if ! test -d "$RUNDIR/$isu_pkg_name/rootfs"; then return 1; fi
local mount_unit="run-isu-$(systemd-escape ${isu_pkg_name})-rootfs.mount"
if [ ! -r "$UNITDIR/$mount_unit" ]; then
return 1
fi
+ setup_isu_run_dir "$isu_pkg_dir" "$isu_pkg_name"
install_mount_unit "$isu_pkg_name"
}