Support --force option to skip user acknowledgement and do not prompt for user input.
authorMichael Prokop <mika@grml.org>
Mon, 30 May 2011 21:05:19 +0000 (23:05 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 30 May 2011 21:05:23 +0000 (23:05 +0200)
cmdlineopts.clp
grml-debootstrap
grml-debootstrap.8.txt

index 6479dbc..880b50d 100644 (file)
@@ -12,7 +12,7 @@
 # should be handled in the main script, where it belongs.
 ################################################################################
 
 # should be handled in the main script, where it belongs.
 ################################################################################
 
-CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,interactive,nodebootstrap,nopackages,filesystem:,config:,confdir:,packages:,chroot-scripts:,scripts:,pre-scripts:,debconf:,vmfile,vmsize:,keep_src_list,hostname:,password:,bootappend:,grub:,arch:,insecure,verbose,help,version
+CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,interactive,nodebootstrap,nopackages,filesystem:,config:,confdir:,packages:,chroot-scripts:,scripts:,pre-scripts:,debconf:,vmfile,vmsize:,keep_src_list,hostname:,password:,bootappend:,grub:,arch:,insecure,verbose,help,version,force
 
 _opt_temp=`getopt --name grml-debootstrap -o +m:i:r:t:p:c:d:vhV --long \
     $CMDLINE_OPTS -- "$@"`
 
 _opt_temp=`getopt --name grml-debootstrap -o +m:i:r:t:p:c:d:vhV --long \
     $CMDLINE_OPTS -- "$@"`
@@ -124,6 +124,9 @@ while :; do
   --version|-V)        # Show version information and exit
     _opt_version=T
     ;;
   --version|-V)        # Show version information and exit
     _opt_version=T
     ;;
+  --force)             # Do not prompt for user input
+    _opt_force=T
+    ;;
   --)
     shift; break
     ;;
   --)
     shift; break
     ;;
index 111e8e8..b030ff0 100755 (executable)
@@ -17,6 +17,7 @@ MNTPOINT="/mnt/debootstrap.$$"
 
 # defaults
 VMSIZE="2G"
 
 # defaults
 VMSIZE="2G"
+FORCE=''
 
 # inside the chroot system locales might not be available, so use minimum:
 export LANG=C
 
 # inside the chroot system locales might not be available, so use minimum:
 export LANG=C
@@ -56,6 +57,7 @@ Bootstrap options:
       --filesystem <fs>  Filesystem that should be used when target is a partition
                          or Virtual Machine (see --vmfile).
       --insecure         Do not download and check Release file signatures.
       --filesystem <fs>  Filesystem that should be used when target is a partition
                          or Virtual Machine (see --vmfile).
       --insecure         Do not download and check Release file signatures.
+      --force            Do not prompt for user acknowledgement.
 
 Options for Virtual Machine deployment:
 
 
 Options for Virtual Machine deployment:
 
@@ -163,6 +165,7 @@ fi
 [ "$_opt_grub" ]                && GRUB=$_opt_grub
 [ "$_opt_arch" ]                && ARCH=$_opt_arch
 [ "$_opt_insecure" ]            && SECURE='false'
 [ "$_opt_grub" ]                && GRUB=$_opt_grub
 [ "$_opt_arch" ]                && ARCH=$_opt_arch
 [ "$_opt_insecure" ]            && SECURE='false'
+[ "$_opt_force" ]               && FORCE=$_opt_force
 [ "$_opt_verbose" ]             && VERBOSE="-v"
 
 [ "$_opt_help" ] && {
 [ "$_opt_verbose" ]             && VERBOSE="-v"
 
 [ "$_opt_help" ] && {
@@ -550,12 +553,16 @@ else # if not running automatic installation display configuration and prompt fo
    echo
    echo "   Important! Continuing will delete all data from ${TARGET}!"
 
    echo
    echo "   Important! Continuing will delete all data from ${TARGET}!"
 
-   echo
-   einfon "Is this ok for you? [y/N] "
-   read a
-   if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then
-      eerror "Exiting as requested." ; eend 1
-      exit 1
+   if [ -n "$FORCE" ] ; then
+     einfo "Skip user acknowledgement as requested via --force option."
+   else
+     echo
+     einfon "Is this ok for you? [y/N] "
+     read a
+     if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then
+        eerror "Exiting as requested." ; eend 1
+        exit 1
+     fi
    fi
 fi
 }
    fi
 fi
 }
index 3144ebe..a18ad84 100644 (file)
@@ -71,6 +71,10 @@ Options and environment variables
     If unset defaults to ext3. Valid values are all filesystems that
     can be created through mkfs.<filesystem>.
 
     If unset defaults to ext3. Valid values are all filesystems that
     can be created through mkfs.<filesystem>.
 
+*--force*::
+
+    Skip user acknowledgement and do not prompt for user input.
+
 *--grub* <_device_>::
 
     Device where grub should be installed to. Note that only the MBR (master
 *--grub* <_device_>::
 
     Device where grub should be installed to. Note that only the MBR (master