On Wed, Mar 3, 2010 at 10:07 AM, Iustin Pop <[email protected]> wrote: > The examples were not shipped at all, which makes it hard to package > them. > > This patch renames the directory holding them (example → examples), adds > the executable bit on the interfaces hook, and distributes them in the > dist archive. > --- > Makefile.am | 4 ++- > example/hooks/grub | 59 > --------------------------------------------- > example/hooks/interfaces | 53 ---------------------------------------- > examples/hooks/grub | 59 > +++++++++++++++++++++++++++++++++++++++++++++ > examples/hooks/interfaces | 53 ++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 115 insertions(+), 113 deletions(-) > delete mode 100755 example/hooks/grub > delete mode 100644 example/hooks/interfaces > create mode 100755 examples/hooks/grub > create mode 100755 examples/hooks/interfaces > > diff --git a/Makefile.am b/Makefile.am > index 868d1a6..744de08 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -9,7 +9,9 @@ os_DATA = common.sh > > dist_doc_DATA = COPYING NEWS README > > -EXTRA_DIST = common.sh.in defaults > +EXTRA_DIST = common.sh.in defaults \ > + examples/hooks/grub \ > + examples/hooks/interfaces > > do_subst = sed \ > -e 's,[...@]sysconfdir[@],$(sysconfdir),g' \ > diff --git a/example/hooks/grub b/example/hooks/grub > deleted file mode 100755 > index c93dcf5..0000000 > --- a/example/hooks/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/hooks/interfaces b/example/hooks/interfaces > deleted file mode 100644 > index 455c396..0000000 > --- a/example/hooks/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 > diff --git a/examples/hooks/grub b/examples/hooks/grub > new file mode 100755 > index 0000000..c93dcf5 > --- /dev/null > +++ b/examples/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/examples/hooks/interfaces b/examples/hooks/interfaces > new file mode 100755 > index 0000000..455c396 > --- /dev/null > +++ b/examples/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 > -- > 1.6.6.2 > >
LGTM
