File label-install of Package neuvector-demo

#!/bin/sh -eu

# This is the install script for neuvector-demo container
# when run in a privileged container.
#
# The host file system must be mounted at /host

cd /
PATH="/usr/bin:/usr/sbin"
MISSING_PACKAGES=0
: "${HOST:=/host}"
: "${ORIGIN:=}"

if [ ! -d $HOST/etc ] || [ ! -d $HOST/proc ] || [ ! -d $HOST/run ]; then
    echo "neuvector-install: host file system is not mounted at $HOST"
    exit 1
fi

# For podman, install systemd units
if [ "${container:-}" = podman ]; then
    if [ ! -e $HOST/etc/systemd/system/neuvector.service ]; then
	mkdir -p $HOST/etc/systemd/system/
	cp -f *.service $HOST/etc/systemd/system/
    fi
    mkdir -p $HOST/var/neuvector
    if [ ! -e $HOST/etc/containers/kube/neuvector.yaml ]; then
	mkdir -p $HOST/etc/containers/kube
	cp -f neuvector.yaml $HOST/etc/containers/kube
    fi
fi

# force systemd to reload its config, requires install label to run container to be run pid=host
kill -HUP 1
openSUSE Build Service is sponsored by