Add semanage.sh script

The `semanage.sh` script starts an interactive shell in an alternate
mount namespace where `/etc/selinux` and `/var/lib/selinux` are
bind-mounted from the target filesystem.  This allows SELinux management
commands like `setsebool`, `semodule, `semanage`, etc. to work on the
target policy, since not all of them directly support working on an
alternate policy.
master
Dustin 2023-03-30 11:02:44 -05:00
parent d8e0af477a
commit dd178aaaba
1 changed files with 10 additions and 0 deletions

10
semanage.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
if [ -z ${UNSHARED} ]; then
export UNSHARED=1
exec unshare -m "$0" "$@"
fi
unset UNSHARED
mount -o bind /mnt/gentoo/etc/selinux /etc/selinux
mount -o bind /mnt/gentoo/var/lib/selinux /var/lib/selinux
exec bash