From 5a34a28455350aedcbf47d255baf80fde39c79b5 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 19 Jun 2008 11:14:17 -0400 Subject: Revert "Remove rhgb support." This reverts commit c722b0ee95746aa9289efd40bbdd23a87d1e5dee. --- prefdm | 5 +++++ rc.d/init.d/functions | 20 ++++++++++++++++++++ rc.d/init.d/netfs | 4 ++++ rc.d/rc | 10 ++++++++++ rc.d/rc.sysinit | 47 +++++++++++++++++++++++++++++++++++++++++------ 5 files changed, 80 insertions(+), 6 deletions(-) diff --git a/prefdm b/prefdm index d014f747..3baa6933 100755 --- a/prefdm +++ b/prefdm @@ -2,6 +2,11 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin +# shut down any graphical boot that might exist +if [ -x /usr/bin/rhgb-client ]; then + /usr/bin/rhgb-client --quit +fi + # We need to source this so that the login screens get translated [ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index d54861da..fed1fafa 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -459,6 +459,11 @@ echo_warning() { # Inform the graphical boot of our current state update_boot_stage() { + if [ "$GRAPHICAL" = "yes" ]; then + if [ -x /usr/bin/rhgb-client ]; then + /usr/bin/rhgb-client --update="$1" + fi + fi return 0 } @@ -478,6 +483,7 @@ failure() { # initlog $INITLOG_ARGS -n $0 -s "$1" -e 2 #fi [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure + [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --details=yes return $rc } @@ -507,10 +513,22 @@ action() { STRING=$1 echo -n "$STRING " + if [ "${RHGB_STARTED:-}" != "" -a -w /etc/rhgb/temp/rhgb-console ]; then + echo -n "$STRING " > /etc/rhgb/temp/rhgb-console + fi shift "$@" && success $"$STRING" || failure $"$STRING" rc=$? echo + if [ "${RHGB_STARTED:-}" != "" -a -w /etc/rhgb/temp/rhgb-console ]; then + if [ "$rc" = "0" ]; then + echo_success > /etc/rhgb/temp/rhgb-console + else + echo_failure > /etc/rhgb/temp/rhgb-console + [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --details=yes + fi + echo > /etc/rhgb/temp/rhgb-console + fi return $rc } @@ -522,6 +540,7 @@ strstr() { # Confirm whether we really want to run this service confirm() { + [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --details=yes while : ; do echo -n $"Start service $1 (Y)es/(N)o/(C)ontinue? [Y] " read answer @@ -529,6 +548,7 @@ confirm() { return 0 elif strstr $"cC" "$answer" ; then rm -f /var/run/confirm + [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --details=no return 2 elif strstr $"nN" "$answer" ; then return 1 diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs index 211874d6..1ad100bb 100755 --- a/rc.d/init.d/netfs +++ b/rc.d/init.d/netfs @@ -70,6 +70,10 @@ case "$1" in fi if [ "$rc" -gt 1 ]; then + if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then + /usr/bin/rhgb-client --details=yes >/dev/null 2>&1 + fi + failure "$STRING" echo echo diff --git a/rc.d/rc b/rc.d/rc index 2766aa68..0d1abd12 100755 --- a/rc.d/rc +++ b/rc.d/rc @@ -29,6 +29,10 @@ export runlevel previous export CONSOLETYPE cmdline=$(cat /proc/cmdline) +if ! strstr "$cmdline" rhgb; then + GRAPHICAL="no" + export GRAPHICAL +fi do_confirm="no" if [ -f /var/run/confirm ]; then do_confirm="yes" @@ -93,6 +97,7 @@ for i in /etc/rc$runlevel.d/S* ; do set +x fi + update_boot_stage "$subsys" # Bring the subsystem up. [ -n "$UPSTART" ] && initctl emit --quiet "starting $subsys" if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then @@ -103,3 +108,8 @@ for i in /etc/rc$runlevel.d/S* ; do [ -n "$UPSTART" ] && initctl emit --quiet "started $subsys" done [ "$do_confirm" = "yes" ] && rm -f /var/run/confirm +if [ "$GRAPHICAL" = "yes" ]; then + if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then + /usr/bin/rhgb-client --quit + fi +fi diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index ba61fc6e..2a0f61bc 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -54,6 +54,9 @@ disable_selinux() { } relabel_selinux() { + if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then + /usr/bin/rhgb-client --quit + fi # if /sbin/init is not labeled correctly this process is running in the # wrong context, so a reboot will be required after relabel REBOOTFLAG=`restorecon -v /sbin/init` @@ -188,6 +191,10 @@ init_crypto() { ret=1 continue fi + if [ -z "$key" -a -x /usr/bin/rhgb-client ] \ + && /usr/bin/rhgb-client --ping ; then + /usr/bin/rhgb-client --quit + fi if [ -z "$makeswap" ] && cryptsetup isLuks "$src" 2>/dev/null ; then if key_is_random "$key"; then echo $"$dst: LUKS requires non-random key, skipping" @@ -296,13 +303,21 @@ fi # Start the graphical boot, if necessary; /usr may not be mounted yet, so we # may have to do this again after mounting +RHGB_STARTED= mount -n /dev/pts >/dev/null 2>&1 [ -n "$SELINUX_STATE" ] && restorecon /dev/pts >/dev/null 2>&1 +if strstr "$cmdline" rhgb && ! strstr "$cmdline" early-login && [ "$BOOTUP" = "color" -a "$GRAPHICAL" = "yes" -a -x /usr/bin/rhgb ]; then + ( . /etc/sysconfig/i18n 2>/dev/null ; /usr/bin/rhgb ) + RHGB_STARTED=1 +fi + # Configure kernel parameters +update_boot_stage RCkernelparam sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 # Set the hostname. +update_boot_stage RChostname action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME} # Device mapper & related initialization @@ -538,7 +553,11 @@ if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then STRING=$"Checking filesystems" echo $STRING - fsck -T -t noopts=_netdev -A $fsckoptions + if [ -n "${RHGB_STARTED}" -a -w /etc/rhgb/temp/rhgb-console ]; then + fsck -T -t noopts=_netdev -A $fsckoptions > /etc/rhgb/temp/rhgb-console + else + fsck -T -t noopts=_netdev -A $fsckoptions + fi rc=$? if [ "$rc" -eq "0" ]; then @@ -557,6 +576,10 @@ if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then # A return of 4 or higher means there were serious problems. if [ $rc -gt 1 ]; then + if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then + /usr/bin/rhgb-client --quit + fi + failure "$STRING" echo echo @@ -596,6 +619,7 @@ remount_needed() { } # Remount the root filesystem read-write. +update_boot_stage RCmountfs if remount_needed ; then action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw / fi @@ -650,6 +674,13 @@ else fi fi + +# Start the graphical boot, if necessary and not done yet. +if strstr "$cmdline" rhgb && ! strstr "$cmdline" early-login && [ -z "$RHGB_STARTED" -a "$BOOTUP" = "color" -a "$GRAPHICAL" = "yes" -a -x /usr/bin/rhgb ]; then + ( . /etc/sysconfig/i18n 2>/dev/null ; /usr/bin/rhgb ) + RHGB_STARTED=1 +fi + # Initialize pseudo-random number generator if [ -f "/var/lib/random-seed" ]; then cat /var/lib/random-seed > /dev/urandom @@ -670,6 +701,10 @@ fi # Configure machine if necessary. if [ -f /.unconfigured ]; then + if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then + /usr/bin/rhgb-client --quit + fi + if [ -x /usr/bin/system-config-keyboard ]; then /usr/bin/system-config-keyboard fi @@ -744,6 +779,7 @@ chown root:root /tmp/.ICE-unix [ -n "$SELINUX_STATE" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1 # Start up swapping. +update_boot_stage RCswap action $"Enabling /etc/fstab swaps: " swapon -a -e if [ "$AUTOSWAP" = "yes" ]; then curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do get_numeric_dev dec $x ; echo -n " "; done) @@ -798,9 +834,8 @@ fi wait [ "$PROMPT" != no ] && rm -f /var/run/getkey_done -if [ -f /etc/sysconfig/mcheck ]; then - . /etc/sysconfig/mcheck - if [ -n "$MALLOC_CHECK_" ]; then - export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) - fi +# Let rhgb know that we're leaving rc.sysinit +if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then + /usr/bin/rhgb-client --sysinit fi + -- cgit v1.2.1