Warning!

Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!

Add notice regarding bailout for functions
authorMichael Prokop <mika@grml.org>
Mon Apr 16 13:12:41 2007 +0200 (19 months ago)
changeset 111efb48b513e67
manifestefb48b513e67
parent 110377b35ad703d
child 112b705de863fdc
Add notice regarding bailout for functions
chroot-script
grml-debootstrap
--- a/chroot-script Mon Apr 16 13:03:41 2007 +0200
+++ b/chroot-script Mon Apr 16 13:12:41 2007 +0200
@@ -4,7 +4,7 @@
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Mon Apr 16 12:21:19 CEST 2007 [mika]
+# Latest change: Mon Apr 16 13:12:14 CEST 2007 [mika]
################################################################################
set -e # exit on any error
@@ -32,12 +32,12 @@ fi
# helper functions {{{
stage() {
- if grep -q done "$STAGES/$1" 2>/dev/null ; then
- echo " * Notice: stage $1 has been executed already, skipping execution therefore."
- return 1
- else
+ if [ -n "$2" ] ; then
echo "$2" > "$STAGES/$1"
return 0
+ elif grep -q done "$STAGES/$1" 2>/dev/null ; then
+ ewarn "Notice: stage $1 has been executed already, skipping execution therefore." ; eend 0
+ return 1
fi
}
# }}}
--- a/grml-debootstrap Mon Apr 16 13:03:41 2007 +0200
+++ b/grml-debootstrap Mon Apr 16 13:12:41 2007 +0200
@@ -4,7 +4,7 @@
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Don Apr 12 11:55:21 CEST 2007 [mika]
+# Latest change: Mon Apr 16 13:11:33 CEST 2007 [mika]
################################################################################
# http://www.debian.org/releases/stable/i386/index.html.en
@@ -122,6 +122,7 @@ bailout(){
fi
fi
[ -n "$1" ] && EXIT="$1" || EXIT="1"
+ [ -n "$3" ] && einfo "Notice: just remove $STAGES/$3 to reexecute the stage"
exit "$EXIT"
}
trap bailout 1 2 3 15
@@ -274,7 +275,7 @@ for i in mkfs tunefs mount_target deboot
for i in mkfs tunefs mount_target debootstrap_system preparechroot \
chrootscript grub_install umount_chroot fscktool ; do
if stage $i ; then
- $i && stage $i done || bailout
+ $i && stage $i done || bailout 2 "i"
fi
done
# }}}