[Ovirt-devel] [PATCH node] make ovirt-config-setup menu configurable
Alan Pevec
apevec at redhat.com
Wed Dec 24 22:59:58 UTC 2008
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
More information about the ovirt-devel
mailing list