Index: common.sh =================================================================== --- common.sh (revision 37) +++ common.sh (revision 39) @@ -1,6 +1,6 @@ # library file sourced by apt-zip-* -APTZIPVERSION=0.13.7 +APTZIPVERSION=0.14 export APTZIPVERSION CONFFILE=/etc/apt/apt-zip.conf @@ -55,6 +55,10 @@ -f, --fix-broken Call apt-get with this flag -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 + will be called only after it has been found in the + system. EOF } @@ -113,6 +117,8 @@ # make sure that we will have a valid command for sleep SLEEPTIME=0 SLEEPEVALCMD='true' + CHECKEVALCMD='echo "check"' + USEMD5SUMS='yes' [ -r $CONFFILE ] && . $CONFFILE METHOD=${METHOD-wget} MEDIUM=${MEDIUM-/ZIP} @@ -164,6 +170,11 @@ shift shift ;; + --no-md5|-5) + CHECKEVALCMD='echo "echo"' + USEMD5SUMS='no' + shift + ;; --use-sleep=*) SLEEPTIME="${1#--use-sleep=}" SLEEPEVALCMD='echo "[ ! -z "\`type sleep\`" ] && sleep ${SLEEPTIME}"' Index: debian/changelog =================================================================== --- debian/changelog (revision 37) +++ debian/changelog (revision 39) @@ -8,6 +8,7 @@ * corrected type of --skip-mount element in manual (closes: #358678) * 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) -- Eddy Petrișor Sat, 11 Mar 2006 02:09:20 +0200 Index: methods/wget =================================================================== --- methods/wget (revision 37) +++ methods/wget (revision 39) @@ -24,7 +24,29 @@ } EOF + ############### +# add check code, if is wanted +# +[ ! "${USEMD5SUMS}" = 'no' ] && cat <<-EOF + check(){ + [ ! -r "\$1" ] && return 1 + [ "\`type md5sum\`" ] && + if [ "\`md5sum \$1 | cut -d' ' -f1\`" = \$2 ] + then return 0 + else err \$1 "wrong MD5"; return 1 + fi + [ "\`type gzip\`" ] && + if ar p \$1 data.tar.gz | gzip -t + then return 0 + else err \$1 "wrong contents"; return 1 + fi + return \$3 + } +EOF + + +############### # Differences between gnutar and solaris # if [ "$OPTION_SOLARISTAR" != 0 ] ; then @@ -55,6 +77,7 @@ do_wget() { wget -t3 -nv -O \$2 \$1 + ${CHECK} \$2 \$4 \$? ${SLEEPCMD} return \$? } @@ -77,9 +100,10 @@ if [ -r "$OLDTARFILE" ] && "$TAR" "$TARTEST" "$OLDTARFILE" \$2 >/dev/null 2>&1 then "$TAR" "$TAREXTRACT" "$OLDTARFILE" \$2 - if [ -r \$2 ] ; then echo "Already got \$2"; return 0; fi + if [ -r \$2 ] && ${CHECK} \$2 \$4 \$? ; then echo "Already got \$2"; return 0; fi fi wget -nc -t3 -nv -O \$2 \$1 + ${CHECK} \$2 \$4 \$? ${SLEEPCMD} return \$? } @@ -88,8 +112,9 @@ elif [ "$OPTION_TAR" = 0 ] ; then cat <<-EOF do_wget() { - if [ -r ../\$2 ] ; then echo "Already got \$2"; return 1; fi + if [ -r ../\$2 ] && ${CHECK} ../\$2 \$4 \$? ; then echo "Already got \$2"; return 1; fi wget -t3 -nv -O \$2 \$1 + ${CHECK} \$2 \$4 \$? ${SLEEPCMD} return \$? } @@ -109,7 +134,7 @@ cat <<-EOF getfile(){ - ( [ -r ../\$2 ] && echo \$2 already downloaded.) || + ( [ -r ../\$2 ] && ${CHECK} ../\$2 \$4 \$? && echo \$2 already downloaded.) || (do_wget \$1 \$2 \$3 \$4 && mv \$2 ../) } Index: TODO =================================================================== --- TODO (revision 37) +++ TODO (revision 39) @@ -4,5 +4,6 @@ - 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 Index: apt-zip.sgml =================================================================== --- apt-zip.sgml (revision 37) +++ apt-zip.sgml (revision 39) @@ -184,7 +184,19 @@ - + + + --no-md5, -5 + + This option will command to apt-zip-list to create a + script which does not make any md5sum checks. + Note that if this option is not given at script generation + time, the md5sum command will be called only after it has + been found in the system. + + + + Index: apt-zip-list =================================================================== --- apt-zip-list (revision 37) +++ apt-zip-list (revision 39) @@ -69,6 +69,7 @@ #export the sleep command so it is visible in the method script export SLEEPTIME export SLEEPCMD=`eval "$SLEEPEVALCMD"` +export CHECK=`eval "$CHECKEVALCMD"` # Write the script SCRIPT="${MEDIUM}"/fetch-script-$METHOD-$(uname -n)