Merge pull request #761 from ibuildthecloud/master

Check for semanage command availability
pull/754/head^2
Erik Wilson 2019-08-26 09:35:41 -07:00 committed by GitHub
commit 9a89d1f4c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -337,11 +337,15 @@ setup_binary() {
if command -v getenforce > /dev/null 2>&1; then if command -v getenforce > /dev/null 2>&1; then
if [ "Disabled" != $(getenforce) ]; then if [ "Disabled" != $(getenforce) ]; then
info "SeLinux is enabled, setting permissions" if command -v semanage > /dev/null 2>&1; then
if ! $SUDO semanage fcontext -l | grep "${BIN_DIR}/k3s" > /dev/null 2>&1; then info "SELinux is enabled, setting permissions"
$SUDO semanage fcontext -a -t bin_t "${BIN_DIR}/k3s" if ! $SUDO semanage fcontext -l | grep "${BIN_DIR}/k3s" > /dev/null 2>&1; then
$SUDO semanage fcontext -a -t bin_t "${BIN_DIR}/k3s"
fi
$SUDO restorecon -v ${BIN_DIR}/k3s > /dev/null
else
error 'SELinux is enabled but semanage is not found'
fi fi
$SUDO restorecon -v ${BIN_DIR}/k3s > /dev/null
fi fi
fi fi
} }