[Apt-zip-devel] r41 - in trunk: . debian methods

Eddy Petrisor eddyp-guest at costa.debian.org
Fri Apr 28 17:04:22 UTC 2006


Author: eddyp-guest
Date: 2006-04-28 17:04:21 +0000 (Fri, 28 Apr 2006)
New Revision: 41

Modified:
   trunk/TODO
   trunk/apt-zip-inst
   trunk/apt-zip-list
   trunk/apt-zip.conf
   trunk/common.sh
   trunk/debian/changelog
   trunk/methods/wget
Log:
misc: corrected indentation in all files
feat: added a clarification in the configuration file referring to the
      ability to use --skip-mount if the media is not in /etc/fstab
misc: added a modeline for vim


Modified: trunk/TODO
===================================================================
--- trunk/TODO	2006-04-08 01:55:53 UTC (rev 40)
+++ trunk/TODO	2006-04-28 17:04:21 UTC (rev 41)
@@ -1,9 +1,6 @@
 Hey Emacs, this is -*- text -*- file.
 
 Open points that should be closed:
-- use a consistent indenting schema (take care that method scripts are
-  dealt differently and should have mixed indenting in order to have nicely
-  indeneted generated scripts)
 - test the md5sum code checking, it was blindly added
 
 * -- File last reviewed: 2006/03/29

Modified: trunk/apt-zip-inst
===================================================================
--- trunk/apt-zip-inst	2006-04-08 01:55:53 UTC (rev 40)
+++ trunk/apt-zip-inst	2006-04-28 17:04:21 UTC (rev 41)
@@ -39,3 +39,7 @@
 [ -n "$APTGETACTION" ] && apt-get ${APTGETEXTRAOPTS} ${APTGETACTION}
 
 az_umount
+
+
+# vim: nowrap:ts=4:sw=4:et:tw=78
+

Modified: trunk/apt-zip-list
===================================================================
--- trunk/apt-zip-list	2006-04-08 01:55:53 UTC (rev 40)
+++ trunk/apt-zip-list	2006-04-28 17:04:21 UTC (rev 41)
@@ -91,3 +91,7 @@
 
 echo "The download size is $DWLSIZE in $PACKCOUNT files."
 
+
+
+# vim: nowrap:ts=4:sw=4:et:tw=78
+

Modified: trunk/apt-zip.conf
===================================================================
--- trunk/apt-zip.conf	2006-04-08 01:55:53 UTC (rev 40)
+++ trunk/apt-zip.conf	2006-04-28 17:04:21 UTC (rev 41)
@@ -5,6 +5,8 @@
 METHOD=wget
 
 # MEDIUM should be defined in /etc/fstab with option `noauto'.
+# It is possible to use an already mounted device or one which is not in
+# /etc/fstab by using the option --skip-mount|-s in the command line
 MEDIUM=/media/zip
 
 # OPTIONS is a comma-separated list of options.

Modified: trunk/common.sh
===================================================================
--- trunk/common.sh	2006-04-08 01:55:53 UTC (rev 40)
+++ trunk/common.sh	2006-04-28 17:04:21 UTC (rev 41)
@@ -36,24 +36,24 @@
 {
 cat <<EOF
 Usage:
-	$(basename $0) [options]
+    $(basename $0) [options]
 
 where options can be:
- -h, --help   	     Print this help message
+ -h, --help          Print this help message
  -V, --version       Print version and exit
  -M, --method=METH   Fetch method METH used on download host
  -m, --medium=DIR    Removable medium at mountpoint DIR for the transfers
  -o, --options=LIST  List of options
  -a, --aptgetaction=ACTION
- 		     Action ACTION done by apt-get
+             Action ACTION done by apt-get
  -p, --packages=LIST
-  	  	     List of extra packages to install
+             List of extra packages to install
  -A, --accept=LIST   List of accepted protocols for download (http,ftp,..)
  -R, --reject=LIST   List of rejected protocols for download (file,cdrom,..)
  -z, --zipopt-file=FILENAME
              Overrides the name of the options file with the given FILENAME
  -f, --fix-broken    Call apt-get with this flag
- -s, --skip-mount    Do not mount a device on the dir specified by --medium 
+ -s, --skip-mount    Do not mount a device on the dir specified by --medium
  -S, --use-sleep=SEC Wait SEC seconds after each download
  -5, --no-md5        Do not make md5 sum checks; Note that if this option is
                      not given at script generation time, the md5sum command
@@ -80,7 +80,7 @@
     FILTER="${SHAREDIR}/methods/$METHOD"
     if [ ! -x "$FILTER" ]
     then
-	error "No $METHOD method installed."
+    error "No $METHOD method installed."
     fi
 }
 
