- add debugging feature: drop to shell upon failure
diff -purNX .cvsignore ../mknetrel.jcn1.init/.cvsignore ./.cvsignore
--- ../mknetrel.jcn1.init/.cvsignore Mon Jul 8 15:42:06 2002
+++ ./.cvsignore Mon Jul 8 16:04:09 2002
@@ -2,3 +2,4 @@ CVS
*~
#*
.#*
+.bash_mknetrel
diff -purNX .cvsignore ../mknetrel.jcn1.init/ChangeLog ./ChangeLog
--- ../mknetrel.jcn1.init/ChangeLog Tue Jul 9 01:17:39 2002
+++ ./ChangeLog Tue Jul 9 01:17:29 2002
@@ -1,5 +1,16 @@
2002-07-08 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
+ * VERSION mknetrel.jcn2.debug
+
+ * .cvsignore: Add .bash_mknetrel.
+
+ * bin/mknetrel (drop): New funtion. Add trap command, to invoke
+ drop () upon unsuccessful exit, so that user make investigate at
+ the spot what went wrong. To test this, make a function such as
+ postconfig () or postbuild () return an error.
+ (usage): Don't drop to shell. Use exit value 2, commonly for
+ usage errors.
+
* VERSION mknetrel.jcn1.init
* .cvsignore: New file.
diff -purNX .cvsignore ../mknetrel.jcn1.init/bin/mknetrel ./bin/mknetrel
--- ../mknetrel.jcn1.init/bin/mknetrel Tue Jul 9 01:06:32 2002
+++ ./bin/mknetrel Tue Jul 9 01:07:05 2002
@@ -14,6 +14,23 @@ read_user_config() {
: ${build_config_opts='--build=i686-pc-linux --host=i686-pc-cygwin
--target=i686-pc-cygwin'}
}
+# Interactive shell with state of bash at exit upon failure
+drop ()
+{
+ [ "$?" -eq 0 ] && trap - 0 9 15 && exit 0 || true
+ echo "$0: dropping to shell..."
+ set | sed -e 's/^\(BASH_VERSINFO=\)/#\1/' \
+ -e 's/^\(EUID=\)/#\1/' \
+ -e 's/^\(PPID=\)/#\1/' \
+ -e 's/^\(SHELLOPTS=\)/#\1/' \
+ -e 's/^\(UID=\)/#\1/' > .bash_mknetrel
+ echo "PS1='mknetrel-debug \w$ '" >> .bash_mknetrel
+ exec bash --rcfile .bash_mknetrel
+}
+
+# Call drop at exit
+trap drop 0 9 15
+
setvars() {
mknetrel=$(cd $(dirname $0)/..; pwd)
cd $netrel_root || exit 1
@@ -329,7 +346,7 @@ Options:
Available packages:
$(cd $(dirname $0)/../extra && echo *[a-z])
" 1>&2
- exit 1
+ trap - 0 9 15 && exit 2
}
rest() {
--
Jan Nieuwenhuizen <[EMAIL PROTECTED]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org