setup
branchipv6
changeset 8 f1e2fbfb530c
parent 7 13183092a453
child 9 a70798743739
--- a/setup	Tue Jun 12 11:34:10 2012 +0200
+++ b/setup	Wed Jun 13 18:27:45 2012 +0200
@@ -3,10 +3,13 @@
 opt_n=
 opt_u=
 
-tmp=$(getopt -n setup -o nu -l nothing,update -- "$@") \
-	|| cat >&2 <<_
+tmp=$(getopt -n setup -o nux -l nothing,update -- "$@") \
+	|| {
+	cat >&2 <<_
 Usage: $0 [-n|--nothing] [-u|--update] [directories]
 _
+	exit 2
+}
 
 set -- $tmp
 
@@ -16,12 +19,16 @@
 	case "$opt" in
 		-n|--nothing)	opt_n=-n;;
 		-u|--update)	opt_u=1;;
+		-x)		opt_x=1;;
 		--)		break;;
 	esac
 done
 
-if test -n $opt_u; then
+test -n "$opt_x" && opt_u=
+
+if test -n "$opt_u"; then
 	hg pull -u
+	exec $0 -x $@
 fi
 
 # install some packages we need for this script