@@ -92,14 +92,14 @@
 az_filter()
 {
     [ -n "$GREP" ] && GREP=${GREP//^/^\'}
-    if [ -n "$ACCEPT" ] ; then 
-	ACCEPT=${ACCEPT#, }
-	ACCEPT=^$(echo "$ACCEPT" | sed -e "s/[, ]\+/\\\|^/g")
-	GREP="'$ACCEPT"
+    if [ -n "$ACCEPT" ] ; then
+    ACCEPT=${ACCEPT#, }
+    ACCEPT=^$(echo "$ACCEPT" | sed -e "s/[, ]\+/\\\|^/g")
+    GREP="'$ACCEPT"
     elif [ -n "$REJECT" ] ; then
-	REJECT=${REJECT#, }
-	REJECT=^$(echo "$REJECT" | sed -e "s/[, ]\+/\\\|^/g")
-	GREP="-v '$REJECT"
+    REJECT=${REJECT#, }
+    REJECT=^$(echo "$REJECT" | sed -e "s/[, ]\+/\\\|^/g")
+    GREP="-v '$REJECT"
     fi
 }
 check_packages()
@@ -108,9 +108,9 @@
 }
 check_aptgetaction()
 {
-    [ -n "$APTGETACTION" ] && 
-	echo "$KNOWNAPTGETACTIONS" | grep " $APTGETACTION " &> /dev/null || 
-	    error "Unknown apt-get action $APTGETACTION"
+    [ -n "$APTGETACTION" ] &&
+    echo "$KNOWNAPTGETACTIONS" | grep " $APTGETACTION " &> /dev/null ||
+        error "Unknown apt-get action $APTGETACTION"
 }
 az_loadconf()
 {
@@ -129,135 +129,135 @@
 {
     while [ $# -gt 0 ]
     do
-	case $1 in
-	--method=*)
-	    METHOD=${1#--method=}
-	    shift
-	    ;;
-	--method|-M)
-	    if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
-	    METHOD=$2
-	    shift
-	    shift
-	    ;;
-	--medium=*)
-	    MEDIUM=${1#--medium=}
-	    #mount point might be relative ( . or .. are legal ;-)
-	    CWD=`pwd`
-	    cd "$MEDIUM"
-	    MEDIUM=`pwd`
-	    cd "${CWD}"	#if path is relative, it might contain spaces
-	    shift
-	    ;;
-	--medium|-m)
-	    if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
-	    MEDIUM=$2
-	    #mount point might be relative ( . or .. are legal ;-)
-	    CWD=`pwd`
-	    cd "$MEDIUM"
-	    MEDIUM=`pwd`
-	    cd "${CWD}"	#if path is relative, it might contain spaces
-	    shift
-	    shift
-	    ;;
-	--options=*)
-	    OPTIONS="$OPTIONS, ${1#--options=}"
-	    shift
-	    ;;
-	--options|-o)
-	    if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
-	    OPTIONS="$OPTIONS, $2"
-	    shift
-	    shift
-	    ;;
-	--no-md5|-5)
-	    CHECKEVALCMD='echo "echo"'
-	    USEMD5SUMS='no'
-	    shift
-	    ;;
-	--use-sleep=*)
-	    SLEEPTIME="${1#--use-sleep=}"
-	    SLEEPEVALCMD='echo "[ ! -z "\`type sleep\`" ] && sleep ${SLEEPTIME}"'
-	    shift
-	    ;;
-	--use-sleep|-S)
-	    if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
-	    SLEEPTIME=$2
-	    SLEEPEVALCMD='echo "[ ! -z "\`type sleep\`" ] && sleep ${SLEEPTIME}"'
-	    shift
-	    shift
-	    ;;
-	--aptgetaction=*)
-	    APTGETACTION=${1#--aptgetaction=}
-	    shift
-	    ;;
-	--aptgetaction|-a)
-	    if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
-	    APTGETACTION=$2
-	    shift
-	    shift
-	    ;;
-	--packages=*)
-	    PACKAGES="$PACKAGES, ${1#--packages=}"
-	    shift
-	    ;;
-	--packages|-p)
-	    if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
-	    PACKAGES="$PACKAGES, $2"
-	    shift
-	    shift
-	    ;;
-	--accept=*)
-	    ACCEPT="$ACCEPT, ${1#--accept=}"
-	    shift
-	    ;;
-	--accept|-A)
-	    if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
-	    ACCEPT="$ACCEPT, $2"
-	    shift
-	    shift
-	    ;;
-	--reject=*)
-	    REJECT="$REJECT, ${1#--reject=}"
-	    shift
-	    ;;
-	--reject|-R)
-	    if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
-	    REJECT="$REJECT, $2"
-	    shift
-	    shift
-	    ;;
-	--zipopt-file=*)
-	    APTZIPINSFILE="${1#--zipopt-file=}"
-	    shift
-	    ;;
-	--zipopt-file|-z)
-	    if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
-	    APTZIPINSFILE="$2"
-	    shift
-	    shift
-	    ;;
-	--fix-broken|-f)
-	    APTGETEXTRAOPTS="${APTGETEXTRAOPTS} $1"
-	    shift
-	    ;;
-	--skip-mount|-s)
-	    SKIPMOUNT=yes
-	    shift
-	    ;;
-	--version|-V)
-	    version_exit
-	    ;;
-	--help|-h)
-	    usage_exit
-	    ;;
-	-*)
-	    syntax_error "Unknown option \`$1'"
-	    ;;
-	*)
-	    syntax_error "No non-option arguments allowed"
-	    ;;
-	esac
+    case $1 in
+    --method=*)
+        METHOD=${1#--method=}
+        shift
+        ;;
+    --method|-M)
+        if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
+        METHOD=$2
+        shift
+        shift
+        ;;
+    --medium=*)
+        MEDIUM=${1#--medium=}
+        #mount point might be relative ( . or .. are legal ;-)
+        CWD=`pwd`
+        cd "$MEDIUM"
+        MEDIUM=`pwd`
+        cd "${CWD}"    #if path is relative, it might contain spaces
+        shift
+        ;;
+    --medium|-m)
+        if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
+        MEDIUM=$2
+        #mount point might be relative ( . or .. are legal ;-)
+        CWD=`pwd`
+        cd "$MEDIUM"
+        MEDIUM=`pwd`
+        cd "${CWD}"    #if path is relative, it might contain spaces
+        shift
+        shift
+        ;;
+    --options=*)
+        OPTIONS="$OPTIONS, ${1#--options=}"
+        shift
+        ;;
+    --options|-o)
+        if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
+        OPTIONS="$OPTIONS, $2"
+        shift
+        shift
+        ;;
+    --no-md5|-5)
+        CHECKEVALCMD='echo "echo"'
+        USEMD5SUMS='no'
+        shift
+        ;;
+    --use-sleep=*)
+        SLEEPTIME="${1#--use-sleep=}"
+        SLEEPEVALCMD='echo "[ ! -z "\`type sleep\`" ] && sleep ${SLEEPTIME}"'
+        shift
+        ;;
+    --use-sleep|-S)
+        if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
+        SLEEPTIME=$2
+        SLEEPEVALCMD='echo "[ ! -z "\`type sleep\`" ] && sleep ${SLEEPTIME}"'
+        shift
+        shift
+        ;;
+    --aptgetaction=*)
+        APTGETACTION=${1#--aptgetaction=}
+        shift
+        ;;
+    --aptgetaction|-a)
+        if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
+        APTGETACTION=$2
+        shift
+        shift
+        ;;
+    --packages=*)
+        PACKAGES="$PACKAGES, ${1#--packages=}"
+        shift
+        ;;
+    --packages|-p)
+        if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
+        PACKAGES="$PACKAGES, $2"
+        shift
+        shift
+        ;;
+    --accept=*)
+        ACCEPT="$ACCEPT, ${1#--accept=}"
+        shift
+        ;;
+    --accept|-A)
+        if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
+        ACCEPT="$ACCEPT, $2"
+        shift
+        shift
+        ;;
+    --reject=*)
+        REJECT="$REJECT, ${1#--reject=}"
+        shift
+        ;;
+    --reject|-R)
+        if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
+        REJECT="$REJECT, $2"
+        shift
+        shift
+        ;;
+    --zipopt-file=*)
+        APTZIPINSFILE="${1#--zipopt-file=}"
+        shift
+        ;;
+    --zipopt-file|-z)
+        if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
+        APTZIPINSFILE="$2"
+        shift
+        shift
+        ;;
+    --fix-broken|-f)
+        APTGETEXTRAOPTS="${APTGETEXTRAOPTS} $1"
+        shift
+        ;;
+    --skip-mount|-s)
+        SKIPMOUNT=yes
+        shift
+        ;;
+    --version|-V)
+        version_exit
+        ;;
+    --help|-h)
+        usage_exit
+        ;;
+    -*)
+        syntax_error "Unknown option \`$1'"
+        ;;
+    *)
+        syntax_error "No non-option arguments allowed"
+        ;;
+    esac
     done
 }
 
