Add an example about how to run hooks
[ext/instance-debootstrap.git] / common.sh.in
index 6c6c3b9..a35eadd 100644 (file)
@@ -1,6 +1,6 @@
 #
 
-# 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
@@ -88,11 +88,11 @@ get_api10_arguments() {
 
 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
 }
 
@@ -142,19 +142,22 @@ fi
 # 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"
 
@@ -182,7 +185,8 @@ 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"
@@ -211,4 +215,3 @@ if [ -n "$OS_VARIANT" ]; then
     exit 1
   fi
 fi
-