[initial-setup][rhel7-branch][PATCH] Use systemd service status for run detection in S390 console (#1181209)

Martin Kolman mkolman at redhat.com
Wed Jul 1 15:12:00 UTC 2015


This greatly simplifies the S390 console scripts and makes
IS activation on the S390 much simpler.
Users now just enable the initial-setup-text service and longer need to
manipulate the /etc/sysconfig/initial-setup configuration file,
which is now ignored.

Resolves: rhbz#1181209
Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 scripts/initial-setup.csh | 20 ++++++--------------
 scripts/initial-setup.sh  | 21 ++++++---------------
 2 files changed, 12 insertions(+), 29 deletions(-)

diff --git a/scripts/initial-setup.csh b/scripts/initial-setup.csh
index 6853c85..1d69315 100644
--- a/scripts/initial-setup.csh
+++ b/scripts/initial-setup.csh
@@ -1,22 +1,14 @@
 # initial-setup.csh
 
 set IS_EXEC = /usr/bin/initial-setup
-set IS_CONF = /etc/sysconfig/initial-setup
+set IS_UNIT = initial-setup-text.service
 
-# check if we should run initial-setup
-grep -i "RUN_INITIAL_SETUP=NO" $IS_CONF >/dev/null
-if (( $? != 0 ) && ( -x $IS_EXEC )) then
+set IS_AVAILABLE = 0
+# check if the Initial Setup unit is enabled and the executable is available
+systemctl -q is-enabled $IS_UNIT && ( -x $IS_EXEC ) && set IS_AVAILABLE = 1
+if (( $IS_AVAILABLE == 1 ) then
     # check if we're not on 3270 terminal and root
     if (( `/sbin/consoletype` == "pty" ) && ( `/usr/bin/id -u` == 0 )) then
-        set args = ""
-        grep -i "reconfig" /proc/cmdline >/dev/null
-        if (( $? == 0 ) || ( -e /etc/reconfigSys )) then
-            set args = "--reconfig"
-        endif
-
-        $IS_EXEC $args
-        if ( $? == 0 ) then
-            [ $? -eq 0 ] && sed -r -i 's/^RUN_INITIAL_SETUP\s*=\s*[yY][eE][sS]\s*/RUN_INITIAL_SETUP=NO/' $IS_CONF
-        endif
+        $IS_EXEC && systemctl -q disable $IS_UNIT
     endif
 endif
diff --git a/scripts/initial-setup.sh b/scripts/initial-setup.sh
index c980323..35d36d0 100644
--- a/scripts/initial-setup.sh
+++ b/scripts/initial-setup.sh
@@ -1,23 +1,14 @@
 # initial-setup.sh
 
 IS_EXEC=/usr/bin/initial-setup
-IS_CONF=/etc/sysconfig/initial-setup
+IS_UNIT=initial-setup-text.service
 
-# source the config file
-[ -f $IS_CONF ] && . $IS_CONF
-
-# check if we should run initial-setup
-if [ -f $IS_EXEC ] && [ "${RUN_INITIAL_SETUP,,}" = "yes" ]; then
+IS_AVAILABLE=0
+# check if the Initial Setup unit is enabled and the executable is available
+systemctl -q is-enabled $IS_UNIT && [ -f $IS_EXEC ] && IS_AVAILABLE=1
+if [ $IS_AVAILABLE -eq 1 ]; then
     # check if we're not on 3270 terminal and root
     if [ $(/sbin/consoletype) = "pty" ] && [ $EUID -eq 0 ]; then
-        args=""
-        if grep -i "reconfig" /proc/cmdline >/dev/null || [ -f /etc/reconfigSys ]; then
-            args="--reconfig"
-        fi
-
-        . /etc/locale.conf
-        . /etc/vconsole.conf
-        $IS_EXEC $args
-        [ $? -eq 0 ] && sed -r -i 's/^RUN_INITIAL_SETUP\s*=\s*[yY][eE][sS]\s*/RUN_INITIAL_SETUP=NO/' $IS_CONF
+        $IS_EXEC && systemctl -q disable $IS_UNIT
     fi
 fi
-- 
2.4.3



More information about the anaconda-patches mailing list