Skip to content

Commit 227eeff

Browse files
committed
Adjust SELinux context replace 'chcon' to 'semanage'
1 parent 89643ce commit 227eeff

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

builds/install/posix-common/posixLibrary.sh.in

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,28 @@ fixFilePermissions() {
931931
cd @FB_BINDIR@
932932
for FileName in fbguard
933933
do
934-
chcon -t bin_t $FileName
934+
935+
# check need fcontext
936+
if [[ $(ls -Z / | grep usr | grep system_u:) ]]; then
937+
938+
# check fcontext for fbguard not bin_t
939+
if [[ ! $(ls -Z \"$FileName\" | grep bin_t) ]];
940+
941+
# check semanage exists
942+
if [[ $(command -v semanage) ]]; then
943+
944+
semanage fcontext --add -t bin_t \"$FileName\"? 2>/dev/null
945+
restorecon -vRF \"$FileName\" 2>/dev/null
946+
947+
else
948+
949+
echo "/n $(ls -Z \"$FileName\")"
950+
echo "/nPlease install 'semanage' and 'restorecon' from 'policycoreutils-python(-utils)' and reinstall firebird \n for '$FileName' may be run as service."
951+
952+
fi
953+
954+
fi
955+
fi
935956
done
936957

937958
# Lock files

0 commit comments

Comments
 (0)