diff options
author | xtraeme <xtraeme@pkgsrc.org> | 2007-04-11 14:22:26 +0000 |
---|---|---|
committer | xtraeme <xtraeme@pkgsrc.org> | 2007-04-11 14:22:26 +0000 |
commit | 82b06fb2a021e3a3c42e391d36cc113d147220d2 (patch) | |
tree | 291e26a372be3576b36ef9cde7bd461294095317 /sysutils/mklivecd | |
parent | 186ea1906e6cd5219744c83e22ec4c83577d42c7 (diff) | |
download | pkgsrc-82b06fb2a021e3a3c42e391d36cc113d147220d2.tar.gz |
Extra bonus for 0.15.1: check value in options accepting 'yes' or 'no'
values (case insensitive), show an error message if the value
is not accepted and exit.
Diffstat (limited to 'sysutils/mklivecd')
-rwxr-xr-x | sysutils/mklivecd/files/mklivecd.sh | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/sysutils/mklivecd/files/mklivecd.sh b/sysutils/mklivecd/files/mklivecd.sh index 478122ddbef..b894973ab83 100755 --- a/sysutils/mklivecd/files/mklivecd.sh +++ b/sysutils/mklivecd/files/mklivecd.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: mklivecd.sh,v 1.36 2007/04/11 11:51:35 xtraeme Exp $ +# $NetBSD: mklivecd.sh,v 1.37 2007/04/11 14:22:26 xtraeme Exp $ # # Copyright (c) 2004-2007 Juan Romero Pardines. # All rights reserved. @@ -148,6 +148,37 @@ is_disabled() esac } +showmsg_optyesno() +{ + echo + echo "This option only accepts a value of 'yes' or 'no'" + echo "(case insensitive), please update your configuration." + echo "See mklivecd(8) for more details." + + return 1 +} + +checkoptval() +{ + _opt="$1" + eval _val="\$$1" + + if [ -z $_opt ]; then + echo "*** '$_opt' is not set ***" + showmsg_optyesno + fi + + case $_val in + [Yy][Ee][Ss]|[Nn][Oo]) + return 0 + ;; + *) + echo "*** Invalid value for '$_opt' ***" + showmsg_optyesno + ;; + esac +} + bye() { _exitarg="$1" @@ -367,8 +398,6 @@ _EOF_ do_build_kernels() { - . $config_file - for K in ${MULTIPLE_KERNELS} do eval bootkern=\$KERNEL_CONFIG_${K} @@ -447,6 +476,14 @@ do_cdlive() { . $config_file + YESNOVARS="FETCH_SETS ENABLE_X11 USE_GNU_GRUB \ + VND_COMPRESSION BLANK_BEFORE_BURN" + + for v in $YESNOVARS + do + ! checkoptval $v && bye 1 + done + vars="$BASEDIR $ISODIR $WORKDIR" for value in $vars @@ -649,7 +686,7 @@ do_cdlive() cat > $ISODIR/etc/rc.d/root <<_EOF_ #!/bin/sh # -# \$NetBSD: mklivecd.sh,v 1.36 2007/04/11 11:51:35 xtraeme Exp $ +# \$NetBSD: mklivecd.sh,v 1.37 2007/04/11 14:22:26 xtraeme Exp $ # # PROVIDE: root |