diff options
author | Yi Zhao <yi.zhao@windriver.com> | 2021-12-08 15:33:44 +0800 |
---|---|---|
committer | Joe MacDonald <joe@deserted.net> | 2021-12-08 16:08:34 -0500 |
commit | 19089953e2a2ce8d68f92fb51b1ca3922ea66966 (patch) | |
tree | e5f3a8b423d93ff709c0ab9073d7dcc0ea3a7a1b /recipes-security/selinux-scripts/selinux-autorelabel/selinux-autorelabel.sh | |
parent | e16200c8eb28318a665d7b9dadfe199c3e6641eb (diff) | |
download | meta-selinux-19089953e2a2ce8d68f92fb51b1ca3922ea66966.tar.gz |
selinux: move selinux scripts to selinux-scripts
There are too many recipes in recipes-security/selinux. Keep the selinux
userspace recipes and move selinux scripts to selinux-scripts directory
to make the directory hierarchy clearer.
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
Diffstat (limited to 'recipes-security/selinux-scripts/selinux-autorelabel/selinux-autorelabel.sh')
-rw-r--r-- | recipes-security/selinux-scripts/selinux-autorelabel/selinux-autorelabel.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/recipes-security/selinux-scripts/selinux-autorelabel/selinux-autorelabel.sh b/recipes-security/selinux-scripts/selinux-autorelabel/selinux-autorelabel.sh new file mode 100644 index 0000000..25b6921 --- /dev/null +++ b/recipes-security/selinux-scripts/selinux-autorelabel/selinux-autorelabel.sh | |||
@@ -0,0 +1,25 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | /usr/sbin/selinuxenabled 2>/dev/null || exit 0 | ||
4 | |||
5 | FIXFILES=/sbin/fixfiles | ||
6 | SETENFORCE=/usr/sbin/setenforce | ||
7 | |||
8 | for i in ${FIXFILES} ${SETENFORCE}; do | ||
9 | test -x $i && continue | ||
10 | echo "$i is missing in the system." | ||
11 | echo "Please add \"selinux=0\" in the kernel command line to disable SELinux." | ||
12 | exit 1 | ||
13 | done | ||
14 | |||
15 | # If /.autorelabel placed, the whole file system should be relabeled | ||
16 | if [ -f /.autorelabel ]; then | ||
17 | echo "SELinux: /.autorelabel placed, filesystem will be relabeled..." | ||
18 | ${SETENFORCE} 0 | ||
19 | ${FIXFILES} -F -f relabel | ||
20 | /bin/rm -f /.autorelabel | ||
21 | echo " * Relabel done, rebooting the system." | ||
22 | /sbin/reboot | ||
23 | fi | ||
24 | |||
25 | exit 0 | ||