return 0
}
+# A function to try and autodetect squid-deb-proxy servers on the local network
+# if either the squid-deb-proxy-client package is installed on the host or
+# a parent container set the 50squid-deb-proxy-client file.
+squid_deb_proxy_autodetect()
+{
+ local apt_discover=/usr/share/squid-deb-proxy-client/apt-avahi-discover
+ local proxy_file=/etc/apt/apt.conf.d/50squid-deb-proxy-client
+ squid_proxy_line= # That's a global :/
+
+ # Maybe the host is aware of a squid-deb-proxy?
+ if [ -f $apt_discover ]; then
+ echo -n "Discovering squid-deb-proxy..."
+ squid_proxy_line=$($apt_discover)
+ if [ -n "$squid_proxy_line" ]; then
+ echo "found squid-deb-proxy: $squid_proxy_line"
+ else
+ echo "no squid-deb-proxy found"
+ fi
+ fi
+
+ # Are we in a nested container, and the parent already knows of a proxy?
+ if [ -f $proxy_file ]; then
+ # Extract the squid URL from the file (whatever is between "")
+ squid_proxy_line=`cat $proxy_file | sed "s/.*\"\(.*\)\".*/\1/"`
+ fi
+}
+
#
# Choose proxies for container
# http_proxy will be used by debootstrap on the host.
fi
case "$HTTP_PROXY" in
none)
- APT_PROXY=
+ squid_deb_proxy_autodetect
+ if [ -n "$squid_proxy_line" ]; then
+ APT_PROXY=$squid_proxy_line
+ export http_proxy=$squid_proxy_line
+ else
+ APT_PROXY=
+ fi
;;
apt)
RES=`apt-config shell APT_PROXY Acquire::http::Proxy`
suggest_flush()
{
echo "Container upgrade failed. The container cache may be out of date,"
- echo "in which case flushing the case (see -F in the hep output) may help."
+ echo "in which case flushing the cache (see -F in the help output) may help."
}
download_ubuntu()
mkdir -p $LOCALSTATEDIR/lock/subsys/
(
- flock -x 200
+ flock -x 9
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
return 0
- ) 200>$LOCALSTATEDIR/lock/subsys/lxc-ubuntu$release
+ ) 9>$LOCALSTATEDIR/lock/subsys/lxc-ubuntu$release
return $?
}
cat /etc/timezone > $rootfs/etc/timezone
chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
elif [ -f /etc/sysconfig/clock ]; then
- source /etc/sysconfig/clock
+ . /etc/sysconfig/clock
echo $ZONE > $rootfs/etc/timezone
chroot $rootfs dpkg-reconfigure -f noninteractive tzdata
else
fi
-if [ "$arch" == "i686" ]; then
+if [ "$arch" = "i686" ]; then
arch=i386
fi