#
-# Copyright (C) 2007, 2008, 2009 Google Inc.
+# Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
format_disk0() {
# Create one big partition, and make it bootable
- # some versions of sfdisk need manual specification of
- # head/sectors for devices such as drbd which don't
+ # some versions of sfdisk need manual specification of
+ # head/sectors for devices such as drbd which don't
# report geometry
- sfdisk -H 255 -S 63 --quiet --Linux "$1" <<EOF
-0,,L,*
+ sfdisk -H 64 -S 32 -u S --quiet --Linux "$1" <<EOF
+${PARTITION_ALIGNMENT},,L,*
EOF
}
# will use it, this declaration is to make sure the variable is set
: ${MIRROR:=""}
: ${PROXY:=""}
-: ${SUITE:="lenny"}
+: ${SUITE:="wheezy"}
: ${ARCH:=""}
: ${EXTRA_PKGS:=""}
-: ${CUSTOMIZE_DIR:="@sysconfdir@/ganeti/instance-debootstrap.d"}
+: ${COMPONENTS:=""}
+: ${CUSTOMIZE_DIR:="@sysconfdir@/ganeti/instance-debootstrap/hooks"}
: ${VARIANTS_DIR:="@sysconfdir@/ganeti/instance-debootstrap/variants"}
: ${GENERATE_CACHE:="yes"}
: ${CLEAN_CACHE:="14"} # number of days to keep a cache file
+: ${PARTITION_ALIGNMENT:=2048} # sectors to align partition (1Mib default)
if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then
DEFAULT_PARTITION_STYLE="none"
else
DEFAULT_PARTITION_STYLE="msdos"
fi
: ${PARTITION_STYLE:=$DEFAULT_PARTITION_STYLE} # disk partition style
+: ${OSP_FILESYSTEM:="ext4"}
CACHE_DIR="@localstatedir@/cache/ganeti-instance-debootstrap"
SCRIPT_NAME=$(basename $0)
-for dir in /lib/udev /sbin; do
- if [ -f $dir/vol_id -a -x $dir/vol_id ]; then
- VOL_ID=$dir/vol_id
- fi
-done
+if [ -f /sbin/blkid -a -x /sbin/blkid ]; then
+ VOL_ID="/sbin/blkid -o value -s UUID"
+ VOL_TYPE="/sbin/blkid -o value -s TYPE"
+else
+ for dir in /lib/udev /sbin; do
+ if [ -f $dir/vol_id -a -x $dir/vol_id ]; then
+ VOL_ID="$dir/vol_id -u"
+ VOL_TYPE="$dir/vol_id -t"
+ fi
+ done
+fi
if [ -z "$VOL_ID" ]; then
- log_error "vol_id not found, please install udev"
- exit 1
+ log_error "vol_id or blkid not found, please install udev or util-linux"
+ exit 1
fi
if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then
GETOPT_RESULT=`getopt -o o:n:i:b:s: -n '$0' -- "$@"`
if [ $? != 0 ] ; then log_error "Terminating..."; exit 1 ; fi
get_api5_arguments $GETOPT_RESULT
-elif [ "$OS_API_VERSION" = "10" -o "$OS_API_VERSION" = "15" ]; then
+elif [ "$OS_API_VERSION" = "10" -o "$OS_API_VERSION" = "15" -o \
+ "$OS_API_VERSION" = "20" ]; then
get_api10_arguments
else
log_error "Unknown OS API VERSION $OS_API_VERSION"
exit 1
fi
fi
-