5 # XXX: what if a package is called install or source...
9 install | download | upgrade | dist-upgrade
)
15 update | autoclean | autoremove | purge
)
21 # let's fail as early as possible:
22 if [ "$mode" = unknown
]; then
23 echo "E: unsupported apt-get operation, mode is still unknown" >&2
24 echo "E: requested operation follows:" "$@" >&2
28 if [ "$mode" = binuris
]; then
29 apt-get.real
"$@" --print-uris|perl
-ne 'if (/^'\''(.+)'\'' ([^_]+)_([^_]+)_/) { my ($url, $package, $version)=($1,$2,$3); $version =~ s/%3a/:/g; print "$package $version $url\n"; }' >> /debootstrap
/$mode
31 elif [ "$mode" = srcuris
]; then
32 # all uris: perl -ne 'if (/^'\''(.+)'\'' (\S+)/) { my ($url, $filename) = ($1, $2); print "$filename $url\n"; }'
33 # only dsc: perl -ne 'if (/^'\''(.+)'\'' (\S+\.dsc)/) { my ($url, $filename) = ($1, $2); print "$filename $url\n"; }'
34 apt-get.real
"$@" --print-uris|perl
-ne 'if (/^'\''(.+)'\'' (\S+\.dsc)/) { my ($url, $filename) = ($1, $2); print "$filename $url\n"; }' >> /debootstrap
/$mode.tmp
36 while read filename uri
; do
37 # extract source and version w/o taking the GnuPG version in the signature section, and add uri after that
38 s_v
=$
(awk '/^(Source|Version):/ {print $2}' "$filename" |
head -2 |
xargs)
39 echo "$s_v $uri" >> /debootstrap
/$mode
40 done < /debootstrap
/$mode.tmp
41 rm /debootstrap
/$mode.tmp
43 # handle both noop and unknown here, each into its own file; unknown should be empty:
44 echo "command:" "$@" >> /debootstrap
/$mode