[firstboot 1/4] Fix firstboot for s390 architecture (#463564)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Run firstboot the first time root user logs in
with a capable terminal
---
 firstboot.spec        |   15 +++++++++++++--
 scripts/firstboot.csh |   19 +++++++++++++++++++
 scripts/firstboot.sh  |   21 +++++++++++++++++++++
 setup.py              |   18 +++++++++++++-----
 4 files changed, 66 insertions(+), 7 deletions(-)
 create mode 100644 scripts/firstboot.csh
 create mode 100644 scripts/firstboot.sh

diff --git a/firstboot.spec b/firstboot.spec
index ce925e1..3382f34 100644
--- a/firstboot.spec
+++ b/firstboot.spec
@@ -46,8 +46,13 @@ rm %{buildroot}/%{_datadir}/firstboot/modules/additional_cds.py*
 rm -rf %{buildroot}
 
 %post
-if ! [ -f /etc/sysconfig/firstboot ]; then
-  chkconfig --add firstboot
+if [ ! -f /etc/sysconfig/firstboot ]; then
+  platform="$(arch)"
+  if [ "$platform" = "s390" -o "$platform" = "s390x" ]; then
+    echo "RUN_FIRSTBOOT=YES" > /etc/sysconfig/firstboot
+  else
+    chkconfig --add firstboot
+  fi
 fi
 
 %preun
@@ -71,6 +76,12 @@ fi
 %{_datadir}/firstboot/modules/eula.py*
 %{_datadir}/firstboot/modules/welcome.py*
 %{_datadir}/firstboot/themes/default/*
+%ifarch s390 s390x
+%dir %{_sysconfdir}/profile.d
+%{_sysconfdir}/profile.d/firstboot.sh
+%{_sysconfdir}/profile.d/firstboot.csh
+%endif
+
 
 %changelog
 * Tue Aug 10 2010 Martin Gracik <mgracik@xxxxxxxxxx> 1.110.8-1
diff --git a/scripts/firstboot.csh b/scripts/firstboot.csh
new file mode 100644
index 0000000..07a4ab7
--- /dev/null
+++ b/scripts/firstboot.csh
@@ -0,0 +1,19 @@
+# firstboot.csh
+
+set FIRSTBOOT_EXEC = /usr/sbin/firstboot
+set FIRSTBOOT_CONF = /etc/sysconfig/firstboot
+
+# check if we should run firstboot
+grep -i "RUN_FIRSTBOOT=NO" $FIRSTBOOT_CONF >/dev/null
+if (( $? != 0 ) && ( -x $FIRSTBOOT_EXEC )) 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
+
+        $FIRSTBOOT_EXEC $args
+    endif
+endif
diff --git a/scripts/firstboot.sh b/scripts/firstboot.sh
new file mode 100644
index 0000000..5b4ec9d
--- /dev/null
+++ b/scripts/firstboot.sh
@@ -0,0 +1,21 @@
+# firstboot.sh
+
+FIRSTBOOT_EXEC=/usr/sbin/firstboot
+FIRSTBOOT_CONF=/etc/sysconfig/firstboot
+
+# source the config file
+[ -f $FIRSTBOOT_CONF ] && . $FIRSTBOOT_CONF
+
+# check if we should run firstboot
+if [ -f $FIRSTBOOT_EXEC ] && [ "${RUN_FIRSTBOOT,,}" = "yes" ]; 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/sysconfig/i18n
+        $FIRSTBOOT_EXEC $args
+    fi
+fi
diff --git a/setup.py b/setup.py
index 6249be6..e98ecfd 100644
--- a/setup.py
+++ b/setup.py
@@ -2,14 +2,22 @@
 
 from distutils.core import setup
 from glob import *
+import os
+
+data_files = [('/usr/sbin', ['progs/firstboot']),
+              ('/etc/rc.d/init.d', ['init/firstboot']),
+              ('/usr/share/firstboot/themes/default',
+               glob('themes/default/*.png')),
+              ('/usr/share/firstboot/modules', glob('modules/*.py'))]
+
+# add the firstboot start script for s390 architectures
+if os.uname()[4].startswith('s390'):
+    data_files.append(('/etc/profile.d', ['scripts/firstboot.sh']))
+    data_files.append(('/etc/profile.d', ['scripts/firstboot.csh']))
 
 setup(name='firstboot', version='1.110',
       description='Post-installation configuration utility',
       author='Chris Lumens', author_email='clumens@xxxxxxxxxx',
       url='http://fedoraproject.org/wiki/FirstBoot',
-      data_files=[('/usr/sbin', ['progs/firstboot']),
-                  ('/etc/rc.d/init.d', ['init/firstboot']),
-                  ('/usr/share/firstboot/themes/default', glob('themes/default/*.png')),
-                  ('/usr/share/firstboot/modules', glob('modules/*.py')),
-                 ],
+      data_files=data_files,
       packages=['firstboot'])
-- 
1.7.3.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux