diff options
author | Bill Nottingham <notting@redhat.com> | 2011-12-19 14:52:58 -0500 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2011-12-19 14:52:58 -0500 |
commit | 1c38e273b3b2114ae9525f1ad28ad4f44ce6bf55 (patch) | |
tree | 968b32f3aa339affd589c6e561d949de14f28350 /systemd | |
parent | cd8c0f42dc86280659093c7db0b4a8c2b2448053 (diff) | |
download | initscripts-1c38e273b3b2114ae9525f1ad28ad4f44ce6bf55.tar initscripts-1c38e273b3b2114ae9525f1ad28ad4f44ce6bf55.tar.gz initscripts-1c38e273b3b2114ae9525f1ad28ad4f44ce6bf55.tar.bz2 initscripts-1c38e273b3b2114ae9525f1ad28ad4f44ce6bf55.tar.xz initscripts-1c38e273b3b2114ae9525f1ad28ad4f44ce6bf55.zip |
Don't exit with an error if SEinux isn't active. (#768628)
Diffstat (limited to 'systemd')
-rwxr-xr-x | systemd/fedora-readonly | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/systemd/fedora-readonly b/systemd/fedora-readonly index 4e8003a2..13172892 100755 --- a/systemd/fedora-readonly +++ b/systemd/fedora-readonly @@ -16,6 +16,12 @@ if [ -e "/sys/fs/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "ke fi fi +selinux_fixup() { + if [ -n "$SELINUX_STATE" ] && [ -e "$1" ]; then + restorecon -R "$1" + fi +} + # Only read this once. [ -z "${cmdline}" ] && cmdline=$(cat /proc/cmdline) @@ -91,7 +97,7 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then *) ;; esac - [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path" + selinux_fixup "$path" done done @@ -153,14 +159,14 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then for path in $(grep -v "^#" "$file" 2>/dev/null); do mount_state "$path" - [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path" + selinux_fixup "$path" done done if [ -f "$STATE_MOUNT/files" ] ; then for path in $(grep -v "^#" "$STATE_MOUNT/files" 2>/dev/null); do mount_state "$path" - [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path" + selinux_fixup "$path" done fi fi |