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
|
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
file="$1"
db_get apt-setup/services-select
if ! echo "$RET" | grep -q backports; then
exit
fi
if db_get mirror/codename && [ "$RET" ]; then
codename="$RET"
db_get mirror/suite
suite="$RET"
db_get mirror/protocol
protocol="$RET"
db_get mirror/$protocol/hostname
host="$RET"
db_get mirror/$protocol/directory
directory="/${RET#/}"
else
db_get cdrom/codename
codename="$RET"
db_get cdrom/suite
suite="$RET"
fi
# Trust what was set by 50mirror:
components=$(cat /tmp/apt-setup.components)
echo "# ${codename}-backports, previously on backports.debian.org" >> $file
# Don't test mirror if no network selected in netcfg
if [ -n "$protocol" ] && [ -n "$host" ]; then
echo "deb $protocol://${host}${directory} ${codename}-backports $components" >> $file
else
echo "# A network mirror was not selected during install. The following entries" >> $file
echo "# are provided as examples, but you should amend them as appropriate" >> $file
echo "# for your mirror of choice." >> $file
echo "#" >> $file
echo "# deb http://deb.debian.org/debian/ ${codename}-backports $components" >> $file
fi
if db_get netcfg/dhcp_options && \
[ "$RET" = "Do not configure the network at this time" ]; then
CODE=9
else
CODE=0
case $protocol in
http|https)
export ASV_TIMEOUT="-o Acquire::$protocol::Timeout=30"
;;
esac
if ! apt-setup-verify --from $PROGRESS_FROM --to $PROGRESS_TO $file; then
db_subst apt-setup/service-failed HOST "$host"
db_input critical apt-setup/service-failed || true
if ! db_go; then
exit 10 # back up
fi
CODE=9
fi
fi
deb_src="deb-src"
db_get apt-setup/enable-source-repositories
if [ "$RET" = false ]; then
deb_src="# deb-src"
fi
if [ -n "$protocol" ] && [ -n "$host" ]; then
echo "$deb_src $protocol://${host}${directory} ${codename}-backports $components" >> $file
else
echo "# deb-src http://deb.debian.org/debian/ ${codename}-backports $components" >> $file
fi
exit $CODE
|