Eli Mesika has uploaded a new change for review.

Change subject: core:Unable to restore DB when selinux is disabled.
......................................................................

core:Unable to restore DB when selinux is disabled.

Change script to manipulate files by chcon only when SELinux is not in
the Disabled mode.

Change-Id: I76ca818acf53759eae2576302e4ca19ab3988103
Signed-off-by: Eli Mesika <[email protected]>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=980042
---
M packaging/dbscripts/restore.sh
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/22/16322/1

diff --git a/packaging/dbscripts/restore.sh b/packaging/dbscripts/restore.sh
index eee49ba..a4c9b68 100755
--- a/packaging/dbscripts/restore.sh
+++ b/packaging/dbscripts/restore.sh
@@ -40,11 +40,15 @@
     dir="/tmp/${name}_dir"
     mkdir "${dir}"
     chmod 777 "${dir}"
-    # Restoring SELinux default settings
-    chcon -Rt postgresql_db_t ${dir}
-    if [ $? -ne 0 ]; then
-        echo "Failed to restore SELinux default settings for ${dir}."
-        exit 5
+    # Check SELinux mode
+    selinux_mode=$(getenforce |tr '[A-Z]' '[a-z]')
+    if [ "${selinux_mode}" != "disabled" ]; then
+        # Restoring SELinux default settings
+        chcon -Rt postgresql_db_t ${dir}
+        if [ $? -ne 0 ]; then
+            echo "Failed to restore SELinux default settings for ${dir}."
+            exit 5
+        fi
     fi
     cp "${FILE}" "${dir}/${name}"
     pushd "${dir}"


-- 
To view, visit http://gerrit.ovirt.org/16322
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I76ca818acf53759eae2576302e4ca19ab3988103
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to