From 8b1c652b800232a1ec82272e9802f1a252cf0f36 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Tue, 15 Apr 2014 12:41:00 +0200 Subject: [PATCH 1/1] Provide --debug option for very verbose execution This effectively executes grml-debootstrap under 'set -x' (including the chroot script), so it's easy to generate an execution log via e.g.: grml-debootstrap ... --debug --force 2>&1 | tee -a grml-deboootstrap.log and providing it to grml-debootstrap developers for further investigation. --- cmdlineopts.clp | 5 ++++- grml-debootstrap | 12 +++++++++++- grml-debootstrap.8.txt | 5 +++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cmdlineopts.clp b/cmdlineopts.clp index db8ebf6..fd773e8 100644 --- a/cmdlineopts.clp +++ b/cmdlineopts.clp @@ -12,7 +12,7 @@ # 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:,nopassword,grmlrepos,backportrepos,bootappend:,grub:,arch:,insecure,verbose,help,version,force +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:,nopassword,grmlrepos,backportrepos,bootappend:,grub:,arch:,insecure,verbose,help,version,force,debug _opt_temp=`getopt --name grml-debootstrap -o +m:i:r:t:p:c:d:vhV --long \ $CMDLINE_OPTS -- "$@"` @@ -128,6 +128,9 @@ while :; do if [ "$_opt_verbose" ]; then _opt_verbose=`expr $_opt_verbose + 1` else _opt_verbose=1; fi ;; + --debug) # Execute in debug mode + _opt_debug==T + ;; --help|-h) # Print usage information and exit _opt_help=T ;; diff --git a/grml-debootstrap b/grml-debootstrap index 576a8b6..66c8213 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -108,6 +108,7 @@ Configuration options: Other options: -v, --verbose Increase verbosity. + --debug Execute in very verbose way. -h, --help Print this usage information and exit. -V, --version Show summary of options and exit. @@ -333,6 +334,11 @@ fi [ "$_opt_insecure" ] && echo "Warning: --insecure is deprecated, continuing anyway." [ "$_opt_force" ] && FORCE=$_opt_force [ "$_opt_verbose" ] && VERBOSE="-v" +[ "$_opt_debug" ] && DEBUG="true" + +if [ "$DEBUG" = "true" ] ; then + set -x +fi [ "$_opt_help" ] && { usage ; eend 0 @@ -1277,7 +1283,11 @@ chrootscript() { else einfo "Executing chroot-script now" mount --bind /dev "$MNTPOINT"/dev - chroot "$MNTPOINT" /bin/chroot-script ; RC=$? + if [ "$DEBUG" = "true" ] ; then + chroot "$MNTPOINT" /bin/sh -x /bin/chroot-script ; RC=$? + else + chroot "$MNTPOINT" /bin/chroot-script ; RC=$? + fi umount "$MNTPOINT"/dev eend $RC fi diff --git a/grml-debootstrap.8.txt b/grml-debootstrap.8.txt index 4f6fa97..1cacd8a 100644 --- a/grml-debootstrap.8.txt +++ b/grml-debootstrap.8.txt @@ -73,6 +73,11 @@ Options and environment variables Extra parameters passed to the debootstrap command. +*--debug*:: + + Execute in very verbose way. Useful for debugging possible problems + with grml-debootstrap or identify what's actually executed. + *--filesystem* _filesystem_:: Filesystem that should be created when installing to a partition. -- 2.1.4