Search
j0ke.net Open Build Service
>
Projects
>
home:jg
:
playground
>
dracut
> 0326-selinux-give-emergency-shell-if-selinux-failed.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0326-selinux-give-emergency-shell-if-selinux-failed.patch of Package dracut
From 158fab27b7fe3c4c6e088c4f358fa9279aab8cc2 Mon Sep 17 00:00:00 2001 From: Harald Hoyer <harald@redhat.com> Date: Thu, 29 Aug 2013 14:37:45 +0200 Subject: [PATCH] selinux: give emergency shell, if selinux failed --- modules.d/99base/dracut-lib.sh | 7 +++++++ modules.d/99base/selinux-loadpolicy.sh | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 3b081e8..171b860 100644 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -114,6 +114,13 @@ die() { exit 1 } +fatal() { + check_quiet + echo "<4>dracut FATAL: $@" > /dev/kmsg + [ "$DRACUT_QUIET" != "yes" ] && \ + echo "dracut FATAL: $@" >&2 +} + check_quiet() { if [ -z "$DRACUT_QUIET" ]; then DRACUT_QUIET="yes" diff --git a/modules.d/99base/selinux-loadpolicy.sh b/modules.d/99base/selinux-loadpolicy.sh index 23a67bd..01d62a5 100755 --- a/modules.d/99base/selinux-loadpolicy.sh +++ b/modules.d/99base/selinux-loadpolicy.sh @@ -49,12 +49,14 @@ rd_load_policy() warn "Initial SELinux policy load failed." if [ $ret -eq 3 -o $permissive -eq 0 ]; then - die "Initial SELinux policy load failed. Machine in enforcing mode. To disable selinux, add selinux=0 to the kernel command line." + fatal "Initial SELinux policy load failed. Machine in enforcing mode. To disable selinux, add selinux=0 to the kernel command line." + emergency_shell -n selinux exit 1 fi return 0 elif [ $permissive -eq 0 -a "$SELINUX" != "disabled" ]; then - die "Machine in enforcing mode and cannot execute load_policy. To disable selinux, add selinux=0 to the kernel command line." + fatal "Machine in enforcing mode and cannot execute load_policy. To disable selinux, add selinux=0 to the kernel command line." + emergency_shell -n selinux exit 1 fi } -- 1.8.3.1