]> git.proxmox.com Git - mirror_lxc.git/commitdiff
improve lxc-debian template to specify the suite
authorDaniel Lezcano <daniel.lezcano@free.fr>
Fri, 1 Oct 2010 15:07:03 +0000 (17:07 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 1 Oct 2010 15:07:03 +0000 (17:07 +0200)
The attached patch adds a variable at the top of lxc-debian to change the SUITE.
Currently tested suites are lenny, squeeze, sid.

Also, the patch uses the dhcp3-client package instead of dhcp-client which is
deprecated in lenny and removed in squeeze.

Patch initialy from Mathieu Parent.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
templates/lxc-debian.in

index a33f5f8134d38b7f6a40097313fe001741b0407f..a0cde81bf8651f0fa415424696d299bf88c1a457 100644 (file)
@@ -20,6 +20,8 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
+SUITE=${SUITE:-lenny}
+
 configure_debian()
 {
     rootfs=$1
@@ -90,7 +92,7 @@ ifupdown,\
 locales,\
 libui-dialog-perl,\
 dialog,\
-dhcp-client,\
+dhcp3-client,\
 netbase,\
 net-tools,\
 iproute,\
@@ -100,9 +102,9 @@ openssh-server
     arch=$2
 
     # check the mini debian was not already downloaded
-    mkdir -p "$cache/partial-$arch"
+    mkdir -p "$cache/partial-$SUITE-$arch"
     if [ $? -ne 0 ]; then
-       echo "Failed to create '$cache/partial-$arch' directory"
+       echo "Failed to create '$cache/partial-$SUITE-$arch' directory"
        return 1
     fi
 
@@ -110,13 +112,13 @@ openssh-server
     echo "Downloading debian minimal ..."
     debootstrap --verbose --variant=minbase --arch=$arch \
        --include $packages \
-       lenny $cache/partial-$arch http://ftp.debian.org/debian
+       "$SUITE" "$cache/partial-$SUITE-$arch" http://ftp.debian.org/debian
     if [ $? -ne 0 ]; then
        echo "Failed to download the rootfs, aborting."
        return 1
     fi
 
-    mv "$1/partial-$arch" "$1/rootfs-$arch"
+    mv "$1/partial-$SUITE-$arch" "$1/rootfs-$SUITE-$arch"
     echo "Download complete."
 
     return 0
@@ -130,7 +132,7 @@ copy_debian()
 
     # make a local copy of the minidebian
     echo -n "Copying rootfs to $rootfs..."
-    cp -a $cache/rootfs-$arch $rootfs || return 1
+    cp -a "$cache/rootfs-$SUITE-$arch" $rootfs || return 1
     return 0
 }
 
@@ -155,8 +157,8 @@ install_debian()
            arch=i386
        fi
 
-       echo "Checking cache download in $cache/rootfs-$arch ... "
-       if [ ! -e "$cache/rootfs-$arch" ]; then
+       echo "Checking cache download in $cache/rootfs-$SUITE-$arch ... "
+       if [ ! -e "$cache/rootfs-$SUITE-$arch" ]; then
            download_debian $cache $arch
            if [ $? -ne 0 ]; then
                echo "Failed to download 'debian base'"