Bryan Kearney
2009-Jan-08 21:22 UTC
[Ovirt-devel] [PATCH node] Added a wrapper script around the boot menu item to warn the users about the reboot
--- Makefile.am | 1 + ovirt-node.spec.in | 4 +++- scripts/ovirt-config-boot-wrapper | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletions(-) create mode 100644 scripts/ovirt-config-boot-wrapper diff --git a/Makefile.am b/Makefile.am index 6847234..c62774f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,6 +30,7 @@ EXTRA_DIST = \ scripts/ovirt \ scripts/ovirt-awake \ scripts/ovirt-config-boot \ + scripts/ovirt-config-boot-wrapper \ scripts/ovirt-config-hostname \ scripts/ovirt-config-logging \ scripts/ovirt-config-networking \ diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 501bf4f..f30dd62 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -132,6 +132,7 @@ cd - %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-boot %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-boot-wrapper %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-hostname %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} @@ -191,7 +192,7 @@ install -p -m 644 images/syslinux-vesa-splash.jpg %{buildroot}/usr/lib/anaconda- %{__ln_s} ../..%{_sbindir}/ovirt-config-networking %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"15_Networking Setup" %{__ln_s} ../..%{_sbindir}/ovirt-config-storage %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"20_Disk Partitioning" %{__ln_s} ../..%{_sbindir}/ovirt-config-logging %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"30_Logging Setup" -%{__ln_s} ../..%{_sbindir}/ovirt-config-boot %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"99_Local install and reboot" +%{__ln_s} ../..%{_sbindir}/ovirt-config-boot-wrapper %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"99_Local install and reboot" %clean @@ -253,6 +254,7 @@ fi %defattr(-,root,root,0755) %{_sbindir}/ovirt-awake %{_sbindir}/ovirt-config-boot +%{_sbindir}/ovirt-config-boot-wrapper %{_sbindir}/ovirt-config-hostname %{_sbindir}/ovirt-config-logging %{_sbindir}/ovirt-config-networking diff --git a/scripts/ovirt-config-boot-wrapper b/scripts/ovirt-config-boot-wrapper new file mode 100644 index 0000000..6876a30 --- /dev/null +++ b/scripts/ovirt-config-boot-wrapper @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Wrapper function to make sure the user wishes to continue before +# rebooting the system + +while true; do + read -p "This option will exit the menu, and require a reboot. Do you wish to continue? (Y|N)? " + r=$(echo $REPLY|tr '[[:lower:]]' '[[:upper:]]') + if [ "$r" == "Y" ]; then + /usr/sbin/ovirt-config-boot + break + elif [ "$r" == "N" ]; then + printf "\nExiting back to the menu\n" + break + fi +done -- 1.6.0.6
Perry Myers
2009-Jan-14 15:12 UTC
[Ovirt-devel] [PATCH node] Added a wrapper script around the boot menu item to warn the users about the reboot
Question on this patch, why did you create a separate script to wrap the o-c-boot script instead of just putting a question at the top of the main section of the o-c-boot script itself? You could just have o-c-boot be executed directly by the firstboot menu and the first thing it does is say "Are you sure" and if the user says No then it just exits back to the main menu. Also, do we have sanity checks in place for o-c-boot that check to make sure that other things have been run like o-c-networking and o-c-storage? If we don't have this, add that to the top of main in o-c-boot along with the user question. Finally, in a fully automated boot (i.e. all opts passed on kernel cmdline) none of these user interactive questions should come up (this is probably the case, just stating to make sure it's clear) Perry Bryan Kearney wrote:> --- > Makefile.am | 1 + > ovirt-node.spec.in | 4 +++- > scripts/ovirt-config-boot-wrapper | 16 ++++++++++++++++ > 3 files changed, 20 insertions(+), 1 deletions(-) > create mode 100644 scripts/ovirt-config-boot-wrapper > > diff --git a/Makefile.am b/Makefile.am > index 6847234..c62774f 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -30,6 +30,7 @@ EXTRA_DIST = \ > scripts/ovirt \ > scripts/ovirt-awake \ > scripts/ovirt-config-boot \ > + scripts/ovirt-config-boot-wrapper \ > scripts/ovirt-config-hostname \ > scripts/ovirt-config-logging \ > scripts/ovirt-config-networking \ > diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in > index 501bf4f..f30dd62 100644 > --- a/ovirt-node.spec.in > +++ b/ovirt-node.spec.in > @@ -132,6 +132,7 @@ cd - > > %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir} > %{__install} -p -m0755 scripts/ovirt-config-boot %{buildroot}%{_sbindir} > +%{__install} -p -m0755 scripts/ovirt-config-boot-wrapper %{buildroot}%{_sbindir} > %{__install} -p -m0755 scripts/ovirt-config-hostname %{buildroot}%{_sbindir} > %{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} > %{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} > @@ -191,7 +192,7 @@ install -p -m 644 images/syslinux-vesa-splash.jpg %{buildroot}/usr/lib/anaconda- > %{__ln_s} ../..%{_sbindir}/ovirt-config-networking %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"15_Networking Setup" > %{__ln_s} ../..%{_sbindir}/ovirt-config-storage %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"20_Disk Partitioning" > %{__ln_s} ../..%{_sbindir}/ovirt-config-logging %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"30_Logging Setup" > -%{__ln_s} ../..%{_sbindir}/ovirt-config-boot %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"99_Local install and reboot" > +%{__ln_s} ../..%{_sbindir}/ovirt-config-boot-wrapper %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"99_Local install and reboot" > > > %clean > @@ -253,6 +254,7 @@ fi > %defattr(-,root,root,0755) > %{_sbindir}/ovirt-awake > %{_sbindir}/ovirt-config-boot > +%{_sbindir}/ovirt-config-boot-wrapper > %{_sbindir}/ovirt-config-hostname > %{_sbindir}/ovirt-config-logging > %{_sbindir}/ovirt-config-networking > diff --git a/scripts/ovirt-config-boot-wrapper b/scripts/ovirt-config-boot-wrapper > new file mode 100644 > index 0000000..6876a30 > --- /dev/null > +++ b/scripts/ovirt-config-boot-wrapper > @@ -0,0 +1,16 @@ > +#!/bin/bash > +# > +# Wrapper function to make sure the user wishes to continue before > +# rebooting the system > + > +while true; do > + read -p "This option will exit the menu, and require a reboot. Do you wish to continue? (Y|N)? " > + r=$(echo $REPLY|tr '[[:lower:]]' '[[:upper:]]') > + if [ "$r" == "Y" ]; then > + /usr/sbin/ovirt-config-boot > + break > + elif [ "$r" == "N" ]; then > + printf "\nExiting back to the menu\n" > + break > + fi > +done-- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=|