# defaults
VMSIZE="2G"
+FORCE=''
# inside the chroot system locales might not be available, so use minimum:
export LANG=C
--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:
elif [ -r /usr/share/grml-debootstrap/functions/cmdlineopts.clp ] ; then
. /usr/share/grml-debootstrap/functions/cmdlineopts.clp
else
- echo "Error: cmdline function file not found, exiting.">&2
+ eerror "Error: cmdline function file not found, exiting."
+ eend 1
exit 1
fi
[ "$_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" ] && {
# backwards compability checks {{{
if [ -n "$GROOT" ] ; then
- echo "Error: you seem to have \$GROOT configured." >&2
- echo "This variable is no longer supported, please visit the" >&2
- echo "grml-debootstrap documentation for details." >&2
+ eerror "Error: you seem to have \$GROOT configured."
+ eerror "This variable is no longer supported, please visit the"
+ eerror "grml-debootstrap documentation for details."
+ eend 1
exit 1
fi
if echo "$GRUB" | grep -q '^hd' ; then
- echo "Error: this syntax for the grub configuration variable is no longer supported." >&2
- echo "Please do not use hd... any longer but /dev/sdX instead." >&2
+ eerror "Error: this syntax for the grub configuration variable is no longer supported."
+ eerror "Please do not use hd... any longer but /dev/sdX instead."
+ eend 1
exit 1
fi
# }}}
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
}
DEVINFO=$(kpartx -av $TARGET) # 'add map loop1p1 (253:0): 0 6289408 linear /dev/loop1 2048'
if [ -z "${DEVINFO}" ] ; then
- echo Error setting up loopback device >&2
+ eerror "Error setting up loopback device." ; eend 1
exit 1
fi
blockdev --rereadpt "${LOOP}"
if [ -z "$TARGET" ] ; then
- echo "Error: target could not be set to according /dev/mapper/* device." >&2
+ eerror "Error: target could not be set to according /dev/mapper/* device." ; eend 1
exit 1
fi
}