diff --git a/hooks/debian/20-setup-apt b/hooks/debian/20-setup-apt index 2624217..d887cc5 100755 --- a/hooks/debian/20-setup-apt +++ b/hooks/debian/20-setup-apt @@ -26,6 +26,31 @@ fi logMessage Script $0 starting + +# +# Attempt to auto-magically detect the use of a Proxy for apt-get, and +# replicate that setup in our new guest. +# +# +# Process any of the present apt-conf setup lines. +# +for i in /etc/apt/apt.conf /etc/apt/apt.conf.d/* ; do + + # + # If the file exists. (Need this in case the literal glob fails.) + # + if [ -e $i ] ; then + + # + # Save the matching line(s) to the proxy guess file. + # + logMessage The use of a proxy detected. + grep -i HTTP::Proxy $i >> ${prefix}/etc/apt/apt.conf.d/proxy-guess + fi +done + + + # # Setup the sources.list file for new installations of Debian GNU/Linux. # diff --git a/hooks/ubuntu/20-setup-apt b/hooks/ubuntu/20-setup-apt index c1b51cc..2b0ae70 100755 --- a/hooks/ubuntu/20-setup-apt +++ b/hooks/ubuntu/20-setup-apt @@ -4,11 +4,56 @@ # # Steve # -- -# $Id: 20-setup-apt,v 1.1 2006-06-18 17:44:08 steve Exp $ +# $Id: 20-setup-apt,v 1.2 2006-08-03 15:12:26 steve Exp $ + + prefix=$1 + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + + + +# +# Attempt to auto-magically detect the use of a Proxy for apt-get, and +# replicate that setup in our new guest. +# +# +# Process any of the present apt-conf setup lines. +# +for i in /etc/apt/apt.conf /etc/apt/apt.conf.d/* ; do + + # + # If the file exists. (Need this in case the literal glob fails.) + # + if [ -e $i ] ; then + + # + # Save the matching line(s) to the proxy guess file. + # + logMessage The use of a proxy detected. + grep -i HTTP::Proxy $i >> ${prefix}/etc/apt/apt.conf.d/proxy-guess + fi +done + + + cat < ${prefix}/etc/apt/sources.list # # /etc/apt/sources.list @@ -33,3 +78,8 @@ E_O_APT # Now that the sources have been setup make sure the system is up to date. # chroot ${prefix} /usr/bin/apt-get update + +# +# Log our finish +# +logMessage Script $0 finished