@@ -275,27 +275,27 @@
 
     for opt in $OPTIONS
     do
-	# Warn if unknown option
-	local opt_known=0
-	for kopt in $KNOWNOPTIONS
-	do
-	    case $opt in $kopt|NO$kopt|$kopt=*) opt_known=1 ;; esac
-	done
-	[ $opt_known = 0 ] && echo >&2 "WARNING: Unknown option \`$opt'"
+    # Warn if unknown option
+    local opt_known=0
+    for kopt in $KNOWNOPTIONS
+    do
+        case $opt in $kopt|NO$kopt|$kopt=*) opt_known=1 ;; esac
+    done
+    [ $opt_known = 0 ] && echo >&2 "WARNING: Unknown option \`$opt'"
 
-	# Export option
-	case ${opt} in
-	*=*)
-	    eval export OPTION_${opt}
-#	    eval export OPTION_${opt%=*}=${opt#*=}
-	    ;;
-	NO*)
-	    eval export OPTION_${opt#NO}=0
-	    ;;
-	*)
-	    eval export OPTION_${opt}=\${DEFAULT_${opt}-1}
-	    ;;
-	esac
+    # Export option
+    case ${opt} in
+    *=*)
+        eval export OPTION_${opt}
+        #eval export OPTION_${opt%=*}=${opt#*=}
+        ;;
+    NO*)
+        eval export OPTION_${opt#NO}=0
+        ;;
+    *)
+        eval export OPTION_${opt}=\${DEFAULT_${opt}-1}
+        ;;
+    esac
     done
 
     # Special case: set TAR to the 1st of GNUTAR and SOLARISTAR if one is set
