Skip to content

Commit

Permalink
setup: make sure create rootfs req dirs
Browse files Browse the repository at this point in the history
Fixes: #223

Signed-off-by: Douglas Schilling Landgraf <[email protected]>
  • Loading branch information
dougsland committed Sep 28, 2023
1 parent a378056 commit 99abef0
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion setup
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,23 @@ setupRW() {
mount --bind "${RWVARFS}" "${ROOTFS}/var"
}

create_rootfs_required_dirs() {
# List of directories required for rootfs
directories=(
"${ROOTFS}/etc/containers/"
"${ROOTFS}/usr/share/containers/selinux/"
"${ROOTFS}/etc/selinux/targeted/contexts/files/"
)

for dir in "${directories[@]}"; do
if [ ! -d "$dir" ]; then
mkdir -Z -p "$dir"
echo "Created directory: $dir"
fi
done

}

install() {
ROOTFS=$1
RWETCFS=$2
Expand All @@ -115,6 +132,9 @@ install() {
dnf -y install --releasever="${VERSION_ID}" --installroot "${ROOTFS}" selinux-policy-targeted podman systemd bluechi-agent procps-ng
dnf -y update --installroot "${ROOTFS}"
rm -rf "${ROOTFS}"/etc/selinux/targeted/contexts/files/file_contexts/*

create_rootfs_required_dirs

cp "${INSTALLDIR}/containers.conf" "${ROOTFS}/etc/containers/"
cp "${INSTALLDIR}/contexts" "${ROOTFS}/usr/share/containers/selinux/"
cp "${INSTALLDIR}/file_contexts" "${ROOTFS}/etc/selinux/targeted/contexts/files/file_contexts"
Expand All @@ -125,7 +145,7 @@ install() {
if [ "$SYSTEMCTL_SKIP" == "N" ]; then
unshare --mount-proc -R "${ROOTFS}" -m systemctl enable bluechi-agent.service
else
chroot $ROOTFS ln -fs \
chroot "${ROOTFS}" ln -fs \
/usr/lib/systemd/system/bluechi-agent.service \
/etc/systemd/system/multi-user.target.wants/bluechi-agent.service
fi
Expand Down

0 comments on commit 99abef0

Please sign in to comment.