Temporarily use resolv.conf from dom0 when chrooting into domU, to be able to run apt-get and yum inside chroot. This permits to use different nameservers in domU, and does not break install nor offline update from dom0.
84 lines
1.5 KiB
Bash
Executable File
84 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script sets up the /etc/apt/sources.list for APT.
|
|
#
|
|
# Steve
|
|
# --
|
|
#
|
|
|
|
|
|
|
|
|
|
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 <<E_O_APT > ${prefix}/etc/apt/sources.list
|
|
#
|
|
# /etc/apt/sources.list
|
|
#
|
|
|
|
|
|
#
|
|
# ${dist}
|
|
#
|
|
deb ${mirror} ${dist} main restricted universe multiverse
|
|
deb-src ${mirror} ${dist} main restricted universe
|
|
deb ${mirror} ${dist}-updates main restricted universe multiverse
|
|
deb-src ${mirror} ${dist}-updates main restricted universe
|
|
deb http://security.ubuntu.com/ubuntu ${dist}-security main restricted universe
|
|
deb-src http://security.ubuntu.com/ubuntu ${dist}-security main restricted universe
|
|
|
|
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
|