@@ -309,43 +309,43 @@
 {
     if [ "$SKIPMOUNT" = no ]
     then
-	# Maybe mount removable medium
-	MNTENTRY=$(mount | egrep "^[^ ]+ on $MEDIUM type ")
-	if [ "$MNTENTRY" ]
-	then
-	    WAS_MOUNTED=1
-	    if mount | grep "${MEDIUM}.*[(,]ro[,)]" >/dev/null
-	    then
-	        error "$MEDIUM is mounted READ ONLY"
-	    fi
-	else
-	    WAS_MOUNTED=0
-	    echo "Mounting $MEDIUM"
-	    local out=$(env LC_ALL=C mount $MEDIUM 2>&1)
-	    if [ "$out" != "" ]
-	    then
-		if echo $out | grep "write-protected" >/dev/null
-		then
-		    error "$MEDIUM is write-protected"
-		else
-		    error $out
-		fi
-	    fi
-	fi
+    # Maybe mount removable medium
+    MNTENTRY=$(mount | egrep "^[^ ]+ on $MEDIUM type ")
+    if [ "$MNTENTRY" ]
+    then
+        WAS_MOUNTED=1
+        if mount | grep "${MEDIUM}.*[(,]ro[,)]" >/dev/null
+        then
+            error "$MEDIUM is mounted READ ONLY"
+        fi
+    else
+        WAS_MOUNTED=0
+        echo "Mounting $MEDIUM"
+        local out=$(env LC_ALL=C mount $MEDIUM 2>&1)
+        if [ "$out" != "" ]
+        then
+        if echo $out | grep "write-protected" >/dev/null
+        then
+            error "$MEDIUM is write-protected"
+        else
+            error $out
+        fi
+        fi
     fi
+    fi
 }
 
 az_umount()
 {
     if [ "$SKIPMOUNT" = no ]
     then
-	# Maybe umount removable medium
-	if [ "$WAS_MOUNTED" = 0 ]
-	then
-	    echo "UnMounting $MEDIUM"
-	    umount "$MEDIUM"
-	fi
+    # Maybe umount removable medium
+    if [ "$WAS_MOUNTED" = 0 ]
+    then
+        echo "UnMounting $MEDIUM"
+        umount "$MEDIUM"
     fi
+    fi
 }
 
 az_exit()
