Alan Pevec
2008-Dec-24 22:59 UTC
[Ovirt-devel] [PATCH node] make ovirt-config-setup menu configurable
custom menu option can be added using a symlink in /etc/ovirt-config-setup.d/ pointing to the script to be executed implement default options using this method --- ovirt-node.spec.in | 10 ++++++++++ scripts/ovirt-config-setup | 25 +++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index d7424c1..f529f60 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -121,6 +121,7 @@ cd - %install %{__rm} -rf %{buildroot} +# FIXME move installs into makefile %{__install} -d -m0755 %{buildroot}%{_sbindir} %{__install} -d -m0755 %{buildroot}%{_sysconfdir} %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/chkconfig.d @@ -182,6 +183,14 @@ mkdir -p %{buildroot}/usr/lib/anaconda-runtime install -p -m 644 images/syslinux-vesa-splash.jpg %{buildroot}/usr/lib/anaconda-runtime # ovirt-logos +# default ovirt-config-setup menu options +%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/ovirt-config-setup.d +%{__ln_s} ../..%{_sbindir}/ovirt-config-networking %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Networking Setup" +%{__ln_s} ../..%{_sbindir}/ovirt-config-storage %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Disk Partitioning" +%{__ln_s} ../..%{_sbindir}/ovirt-config-logging %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Logging Setup" +%{__ln_s} ../..%{_sbindir}/ovirt-config-password %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Administrator Password" + + %clean %{__rm} -rf %{buildroot} @@ -256,6 +265,7 @@ fi %{_initrddir}/ovirt-post %config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf %config %{_sysconfdir}/cron.hourly/ovirt-logrotate +%{_sysconfdir}/ovirt-config-setup.d %files stateful %defattr(-,root,root,0755) diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup index 20dd5ae..9f97afc 100755 --- a/scripts/ovirt-config-setup +++ b/scripts/ovirt-config-setup @@ -2,21 +2,23 @@ # # Entry point for configuring an oVirt node when running in standalone mode. -NETWORK="Networking Setup" -STORAGE="Disk Partitioning" -LOGGING="Logging Setup" -PASSWORD="Administrator Password" +# symlinked scripts for menu options, link name is menu label +CONFIG_DIR=/etc/ovirt-config-setup.d + +# special options, all others execute the symlinked script in CONFIG_DIR DEBUG_SHELL="Shell" CONTINUE="Continue" declare -a OPTIONS -OPTIONS[${#OPTIONS[*]}]="$NETWORK" -OPTIONS[${#OPTIONS[*]}]="$STORAGE" -OPTIONS[${#OPTIONS[*]}]="$LOGGING" -OPTIONS[${#OPTIONS[*]}]="$PASSWORD" +for cfg in $CONFIG_DIR/*; do + label=$(basename "$cfg") + OPTIONS[${#OPTIONS[*]}]="$label" +done OPTIONS[${#OPTIONS[*]}]="$CONTINUE" OPTIONS[${#OPTIONS[*]}]="$DEBUG_SHELL" + + # reset tty, otherwise serial console is broken reset > /dev/null clear @@ -29,14 +31,9 @@ while true; do select OPTION in "${OPTIONS[@]}" do case "$OPTION" in - "$NETWORK") ovirt-config-networking ; break ;; - "$STORAGE") - ovirt-config-storage ; - break ;; - "$LOGGING") ovirt-config-logging ; break ;; - "$PASSWORD") ovirt-config-password ; break ;; "$DEBUG_SHELL") bash ; break ;; "$CONTINUE") exit 0 ;; + *) $CONFIG_DIR/"$OPTION" ;; esac printf "\n" -- 1.6.0.6
Alan Pevec
2008-Dec-24 22:59 UTC
[Ovirt-devel] [PATCH node] add "Local install and reboot" option
ovirt-config-boot can be called without parameters, as an option in ovirt-config-setup menu, defaults are taken from /etc/default/ovirt --- ovirt-node.spec.in | 1 + scripts/ovirt-config-boot | 35 +++++++++++++++++++++++++++-------- scripts/ovirt-config-storage | 1 + scripts/ovirt-early | 4 +--- scripts/ovirt-firstboot | 17 ++--------------- scripts/ovirt-functions | 11 +++++++++++ 6 files changed, 43 insertions(+), 26 deletions(-) diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index f529f60..e5031ad 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -189,6 +189,7 @@ install -p -m 644 images/syslinux-vesa-splash.jpg %{buildroot}/usr/lib/anaconda- %{__ln_s} ../..%{_sbindir}/ovirt-config-storage %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Disk Partitioning" %{__ln_s} ../..%{_sbindir}/ovirt-config-logging %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Logging Setup" %{__ln_s} ../..%{_sbindir}/ovirt-config-password %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Administrator Password" +%{__ln_s} ../..%{_sbindir}/ovirt-config-boot %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Local install and reboot" %clean diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot index d7bd48a..8ddd46a 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -1,28 +1,28 @@ #!/bin/bash # -# ovirt-config-boot - configure local boot disk partition +# ovirt-config-boot - configure local boot/root disk partitions # SYNOPSIS -# ovirt-config-boot livecd_path bootparams +# ovirt-config-boot boot_disk livecd_path bootparams reboot # # boot_disk - boot disk device e.g. /dev/sda +# default is $OVIRT_INIT # # livecd_path - where livecd media is mounted, # parent of LiveOS and isolinux folders +# default is /live # # bootparams - extra boot parameters like console=... +# default is $OVIRT_BOOTPARAMS # +# reboot - reboot after install +# default is yes # Source functions library . /etc/init.d/functions . /etc/init.d/ovirt-functions -# local_boot_install livecd_path bootparams -# livecd_path -livecd media -# bootparams - extra boot parameters like console=... -# -# copy oVirt Node image to the local LVM /dev/HostVG ovirt_boot_setup() { local disk=$1 local live=$2 @@ -127,5 +127,24 @@ EOF } -ovirt_boot_setup "$1" "$2" "$3" +disk=$1 +live=$2 +bootparams=$3 +doreboot=$4 +if [ -z "$disk" ]; then + disk=$OVIRT_INIT +fi +if [ -z "$live" ]; then + mount_live + live=/live +fi +if [ -z "$bootparams" ]; then + bootparams="$OVIRT_BOOTPARAMS" +fi + +ovirt_boot_setup "$disk" "$live" "$bootparams" +if [ -z "$doreboot" -o "$doreboot" = "yes" ]; then + disable_firstbot + reboot +fi diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index ff2a3b2..1c31a58 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -114,6 +114,7 @@ do_configure() done # save input variables augtool <<EOF > /dev/null +set /files$OVIRT_DEFAULTS/OVIRT_INIT $DRIVE set /files$OVIRT_DEFAULTS/OVIRT_VOL_BOOT_SIZE $BOOT_SIZE set /files$OVIRT_DEFAULTS/OVIRT_VOL_SWAP_SIZE $SWAP_SIZE set /files$OVIRT_DEFAULTS/OVIRT_VOL_ROOT_SIZE $ROOT_SIZE diff --git a/scripts/ovirt-early b/scripts/ovirt-early index ecdf52e..7ee2357 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -319,9 +319,7 @@ start() { $BONDING_MODCONF_FILE if [ $local_boot = 1 ]; then # local disk installation for managed mode - mount_live - ovirt-config-boot $init /live "$bootparams" - reboot + ovirt-config-boot $init "" "$bootparams" fi fi fi diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index da03b98..fe7723f 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -27,18 +27,6 @@ . /etc/init.d/functions . /etc/init.d/ovirt-functions -disable_firstboot () -{ - if mount_config; then - umount_config $OVIRT_DEFAULTS - augtool > /dev/null <<EOF -set /files$OVIRT_DEFAULTS/OVIRT_FIRSTBOOT no -save -EOF - ovirt_store_config $OVIRT_DEFAULTS - fi -} - start () { if is_auto_install; then @@ -46,9 +34,8 @@ start () ovirt-config-storage AUTO ovirt-config-logging AUTO if [ "$OVIRT_LOCAL_BOOT" = 1 ]; then - mount_live - ovirt-config-boot $OVIRT_INIT /live "$OVIRT_BOOTPARAMS" - disable_firstboot + ovirt-config-boot $OVIRT_INIT "" "$OVIRT_BOOTPARAMS" no + disable_firstbot reboot fi elif is_firstboot; then diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index e20bab9..9301678 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -49,6 +49,17 @@ is_firstboot() { fi } +disable_firstboot() { + if mount_config; then + umount_config $OVIRT_DEFAULTS + augtool > /dev/null <<EOF +set /files$OVIRT_DEFAULTS/OVIRT_FIRSTBOOT no +save +EOF + ovirt_store_config $OVIRT_DEFAULTS + fi +} + # find_srv SERVICE PROTO # # reads DNS SRV record -- 1.6.0.6
Darryl L. Pierce
2009-Jan-05 18:14 UTC
[Ovirt-devel] [PATCH node] make ovirt-config-setup menu configurable
On Wed, Dec 24, 2008 at 11:59:58PM +0100, Alan Pevec wrote:> custom menu option can be added using a symlink in > /etc/ovirt-config-setup.d/ pointing to the script to be executed > > implement default options using this methodACK. The patch works well. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090105/70de77e5/attachment.sig>
Darryl L. Pierce
2009-Jan-05 18:56 UTC
[Ovirt-devel] [PATCH node] add "Local install and reboot" option
On Wed, Dec 24, 2008 at 11:59:59PM +0100, Alan Pevec wrote:> ovirt-config-boot can be called without parameters, as an option > in ovirt-config-setup menu, defaults are taken from /etc/default/ovirtACK. Works well. I did notice something we ought to fix WRT the install portion. If the script doesn't see any partitioning table then it should show an error message and return the user to the menu rather than continuing. Otherwise if someone tries to install and reboot they'll get a quick flash of text and then reboots without the user seeing the problem. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090105/78b627ab/attachment.sig>
Darryl L. Pierce
2009-Jan-05 19:27 UTC
[Ovirt-devel] [PATCH node] add "Local install and reboot" option
On Wed, Dec 24, 2008 at 11:59:59PM +0100, Alan Pevec wrote:> -ovirt_boot_setup "$1" "$2" "$3" > +disk=$1 > +live=$2 > +bootparams=$3 > +doreboot=$4 > +if [ -z "$disk" ]; then > + disk=$OVIRT_INIT > +fi > +if [ -z "$live" ]; then > + mount_live > + live=/live > +fi > +if [ -z "$bootparams" ]; then > + bootparams="$OVIRT_BOOTPARAMS" > +fi > + > +ovirt_boot_setup "$disk" "$live" "$bootparams" > > +if [ -z "$doreboot" -o "$doreboot" = "yes" ]; then > + disable_firstbotMissed this earlier. There's a typo here, should be "disable_firstboot" shouldn't it? -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090105/4a46ab31/attachment.sig>