The current customization directory is
“$sysconfdir/ganeti/instance-debootstrap.d”. Recently, the variants
support has added the variants configuration as
“$sysconfdir/ganeti/instance-debootstrap/variants/default.conf”. This
means we have two, very similar (instance-debootstrap.d vs.
instance-debootstrap) directories under ganeti.
This patch changes the customize directory to
$sysconfdir/ganeti/instance-debootstrap/hooks. It is more in line with
Ganeti's own hooks naming, and removes the old “.d” directory, for a
more sane layout.
People upgrading, with the default (commented-out) CUSTOMIZE_DIR will
need to rename their on-disk directory.
---
README | 29 +++++++++-----
common.sh.in | 2 +-
defaults | 4 +-
example/hooks/grub | 59 +++++++++++++++++++++++++++++
example/hooks/interfaces | 53 ++++++++++++++++++++++++++
example/instance-debootstrap.d/grub | 59 -----------------------------
example/instance-debootstrap.d/interfaces | 53 --------------------------
7 files changed, 133 insertions(+), 126 deletions(-)
create mode 100755 example/hooks/grub
create mode 100644 example/hooks/interfaces
delete mode 100755 example/instance-debootstrap.d/grub
delete mode 100644 example/instance-debootstrap.d/interfaces
diff --git a/README b/README
index 6c656ab..893804f 100644
--- a/README
+++ b/README
@@ -58,9 +58,9 @@ named 'defaults' in the source distribution for more details):
- EXTRAPKGS: most OSes will need some extra packages installed to make
them work nicely under Xen; the example file containts a few
suggestions
-- CUSTOMIZE_DIR: a directory containing customization script for the instance.
- (by default $sysconfdir/ganeti/instance-debootstrap.d) See "Customization of
- the instance" below.
+- CUSTOMIZE_DIR: a directory containing customization script for the
+ instance. (by default $sysconfdir/ganeti/instance-debootstrap/hooks)
+ See "Customization of the instance" below.
- GENERATE_CACHE: if 'yes' (the default), the installation process will
save and reuse a cache file to speed reinstalls (located under
$localstatedir/cache/ganeti-instance-debootstrap)
@@ -82,14 +82,15 @@ limiting.
Customization of the instance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If run-parts is in the os create script, and the CUSTOMIZE_DIR (by default
-$sysconfdir/ganeti/instance-debootstrap.d, /etc/ganeti/instance-debootstrap.d
-if you configured the os with --sysconfdir=/etc) directory exists any
-executable whose name matches the run-parts execution rules (quoting
-run-parts(8): the names must consist entirely of upper and lower case
-letters, digits, underscores, and hyphens) is executed to allow further
-personalization of the installation. The following environment variables are
-passed, in addition to the ones ganeti passes to the OS scripts:
+If run-parts is in the os create script, and the CUSTOMIZE_DIR (by
+default $sysconfdir/ganeti/instance-debootstrap/hooks,
+/etc/ganeti/instance-debootstrap/hooks if you configured the os with
+--sysconfdir=/etc) directory exists any executable whose name matches
+the run-parts execution rules (quoting run-parts(8): the names must
+consist entirely of upper and lower case letters, digits, underscores,
+and hyphens) is executed to allow further personalization of the
+installation. The following environment variables are passed, in
+addition to the ones ganeti passes to the OS scripts:
TARGET: directory in which the filesystem is mounted
SUITE: suite installed by debootstrap (eg: lenny)
@@ -137,3 +138,9 @@ The instance is a minimal install:
definitions to /etc/network/interfaces
- after configuring the network, it is recommended to run ``apt-get
update`` so that signatures for the release files are picked up
+
+.. vim: set textwidth=72 :
+.. Local Variables:
+.. mode: rst
+.. fill-column: 72
+.. End:
diff --git a/common.sh.in b/common.sh.in
index 6c6c3b9..a72fc9f 100644
--- a/common.sh.in
+++ b/common.sh.in
@@ -145,7 +145,7 @@ fi
: ${SUITE:="lenny"}
: ${ARCH:=""}
: ${EXTRA_PKGS:=""}
-: ${CUSTOMIZE_DIR:="@sysconfdir@/ganeti/instance-debootstrap.d"}
+: ${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
diff --git a/defaults b/defaults
index 467e46e..72d41ac 100644
--- a/defaults
+++ b/defaults
@@ -39,8 +39,8 @@
# CUSTOMIZE_DIR: a directory containing scripts to customize the installation.
# The scripts are executed using run-parts
-# By default /etc/ganeti/instance-debootstrap.d
-# CUSTOMIZE_DIR="/etc/ganeti/instance-debootstrap.d"
+# By default /etc/ganeti/instance-debootstrap/hooks
+# CUSTOMIZE_DIR="/etc/ganeti/instance-debootstrap/hooks"
# GENERATE_CACHE: if set to yes (the default), create new cache files;
# any other value will disable the generation of cache files (but they
diff --git a/example/hooks/grub b/example/hooks/grub
new file mode 100755
index 0000000..c93dcf5
--- /dev/null
+++ b/example/hooks/grub
@@ -0,0 +1,59 @@
+#!/bin/bash
+#
+# This is an example script that install and configure grub after installation.
+# To use it put it in your CUSTOMIZE_DIR, make it executable, and edit
EXTRAPKGS
+# of your $sysconfdir/default/ganeti-instance-debootstrap.
+#
+# Xen, for etch/lenny i386:
+# EXTRA_PKGS="linux-image-xen-686,libc6-xen"
+# Xen, for etch/lenny amd64:
+# EXTRA_PKGS="linux-image-xen-amd64"
+# KVM:
+# no extra packages needed besides the normal suggested ones
+#
+# Do not include grub in EXTRA_PKGS because it will cause error of debootstrap.
+
+set -e
+
+. common.sh
+
+CLEANUP=( )
+
+trap cleanup EXIT
+
+if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
+ echo "Missing target directory"
+ exit 1
+fi
+
+# install grub
+LANG=C
+chroot "$TARGET" apt-get -y --force-yes install grub grub-common
+
+# make /dev/sda
+mknod $TARGET/dev/sda b $(stat -L -c "0x%t 0x%T" $BLOCKDEV)
+CLEANUP+=("rm -f $TARGET/dev/sda")
+
+# make /dev/sda1
+mknod $TARGET/dev/sda1 b $(stat -L -c "0x%t 0x%T" $FSYSDEV)
+CLEANUP+=("rm -f $TARGET/dev/sda1")
+
+# create grub directory
+mkdir -p "$TARGET/boot/grub"
+
+# create device.map
+cat > "$TARGET/boot/grub/device.map" <<EOF
+(hd0) /dev/sda
+EOF
+
+# execute update-grub
+chroot "$TARGET" update-grub
+
+# install grub to the block device
+grub-install --no-floppy --root-directory="$TARGET" "$BLOCKDEV"
+
+# execute cleanups
+cleanup
+trap - EXIT
+
+exit 0
diff --git a/example/hooks/interfaces b/example/hooks/interfaces
new file mode 100644
index 0000000..455c396
--- /dev/null
+++ b/example/hooks/interfaces
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+# Copyright (C) 2009 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# This is an example script that configures you /etc/network/interfaces after
+# installation. By default its sets up the system to use dhcp. To use it just
+# put it in your CUSTOMIZE_DIR and make it executable.
+
+if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
+ echo "Missing target directory"
+ exit 1
+fi
+
+if [ ! -d "$TARGET/etc/network" ]; then
+ echo "Missing target network directory"
+ exit 1
+fi
+
+if [ -z "$NIC_COUNT" ]; then
+ echo "Missing NIC COUNT"
+ exit 1
+fi
+
+if [ "$NIC_COUNT" -gt 0 ]; then
+
+ cat > $TARGET/etc/network/interfaces <<EOF
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet dhcp
+
+EOF
+
+fi
diff --git a/example/instance-debootstrap.d/grub
b/example/instance-debootstrap.d/grub
deleted file mode 100755
index c93dcf5..0000000
--- a/example/instance-debootstrap.d/grub
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-#
-# This is an example script that install and configure grub after installation.
-# To use it put it in your CUSTOMIZE_DIR, make it executable, and edit
EXTRAPKGS
-# of your $sysconfdir/default/ganeti-instance-debootstrap.
-#
-# Xen, for etch/lenny i386:
-# EXTRA_PKGS="linux-image-xen-686,libc6-xen"
-# Xen, for etch/lenny amd64:
-# EXTRA_PKGS="linux-image-xen-amd64"
-# KVM:
-# no extra packages needed besides the normal suggested ones
-#
-# Do not include grub in EXTRA_PKGS because it will cause error of debootstrap.
-
-set -e
-
-. common.sh
-
-CLEANUP=( )
-
-trap cleanup EXIT
-
-if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
- echo "Missing target directory"
- exit 1
-fi
-
-# install grub
-LANG=C
-chroot "$TARGET" apt-get -y --force-yes install grub grub-common
-
-# make /dev/sda
-mknod $TARGET/dev/sda b $(stat -L -c "0x%t 0x%T" $BLOCKDEV)
-CLEANUP+=("rm -f $TARGET/dev/sda")
-
-# make /dev/sda1
-mknod $TARGET/dev/sda1 b $(stat -L -c "0x%t 0x%T" $FSYSDEV)
-CLEANUP+=("rm -f $TARGET/dev/sda1")
-
-# create grub directory
-mkdir -p "$TARGET/boot/grub"
-
-# create device.map
-cat > "$TARGET/boot/grub/device.map" <<EOF
-(hd0) /dev/sda
-EOF
-
-# execute update-grub
-chroot "$TARGET" update-grub
-
-# install grub to the block device
-grub-install --no-floppy --root-directory="$TARGET" "$BLOCKDEV"
-
-# execute cleanups
-cleanup
-trap - EXIT
-
-exit 0
diff --git a/example/instance-debootstrap.d/interfaces
b/example/instance-debootstrap.d/interfaces
deleted file mode 100644
index 455c396..0000000
--- a/example/instance-debootstrap.d/interfaces
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2009 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
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# This is an example script that configures you /etc/network/interfaces after
-# installation. By default its sets up the system to use dhcp. To use it just
-# put it in your CUSTOMIZE_DIR and make it executable.
-
-if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
- echo "Missing target directory"
- exit 1
-fi
-
-if [ ! -d "$TARGET/etc/network" ]; then
- echo "Missing target network directory"
- exit 1
-fi
-
-if [ -z "$NIC_COUNT" ]; then
- echo "Missing NIC COUNT"
- exit 1
-fi
-
-if [ "$NIC_COUNT" -gt 0 ]; then
-
- cat > $TARGET/etc/network/interfaces <<EOF
-# This file describes the network interfaces available on your system
-# and how to activate them. For more information, see interfaces(5).
-
-auto lo
-iface lo inet loopback
-
-auto eth0
-iface eth0 inet dhcp
-
-EOF
-
-fi
--
1.6.6.2