diff options
author | ranke <ranke@f247ebf9-aa24-0410-a698-f940e971ad2b> | 2015-12-14 06:58:11 +0000 |
---|---|---|
committer | ranke <ranke@f247ebf9-aa24-0410-a698-f940e971ad2b> | 2015-12-14 06:58:11 +0000 |
commit | 380b86394e0cb71ef4e6297ad72092ebdd9bd80a (patch) | |
tree | 007039d99fb7f2273a823b316638fc2611fbd5e1 /backport_others | |
parent | b8b2e403ae64b417a5928cb6a96b00478869b4f3 (diff) |
Report usage on invalid options, don't use getopts in backport_others
git-svn-id: svn+ssh://stiller/home/schatz/reps/r-backports@113 f247ebf9-aa24-0410-a698-f940e971ad2b
Diffstat (limited to 'backport_others')
-rw-r--r-- | backport_others | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/backport_others b/backport_others index 5e5ab1c..6e92116 100644 --- a/backport_others +++ b/backport_others @@ -12,26 +12,34 @@ echo "Options:" echo " -s Skip apt-get update/upgrade and pbuilder update" } +# Loop over options skip=false -while getopts ":s" flag; do - case $flag in - s) +while test -n "${1}"; do + case "$1" in + -s | --skip) skip=true + shift ;; - \?) - echo "Invalid option: -$OPTARG" >&2 + -*) + echo "Error: Unknown option: $1" >&2 + usage + exit 1 + ;; + *) # No more options + break ;; esac - shift $((OPTIND-1)) done -# Check for number of arguments +# Positional arguments if [ $# -lt 1 ]; then usage; exit 1; fi DIST=$1 # Update pbuilder chroot -if [ "$skip" = true ] +if [ "$skip" = false ] then + sudo apt-get update + sudo apt-get upgrade sudo -E pbuilder update fi @@ -43,7 +51,8 @@ export DIST # built first, then nlme and rmatrix, then the rest # Packages to backport to squeeze/wheezy/jessie (without rpy2): -for i in lattice nlme rmatrix mgcv boot cluster codetools foreign kernsmooth r-cran-class r-cran-coda r-cran-spatial r-cran-nnet r-cran-mass rodbc rpart survival r-cran-littler rpy rkward r-cran-rjags; do +for i in lattice nlme r-cran-coda littler; do +#for i in lattice nlme rmatrix mgcv boot cluster codetools foreign kernsmooth r-cran-class r-cran-coda r-cran-spatial r-cran-nnet r-cran-mass rodbc rpart survival r-cran-littler rpy rkward r-cran-rjags; do ./backport -s $i $DIST |