fcdistro=$1; shift
case $fcdistro in
f[0-9]*|centos[0-9]*|sl[0-9]*) echo yum ;;
- lenny|squeeze|wheezy|jessie) echo debootstrap ;;
+ squeeze|wheezy|oneiric|precise|quantal) echo debootstrap ;;
*) echo Unknown distro $fcdistro ;;
esac
}
+# need to specify the right mirror for debian variants like ubuntu and the like
+function debian_mirror () {
+ fcdistro=$1; shift
+ case $fcdistro in
+ squeeze|wheezy)
+ echo http://ftp2.fr.debian.org/debian/ ;;
+ oneiric|precise|quantal)
+ echo http://mir1.ovh.net/ubuntu/ubuntu/ ;;
+ *) echo unknown distro $fcdistro; exit 1;;
+ esac
+}
+
+
+
# return arch from debian distro and personality
function canonical_arch () {
personality=$1; shift
;;
debootstrap)
arch=$(canonical_arch $personality $fcdistro)
- build_options="-m debootstrap -- -d $fcdistro -- --arch $arch"
+ debmirror=$(debian_mirror $fcdistro)
+ build_options="-m debootstrap -- -d $fcdistro -m $debmirror -- --arch $arch"
;;
*)
- build_options="something wrong" ;;
+ build_options="undefined-package_method" ;;
esac
# create it
pkg_method=$(package_method $fcdistro)
- # check for .pkgs file based on pldistro
- if [ -n "$VBUILD_MODE" ] ; then
- pkgsname=devel.pkgs
- else
- pkgsname=vtest.pkgs
- fi
- pkgsfile=$(pl_locateDistroFile $DIRNAME $pldistro $pkgsname)
+ pkgsfile=$(pl_locateDistroFile $DIRNAME $pldistro $PREINSTALLED)
### install individual packages, then groups
# get target arch - use uname -i here (we want either x86_64 or i386)
;;
debootstrap)
$personality vserver $vserver exec apt-get update
+ # handle this one firt off to be sure
+ $personality vserver $vserver exec apt-get install -y locales
+ # all in a single batch
+ [ -n "$packages" ] $personality vserver $vserver exec apt-get install -y --ignore-missing $packages || :
+ # of course, on ubuntu apt-get --ignore-missing .. does not ignore missing packages !
+ # check it up a bit
for package in $packages ; do
- $personality vserver $vserver exec apt-get install -y $package || \
- { echo "WARNING - missing package on debian $package - ignored" ; true; }
+ if ! $personality vserver $vserver exec dpkg -l $package >& /dev/null ; then
+ # try to install it individually - so this is for ubuntu
+ $personality vserver $vserver exec apt-get install -y $package || :
+ # still not there ?
+ if ! $personality vserver $vserver exec dpkg -l $package >& /dev/null ; then
+ echo "WARNING - missing package on debian $package - ignored"
+ fi
+ fi
done
### xxx todo install groups with apt..
;;
RESISTANT=""
IFNAME=""
VSERVER_OPTIONS=""
- while getopts "f:d:p:i:rv" opt ; do
+
+ # the set of preinstalled packages - depends on vbuild or vtest
+ if [ -n "$VBUILD_MODE" ] ; then
+ PREINSTALLED=devel.pkgs
+ else
+ PREINSTALLED=vtest.pkgs
+ fi
+ while getopts "f:d:p:P:i:rv" opt ; do
case $opt in
f) fcdistro=$OPTARG;;
d) pldistro=$OPTARG;;
p) personality=$OPTARG;;
+ P) PREINSTALLED=$OPTARG;;
i) IFNAME=$OPTARG;;
r) RESISTANT="true";;
v) VERBOSE="-v" ;;