@@ -370,3 +370,6 @@
 #
 trap az_exit EXIT || error "error setting EXIT trap"
 az_init $*
+
+# vim: nowrap:ts=4:sw=4:et:tw=78
+

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-04-08 01:55:53 UTC (rev 40)
+++ trunk/debian/changelog	2006-04-28 17:04:21 UTC (rev 41)
@@ -8,6 +8,7 @@
   * documented in man page the newly added option: -S/--use-sleep
   * document apt-zip-list being runable by non-root
   * reinsert the md5 sums as optional (closes: #184354)
+  * corrected indentation in (all?) apt-zip files
 
  -- Eddy Petrișor <eddy.petrisor at gmail.com>  Sat, 11 Mar 2006 02:09:20 +0200
 

Modified: trunk/methods/wget
===================================================================
--- trunk/methods/wget	2006-04-08 01:55:53 UTC (rev 40)
+++ trunk/methods/wget	2006-04-28 17:04:21 UTC (rev 41)
@@ -73,7 +73,7 @@
 
 if [ "$OPTION_RESTART" = 0 ]
 then
-    cat <<-EOF
+	cat <<-EOF
 
 	do_wget() {
 	    wget -t3 -nv -O \$2 \$1
@@ -109,8 +109,8 @@
 		}
 
 EOF
-    elif [ "$OPTION_TAR" = 0 ] ; then
-    cat <<-EOF
+	elif [ "$OPTION_TAR" = 0 ] ; then
+	cat <<-EOF
 	do_wget() {
 	    if [ -r ../\$2 ] && ${CHECK} ../\$2 \$4 \$? ; then echo "Already got \$2"; return 1; fi
 	    wget -t3 -nv -O \$2 \$1
@@ -120,9 +120,9 @@
 	}
 
 EOF
-    else # OPTION_GNUTAR == 0 and OPTION_TAR != 0
-       error "RESTART only supported with GNUTAR or without TAR"
-    fi
+	else # OPTION_GNUTAR == 0 and OPTION_TAR != 0
+		error "RESTART only supported with GNUTAR or without TAR"
+	fi
 fi
 
 ###############
@@ -131,7 +131,7 @@
 
 if [ "$OPTION_TAR" = 0 ]
 then
-    cat <<-EOF
+	cat <<-EOF
 
 	getfile(){
 	    ( [ -r ../\$2 ] &&  ${CHECK} ../\$2 \$4 \$?  &&   echo \$2 already downloaded.) ||
@@ -141,7 +141,7 @@
 	mkdir -p partial && cd partial || echo >&2  "Cannot change to directory ./partial"
 EOF
 else
-    cat <<-EOF
+	cat <<-EOF
 
 	getfile(){
 	    do_wget \$1 \$2 \$3 \$4 &&




More information about the apt-zip-devel mailing list