Commit 341c9718 by Dwight Engen Committed by Stéphane Graber

oracle: fix chcon warning when selinux disabled

parent 64994c03
...@@ -46,6 +46,15 @@ is_btrfs_subvolume() ...@@ -46,6 +46,15 @@ is_btrfs_subvolume()
return 1 return 1
} }
can_chcon()
{
if which chcon >/dev/null 2>&1; then
selinuxenabled >/dev/null 2>&1
return $?
fi
return 1
}
# fix up the container_rootfs # fix up the container_rootfs
container_rootfs_configure() container_rootfs_configure()
{ {
...@@ -312,7 +321,7 @@ EOF ...@@ -312,7 +321,7 @@ EOF
if [ $container_rootfs != "/" -a -d $dev_path ]; then if [ $container_rootfs != "/" -a -d $dev_path ]; then
rm -rf $dev_path rm -rf $dev_path
mkdir -p $dev_path mkdir -p $dev_path
if which chcon >/dev/null 2>&1 ; then if can_chcon; then
# ensure symlinks created in /dev have the right context # ensure symlinks created in /dev have the right context
chcon -t device_t $dev_path chcon -t device_t $dev_path
fi fi
...@@ -333,7 +342,7 @@ EOF ...@@ -333,7 +342,7 @@ EOF
mknod -m 600 $dev_path/initctl p mknod -m 600 $dev_path/initctl p
# set selinux labels same as host # set selinux labels same as host
if which chcon >/dev/null 2>&1 ; then if can_chcon; then
for node in null zero random urandom pts shm \ for node in null zero random urandom pts shm \
tty tty0 tty1 tty2 tty3 tty4 full ; tty tty0 tty1 tty2 tty3 tty4 full ;
do do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment