Revision 775f4f72
b/Makefile.am | ||
---|---|---|
8 | 8 |
dist_os_DATA = ganeti_api_version variants.list |
9 | 9 |
os_DATA = common.sh |
10 | 10 |
|
11 |
dist_custom_DATA = example/instance-debootstrap.d/*
|
|
11 |
dist_custom_DATA = example/instance-image.d/*
|
|
12 | 12 |
|
13 | 13 |
dist_doc_DATA = COPYING NEWS README |
14 | 14 |
|
/dev/null | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
# This is an example script that configures, grub after installation. This |
|
3 |
# script assumes that grub has been installed onto the image already and a |
|
4 |
# working grub.conf exists. To use, make it executable and edit your settings |
|
5 |
# to the following: |
|
6 |
# |
|
7 |
# GRUB_SETUP="yes" |
|
8 |
|
|
9 |
set -e |
|
10 |
|
|
11 |
. common.sh |
|
12 |
|
|
13 |
CLEANUP=( ) |
|
14 |
|
|
15 |
trap cleanup EXIT |
|
16 |
|
|
17 |
if [ -z "${TARGET}" -o -d "${TARGET}" ] ; then |
|
18 |
echo "Missing target directory" |
|
19 |
exit 1 |
|
20 |
fi |
|
21 |
|
|
22 |
# Set disk based on type of hypervisor |
|
23 |
disk="" |
|
24 |
if [ "${HYPERVISOR}" = "kvm" ] ; then |
|
25 |
disk="vda" |
|
26 |
else |
|
27 |
disk="xda" |
|
28 |
fi |
|
29 |
|
|
30 |
# make /dev/$disk |
|
31 |
mknod ${TARGET}/dev/${disk} b $(stat -L -c "0x%t 0x%T" $BLOCKDEV) |
|
32 |
CLEANUP+=("rm -f ${TARGET}/dev/$disk") |
|
33 |
|
|
34 |
# make /dev/${disk}1 |
|
35 |
mknod ${TARGET}/dev/${disk}1 b $(stat -L -c "0x%t 0x%T" $BOOT_DEV) |
|
36 |
CLEANUP+=("rm -f ${TARGET}/dev/${disk}1") |
|
37 |
|
|
38 |
# make /dev/${disk}1 |
|
39 |
mknod ${TARGET}/dev/${disk}3 b $(stat -L -c "0x%t 0x%T" $ROOT_DEV) |
|
40 |
CLEANUP+=("rm -f ${TARGET}/dev/${disk}3") |
|
41 |
|
|
42 |
# create device.map |
|
43 |
cat > "${TARGET}/boot/grub/device.map" <<EOF |
|
44 |
(hd0) /dev/${disk} |
|
45 |
EOF |
|
46 |
|
|
47 |
# install grub to the block device |
|
48 |
chroot ${TARGET} grub --batch --no-floppy --device-map=/boot/grub/device.map <<EOF |
|
49 |
root (hd0,0) |
|
50 |
setup (hd0) |
|
51 |
quit |
|
52 |
EOF |
|
53 |
|
|
54 |
# execute cleanups |
|
55 |
cleanup |
|
56 |
trap - EXIT |
|
57 |
|
|
58 |
exit 0 |
/dev/null | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
# Copyright (C) 2009 Google Inc. |
|
4 |
# |
|
5 |
# This program is free software; you can redistribute it and/or modify |
|
6 |
# it under the terms of the GNU General Public License as published by |
|
7 |
# the Free Software Foundation; either version 2 of the License, or |
|
8 |
# (at your option) any later version. |
|
9 |
# |
|
10 |
# This program is distributed in the hope that it will be useful, but |
|
11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
# General Public License for more details. |
|
14 |
# |
|
15 |
# You should have received a copy of the GNU General Public License |
|
16 |
# along with this program; if not, write to the Free Software |
|
17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 |
# 02110-1301, USA. |
|
19 |
|
|
20 |
# This is an example script that configures you /etc/network/interfaces after |
|
21 |
# installation. By default its sets up the system to use dhcp. To use it just |
|
22 |
# put it in your CUSTOMIZE_DIR and make it executable. |
|
23 |
|
|
24 |
if [ -z "$TARGET" -o ! -d "$TARGET" ]; then |
|
25 |
echo "Missing target directory" |
|
26 |
exit 1 |
|
27 |
fi |
|
28 |
|
|
29 |
if [ ! -d "$TARGET/etc/network" ]; then |
|
30 |
echo "Missing target network directory" |
|
31 |
exit 1 |
|
32 |
fi |
|
33 |
|
|
34 |
if [ -z "$NIC_COUNT" ]; then |
|
35 |
echo "Missing NIC COUNT" |
|
36 |
exit 1 |
|
37 |
fi |
|
38 |
|
|
39 |
if [ "$NIC_COUNT" -gt 0 ]; then |
|
40 |
|
|
41 |
cat > $TARGET/etc/network/interfaces <<EOF |
|
42 |
# This file describes the network interfaces available on your system |
|
43 |
# and how to activate them. For more information, see interfaces(5). |
|
44 |
|
|
45 |
auto lo |
|
46 |
iface lo inet loopback |
|
47 |
|
|
48 |
auto eth0 |
|
49 |
iface eth0 inet dhcp |
|
50 |
|
|
51 |
EOF |
|
52 |
|
|
53 |
fi |
b/example/instance-image.d/grub | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
# This is an example script that configures, grub after installation. This |
|
3 |
# script assumes that grub has been installed onto the image already and a |
|
4 |
# working grub.conf exists. To use, make it executable and edit your settings |
|
5 |
# to the following: |
|
6 |
# |
|
7 |
# GRUB_SETUP="yes" |
|
8 |
|
|
9 |
set -e |
|
10 |
|
|
11 |
. common.sh |
|
12 |
|
|
13 |
CLEANUP=( ) |
|
14 |
|
|
15 |
trap cleanup EXIT |
|
16 |
|
|
17 |
if [ -z "${TARGET}" -o -d "${TARGET}" ] ; then |
|
18 |
echo "Missing target directory" |
|
19 |
exit 1 |
|
20 |
fi |
|
21 |
|
|
22 |
# Set disk based on type of hypervisor |
|
23 |
disk="" |
|
24 |
if [ "${HYPERVISOR}" = "kvm" ] ; then |
|
25 |
disk="vda" |
|
26 |
else |
|
27 |
disk="xda" |
|
28 |
fi |
|
29 |
|
|
30 |
# make /dev/$disk |
|
31 |
mknod ${TARGET}/dev/${disk} b $(stat -L -c "0x%t 0x%T" $BLOCKDEV) |
|
32 |
CLEANUP+=("rm -f ${TARGET}/dev/$disk") |
|
33 |
|
|
34 |
# make /dev/${disk}1 |
|
35 |
mknod ${TARGET}/dev/${disk}1 b $(stat -L -c "0x%t 0x%T" $BOOT_DEV) |
|
36 |
CLEANUP+=("rm -f ${TARGET}/dev/${disk}1") |
|
37 |
|
|
38 |
# make /dev/${disk}1 |
|
39 |
mknod ${TARGET}/dev/${disk}3 b $(stat -L -c "0x%t 0x%T" $ROOT_DEV) |
|
40 |
CLEANUP+=("rm -f ${TARGET}/dev/${disk}3") |
|
41 |
|
|
42 |
# create device.map |
|
43 |
cat > "${TARGET}/boot/grub/device.map" <<EOF |
|
44 |
(hd0) /dev/${disk} |
|
45 |
EOF |
|
46 |
|
|
47 |
# install grub to the block device |
|
48 |
chroot ${TARGET} grub --batch --no-floppy --device-map=/boot/grub/device.map <<EOF |
|
49 |
root (hd0,0) |
|
50 |
setup (hd0) |
|
51 |
quit |
|
52 |
EOF |
|
53 |
|
|
54 |
# execute cleanups |
|
55 |
cleanup |
|
56 |
trap - EXIT |
|
57 |
|
|
58 |
exit 0 |
b/example/instance-image.d/interfaces | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
# Copyright (C) 2009 Google Inc. |
|
4 |
# |
|
5 |
# This program is free software; you can redistribute it and/or modify |
|
6 |
# it under the terms of the GNU General Public License as published by |
|
7 |
# the Free Software Foundation; either version 2 of the License, or |
|
8 |
# (at your option) any later version. |
|
9 |
# |
|
10 |
# This program is distributed in the hope that it will be useful, but |
|
11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
# General Public License for more details. |
|
14 |
# |
|
15 |
# You should have received a copy of the GNU General Public License |
|
16 |
# along with this program; if not, write to the Free Software |
|
17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 |
# 02110-1301, USA. |
|
19 |
|
|
20 |
# This is an example script that configures you /etc/network/interfaces after |
|
21 |
# installation. By default its sets up the system to use dhcp. To use it just |
|
22 |
# put it in your CUSTOMIZE_DIR and make it executable. |
|
23 |
|
|
24 |
if [ -z "$TARGET" -o ! -d "$TARGET" ]; then |
|
25 |
echo "Missing target directory" |
|
26 |
exit 1 |
|
27 |
fi |
|
28 |
|
|
29 |
if [ ! -d "$TARGET/etc/network" ]; then |
|
30 |
echo "Missing target network directory" |
|
31 |
exit 1 |
|
32 |
fi |
|
33 |
|
|
34 |
if [ -z "$NIC_COUNT" ]; then |
|
35 |
echo "Missing NIC COUNT" |
|
36 |
exit 1 |
|
37 |
fi |
|
38 |
|
|
39 |
if [ "$NIC_COUNT" -gt 0 ]; then |
|
40 |
|
|
41 |
cat > $TARGET/etc/network/interfaces <<EOF |
|
42 |
# This file describes the network interfaces available on your system |
|
43 |
# and how to activate them. For more information, see interfaces(5). |
|
44 |
|
|
45 |
auto lo |
|
46 |
iface lo inet loopback |
|
47 |
|
|
48 |
auto eth0 |
|
49 |
iface eth0 inet dhcp |
|
50 |
|
|
51 |
EOF |
|
52 |
|
|
53 |
fi |
Also available in: Unified diff