setup
branchipv6
changeset 8 f1e2fbfb530c
parent 7 13183092a453
child 9 a70798743739
equal deleted inserted replaced
7:13183092a453 8:f1e2fbfb530c
     1 #! /bin/bash
     1 #! /bin/bash
     2 
     2 
     3 opt_n=
     3 opt_n=
     4 opt_u=
     4 opt_u=
     5 
     5 
     6 tmp=$(getopt -n setup -o nu -l nothing,update -- "$@") \
     6 tmp=$(getopt -n setup -o nux -l nothing,update -- "$@") \
     7 	|| cat >&2 <<_
     7 	|| {
       
     8 	cat >&2 <<_
     8 Usage: $0 [-n|--nothing] [-u|--update] [directories]
     9 Usage: $0 [-n|--nothing] [-u|--update] [directories]
     9 _
    10 _
       
    11 	exit 2
       
    12 }
    10 
    13 
    11 set -- $tmp
    14 set -- $tmp
    12 
    15 
    13 while : 
    16 while : 
    14 do
    17 do
    15 	opt="$1"; shift
    18 	opt="$1"; shift
    16 	case "$opt" in
    19 	case "$opt" in
    17 		-n|--nothing)	opt_n=-n;;
    20 		-n|--nothing)	opt_n=-n;;
    18 		-u|--update)	opt_u=1;;
    21 		-u|--update)	opt_u=1;;
       
    22 		-x)		opt_x=1;;
    19 		--)		break;;
    23 		--)		break;;
    20 	esac
    24 	esac
    21 done
    25 done
    22 
    26 
    23 if test -n $opt_u; then
    27 test -n "$opt_x" && opt_u=
       
    28 
       
    29 if test -n "$opt_u"; then
    24 	hg pull -u
    30 	hg pull -u
       
    31 	exec $0 -x $@
    25 fi
    32 fi
    26 
    33 
    27 # install some packages we need for this script
    34 # install some packages we need for this script
    28 zypper install rsync
    35 zypper install rsync
    29 
    36