/usr/bin/apt-zip-list is in apt-zip 0.18.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | #!/bin/bash
exithook()
{
#rm -f "$TMP" "$TEMP" "$BSTMP"
rm -f "$TMP" "$TEMP"
}
SHAREDIR=$(cd $(dirname $0) && pwd)
[ -r "${SHAREDIR}/common.sh" ] || SHAREDIR=/usr/share/apt-zip
. "${SHAREDIR}/common.sh"
# options to take care
[ -z "$APTGETACTION" -a -z "$PACKAGES" ] &&
eval export APTGETACTION=\${APTGETACTION-${DEFAULT_APTGETACTION}}
[ -n "$APTGETACTION" ] && check_aptgetaction
# option to run apt-zip-list as non-root
APTGETEXTRAOPTS="${APTGETEXTRAOPTS} -o Debug::NoLocking=true"
# Find block size on zip
#BSTMP=$(tempfile -d "$MEDIUM" -p aptzip)
#if [ $? != 0 ]
#then
# error "Could not create temporary file"
#fi
#echo "bs test" > "$BSTMP"
#BLOCKSIZE=$(du -b "$BSTMP" | cut -f1)
#rm "$BSTMP"
#echo >&2 "Block size = $BLOCKSIZE"
TMP=$(tempfile -p aptzip)
TEMP=$(tempfile -p aptzip)
[ -n "$PACKAGES" ] && apt-get ${APTGETEXTRAOPTS} -qq --print-uris install $PACKAGES > "$TMP"
[ -n "$APTGETACTION" ] && apt-get ${APTGETEXTRAOPTS} -qq --print-uris ${APTGETACTION} >> "$TMP"
grep $GREP < "$TMP" | tr -d "'" | sed 's/SHA256://' | sort -u > "$TEMP"
if [ $? != 0 ]
then
error "apt-get failed"
fi
# We will tell the user how much it is to download and in how many packages
# (even on a fast connection there could be restrictions)
DWLSIZE=$(
cut -d' ' -f3 < "$TMP" |
{
_SZ=0
while read val
do
# nblocks=$[ ( $val / $BLOCKSIZE ) + 1 ]
_SZ=$[ $_SZ + $val ]
# _SZ=$[ $_SZ + $nblocks ]
done
echo $_SZ
}
)
[ "$DWLSIZE" -eq "0" ] && DWLSIZE=unknown
export DWLSIZE
PACKCOUNT=`cat "$TMP" | wc -l`
export PACKCOUNT
# Check requested size against free space
#SIZE0=$(echo 'n' | apt-get ${APTGETEXTRAOPTS} dselect-upgrade | grep '^Need to get' | cut -d' ' -f4)
#error "Size0 = $SIZE0 - Size = $SIZE blocks = $[ $SIZE * $BLOCKSIZE ]"
#export the sleep command so it is visible in the method script
export SLEEPTIME
export SLEEPCMD=`eval "$SLEEPEVALCMD"`
export CHECK=`eval "$CHECKEVALCMD"`
export APTGETACTION
# Write the script
SCRIPT="${MEDIUM}"/fetch-script-$METHOD-$(uname -n)
export SCRIPT
if [ "$APTGETACTION" = "update" ]
then
[ "$OPTION_TAR" = "0" ] \
&& echo "Error: the \`tar' option should be set when using" \
"\`--aptgetaction update'" \
&& exit 1
# Remove .bz2 and .gz extension from the `Packages' and
# `Sources' index files
perl -pn -i.bak \
-e 's/Packages\.bz2\s/Packages /;' \
-e 's/Packages\.gz\s/Packages /;' \
-e 's/Sources\.bz2\s/Sources /;' \
-e 's/Sources\.gz\s/Sources /;' \
$TEMP
fi
# --print-uris shows: URI filename size-in-bytes checksum
$FILTER < "$TEMP" >"$SCRIPT"
if [ $? != 0 ]
then
echo >&2 "WARNING: an error occured in the $SCRIPT script"
exit 1
fi
cat > "${MEDIUM}/${APTZIPINSFILE}" <<EOF
# This file was auto-generated by apt-zip-list ${APTZIPVERSION}
# to save the state of apt-zip-list
DEF_APTGETEXTRAOPTS="${APTGETEXTRAOPTS}"
DEF_APTGETACTION="${APTGETACTION}"
DEF_PACKAGES="${PACKAGES}"
EOF
echo "The download size is $DWLSIZE in $PACKCOUNT files."
# vim: nowrap:ts=4:sw=4:et:tw=78
|