Run firstboot the first time root user logs in
with a capable terminal
---
firstboot.spec | 11 ++++++++++-
scripts/firstboot.sh | 18 ++++++++++++++++++
setup.py | 3 ++-
3 files changed, 30 insertions(+), 2 deletions(-)
create mode 100644 scripts/firstboot.sh
diff --git a/firstboot.spec b/firstboot.spec
index e1e672f..8e84e45 100644
--- a/firstboot.spec
+++ b/firstboot.spec
@@ -3,7 +3,7 @@
Summary: Initial system configuration utility
Name: firstboot
URL: http://fedoraproject.org/wiki/FirstBoot
-Version: 1.110
+Version: 1.111
Release: 1%{?dist}
# This is a Red Hat maintained package which is specific to
# our distribution. Thus the source is only available from
@@ -40,15 +40,20 @@ a series of steps that allows for easier configuration of the machine.
rm -rf %{buildroot}
make DESTDIR=%{buildroot} SITELIB=%{python_sitelib} install
rm %{buildroot}/%{_datadir}/firstboot/modules/additional_cds.py*
+%ifnarch s390 s390x
+rm -rf %{buildroot}/%{_sysconfdir}/profile.d
+%endif
%find_lang %{name}
%clean
rm -rf %{buildroot}
%post
+%ifnarch s390 s390x
if ! [ -f /etc/sysconfig/firstboot ]; then
chkconfig --add firstboot
fi
+%endif
%preun
if [ $1 = 0 ]; then
@@ -71,6 +76,10 @@ 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
+%endif
%changelog
* Wed Oct 14 2009 Chris Lumens <clumens@redhat.com> 1.110-1
diff --git a/scripts/firstboot.sh b/scripts/firstboot.sh
new file mode 100644
index 0000000..474622b
--- /dev/null
+++ b/scripts/firstboot.sh
@@ -0,0 +1,18 @@
+# firstboot.sh
+
+FIRSTBOOT_EXEC=/usr/sbin/firstboot
+FIRSTBOOT_CONF=/etc/sysconfig/firstboot
+
+# check if firstboot is installed and should be run
+if [ -f $FIRSTBOOT_EXEC ] && [ ! -f $FIRSTBOOT_CONF ] || [ -z "$(grep 'RUN_FIRSTBOOT=NO' $FIRSTBOOT_CONF)" ]; then
+ # check if we're on 3270 terminal and root
+ if [ $(/sbin/consoletype) == "pty" ] && [ $(/usr/bin/id -u) -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..38db780 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
from distutils.core import setup
from glob import *
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-11-2010, 06:15 PM
David Cantrell
Fix firstboot for s390 architecture
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This looks good. I have some comments below.
On Thu, 11 Feb 2010, Martin Gracik wrote:
Run firstboot the first time root user logs in
with a capable terminal
---
firstboot.spec | 11 ++++++++++-
scripts/firstboot.sh | 18 ++++++++++++++++++
setup.py | 3 ++-
3 files changed, 30 insertions(+), 2 deletions(-)
create mode 100644 scripts/firstboot.sh
diff --git a/firstboot.spec b/firstboot.spec
index e1e672f..8e84e45 100644
--- a/firstboot.spec
+++ b/firstboot.spec
@@ -3,7 +3,7 @@
Summary: Initial system configuration utility
Name: firstboot
URL: http://fedoraproject.org/wiki/FirstBoot
-Version: 1.110
+Version: 1.111
Release: 1%{?dist}
# This is a Red Hat maintained package which is specific to
# our distribution. Thus the source is only available from
@@ -40,15 +40,20 @@ a series of steps that allows for easier configuration of the machine.
rm -rf %{buildroot}
make DESTDIR=%{buildroot} SITELIB=%{python_sitelib} install
rm %{buildroot}/%{_datadir}/firstboot/modules/additional_cds.py*
+%ifnarch s390 s390x
+rm -rf %{buildroot}/%{_sysconfdir}/profile.d
+%endif
You can probably avoid this removal here with a change to the setup.py script
(see below).
%find_lang %{name}
%clean
rm -rf %{buildroot}
%post
+%ifnarch s390 s390x
if ! [ -f /etc/sysconfig/firstboot ]; then
chkconfig --add firstboot
fi
+%endif
Is this valid shell syntax? I think it should be:
if [ ! -f /etc/sysconfig/firstboot ]; then
I could be wrong here, but I don't care. It's shell and I don't claim to be a
shell expert.
%preun
if [ $1 = 0 ]; then
@@ -71,6 +76,10 @@ 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
+%endif
%changelog
* Wed Oct 14 2009 Chris Lumens <clumens@redhat.com> 1.110-1
diff --git a/scripts/firstboot.sh b/scripts/firstboot.sh
new file mode 100644
index 0000000..474622b
--- /dev/null
+++ b/scripts/firstboot.sh
@@ -0,0 +1,18 @@
+# firstboot.sh
+
+FIRSTBOOT_EXEC=/usr/sbin/firstboot
+FIRSTBOOT_CONF=/etc/sysconfig/firstboot
+
+# check if firstboot is installed and should be run
+if [ -f $FIRSTBOOT_EXEC ] && [ ! -f $FIRSTBOOT_CONF ] || [ -z "$(grep 'RUN_FIRSTBOOT=NO' $FIRSTBOOT_CONF)" ]; then
Rather than grep $FIRSTBOOT_CONF here, you can just source the file and check
the variable. The files in /etc/sysconfig are required to be
shell-sourceable, so that's why they all set variables. Something like this
instead:
[ -f $FIRSTBOOT_CONF ] && . $FIRSTBOOT_CONF
if [ -f $FIRSTBOOT_EXEC ] && [ "${RUN_FIRSTBOOT,,}" = "yes" ]; then
The ,, after RUN_FIRSTBOOT converts the string to lowercase so we only need to
check against 'yes' and not all case variants of 'yes'. ^^ can be used to do
uppercase conversion.
+ # check if we're on 3270 terminal and root
+ if [ $(/sbin/consoletype) == "pty" ] && [ $(/usr/bin/id -u) -eq 0 ]; then
The == may or may not be valid (again, not shell expert). For testing
equality, I always use = inside [ ] in shell.
For the user ID check, you can use $EUID instead of running '/usr/bin/id -u'.
The firstboot init script could also use this change.
+ 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..38db780 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
from distutils.core import setup
from glob import *
Instead of the rm -rf /etc/profile.d in the RPM spec file on non-s390
platforms, you can prevent installation of the profile.d script on non-s390
platforms with this setup.py:
#!/usr/bin/python2
import os
from distutils.core import setup
from glob import *
Since it's just Python code, I broke out data_files to the common section for
all platforms. Then I check uname() and if I see I'm on s390, I add the
profile.d script to data_files.
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2010, 10:33 AM
Martin Gracik
Fix firstboot for s390 architecture
Run firstboot the first time root user logs in
with a capable terminal
---
firstboot.spec | 13 +++++++++++--
scripts/firstboot.sh | 21 +++++++++++++++++++++
setup.py | 19 +++++++++++++------
3 files changed, 45 insertions(+), 8 deletions(-)
create mode 100644 scripts/firstboot.sh
diff --git a/firstboot.spec b/firstboot.spec
index e1e672f..d48ed40 100644
--- a/firstboot.spec
+++ b/firstboot.spec
@@ -3,7 +3,7 @@
Summary: Initial system configuration utility
Name: firstboot
URL: http://fedoraproject.org/wiki/FirstBoot
-Version: 1.110
+Version: 1.111
Release: 1%{?dist}
# This is a Red Hat maintained package which is specific to
# our distribution. Thus the source is only available from
@@ -46,9 +46,11 @@ rm %{buildroot}/%{_datadir}/firstboot/modules/additional_cds.py*
rm -rf %{buildroot}
%post
-if ! [ -f /etc/sysconfig/firstboot ]; then
+%ifnarch s390 s390x
+if [ ! -f /etc/sysconfig/firstboot ]; then
chkconfig --add firstboot
fi
+%endif
%preun
if [ $1 = 0 ]; then
@@ -71,8 +73,15 @@ 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
+%endif
%changelog
+* Fri Feb 12 2010 Martin Gracik <mgracik@redhat.com> 1.111-1
+- Run firstboot the first time root logs in on s390 machines.
+
* Wed Oct 14 2009 Chris Lumens <clumens@redhat.com> 1.110-1
- Always attempt to display the Fedora logo, if present (jmccann).
- Fix a bunch of small firstboot UI problems (jmccann).
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..2cefd1f 100644
--- a/setup.py
+++ b/setup.py
@@ -2,14 +2,21 @@
from distutils.core import setup
from glob import *
+import os
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-15-2010, 08:31 PM
Chris Lumens
Fix firstboot for s390 architecture
> Run firstboot the first time root user logs in
> with a capable terminal
> ---
> firstboot.spec | 13 +++++++++++--
> scripts/firstboot.sh | 21 +++++++++++++++++++++
> setup.py | 19 +++++++++++++------
> 3 files changed, 45 insertions(+), 8 deletions(-)
> create mode 100644 scripts/firstboot.sh
I've never liked this idea, and I continue to not like it. However, I'm
no longer the package maintainer and the patch looks good to me. So I
guess it's fine.
> %changelog
> +* Fri Feb 12 2010 Martin Gracik <mgracik@redhat.com> 1.111-1
> +- Run firstboot the first time root logs in on s390 machines.
> +
If you have a bug number for this (and I'm sure there's at least one)
then you should reference it in the changelog and commit message for our
future reference.
> --- /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
You'll want to take special care here to make sure the arguments for
starting firstboot and the tests for whether we should start it or not
stay the same between this file and the init script.
- Chris
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-16-2010, 07:32 AM
Martin Gracik
Fix firstboot for s390 architecture
I know you didn't want this, but I don't know how else we can do this,
and I don't know about anyone with some good suggestions, so this is it.
Maybe it will only be temporary, and we can find some other way.
I heard that the way suse is doing it, is that after the install,
they run something like firstboot, and on s390 ask the user the connect
with VNC, so that he can see it. Or something like that.
PS: I will add the bug #, thanx, I always forget about that.
--
Martin Gracik
----- "Chris Lumens" <clumens@redhat.com> wrote:
> > Run firstboot the first time root user logs in
> > with a capable terminal
> > ---
> > firstboot.spec | 13 +++++++++++--
> > scripts/firstboot.sh | 21 +++++++++++++++++++++
> > setup.py | 19 +++++++++++++------
> > 3 files changed, 45 insertions(+), 8 deletions(-)
> > create mode 100644 scripts/firstboot.sh
>
> I've never liked this idea, and I continue to not like it. However,
> I'm
> no longer the package maintainer and the patch looks good to me. So
> I
> guess it's fine.
>
> > %changelog
> > +* Fri Feb 12 2010 Martin Gracik <mgracik@redhat.com> 1.111-1
> > +- Run firstboot the first time root logs in on s390 machines.
> > +
>
> If you have a bug number for this (and I'm sure there's at least one)
> then you should reference it in the changelog and commit message for
> our
> future reference.
>
> > --- /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
>
> You'll want to take special care here to make sure the arguments for
> starting firstboot and the tests for whether we should start it or
> not
> stay the same between this file and the init script.
>
> - Chris
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
03-26-2010, 05:56 AM
Martin Gracik
Fix firstboot for s390 architecture
Run firstboot the first time root user logs in
with a capable terminal
---
firstboot.spec | 19 ++++++++++++++++---
scripts/firstboot.csh | 19 +++++++++++++++++++
scripts/firstboot.sh | 21 +++++++++++++++++++++
setup.py | 20 ++++++++++++++------
4 files changed, 70 insertions(+), 9 deletions(-)
create mode 100644 scripts/firstboot.csh
create mode 100644 scripts/firstboot.sh
diff --git a/firstboot.spec b/firstboot.spec
index e1e672f..a352714 100644
--- a/firstboot.spec
+++ b/firstboot.spec
@@ -3,7 +3,7 @@
Summary: Initial system configuration utility
Name: firstboot
URL: http://fedoraproject.org/wiki/FirstBoot
-Version: 1.110
+Version: 1.111
Release: 1%{?dist}
# This is a Red Hat maintained package which is specific to
# our distribution. Thus the source is only available from
@@ -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