summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorbencoh <bencoh@19625182-23af-4830-9084-f181c60b83b7>2010-07-15 11:11:17 +0000
committerbencoh <bencoh@19625182-23af-4830-9084-f181c60b83b7>2010-07-15 11:11:17 +0000
commit5946c16be77d2a87f5aab02261732adbb5c79d93 (patch)
treefb97fb6b0841645c30d3e9d0ec8a2efa74bfb922 /bootstrap
parentf24b4f0b3dcf711956253c72a5f9cfd944f96bc2 (diff)
bootstrap: Fixed interfaces file, append (rootdev), conf-copy. /etc/profile changed.
git-svn-id: https://svn.notk.org/bencoh/kvm-wrapper/@16 19625182-23af-4830-9084-f181c60b83b7
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap/lenny/bootstrap.sh25
-rw-r--r--bootstrap/lenny/conf/etc/profile4
2 files changed, 16 insertions, 13 deletions
diff --git a/bootstrap/lenny/bootstrap.sh b/bootstrap/lenny/bootstrap.sh
index 628fd74..2b89ebc 100755
--- a/bootstrap/lenny/bootstrap.sh
+++ b/bootstrap/lenny/bootstrap.sh
@@ -25,7 +25,6 @@ cleanup()
CLEANUP=( )
-trap cleanup EXIT
function map_disk()
{
@@ -48,28 +47,36 @@ function bs_copy_from_host()
function bs_copy_conf_dir()
{
- cp -rf "$BOOTSTRAP_CONF_DIR/*" "$MNTDIR"
+ cp -rf "$BOOTSTRAP_CONF_DIR/"* "$MNTDIR/"
}
function bootstrap_fs()
{
+ trap cleanup EXIT
+
MNTDIR="`mktemp -d`"
+ CLEANUP+=("rmdir $MNTDIR")
local DISKDEV=$1
local PARTDEV=$1
+ local rootdev="/dev/hda"
+
if [[ BOOTSTRAP_PARTITION_TYPE -eq "msdos" ]]; then
sfdisk -H 255 -S 63 -uS --quiet --Linux "$DISKDEV" <<EOF
63,,L,*
EOF
PARTDEV=`map_disk $DISKDEV`
+ rootdev="/dev/hda1"
CLEANUP+=("unmap_disk $DISKDEV")
fi
mkfs.ext3 "$PARTDEV"
- #mkdir "$MNTDIR"
mount "$PARTDEV" "$MNTDIR"
+ CLEANUP+=("umount $MNTDIR")
+ CLEANUP+=("sync")
+
# Now debootstrap, first stage (do not configure)
debootstrap --foreign --include="$BOOTSTRAP_EXTRA_PKGSS" "$BOOTSTRAP_FLAVOR" "$MNTDIR" "$BOOTSTRAP_REPOSITORY"
@@ -99,12 +106,11 @@ EOF
desc_update_setting "KVM_NETWORK_MODEL" "virtio"
desc_update_setting "KVM_KERNEL" "/home/bencoh/kvm-hdd/boot/vmlinuz-2.6.26-2-686"
desc_update_setting "KVM_INITRD" "/home/bencoh/kvm-hdd/boot/initrd.img-2.6.26-2-686"
- desc_update_setting "KVM_APPEND" "root=/dev/hda ro init=/bootstrap-init.sh"
+ desc_update_setting "KVM_APPEND" "root=$rootdev ro init=/bootstrap-init.sh"
kvm_start_vm "$VM_NAME"
mount "$PARTDEV" "$MNTDIR"
- CLEANUP+=("umount $MNTDIR; rmdir $MNTDIR")
# Copy some files/configuration from host
bs_copy_from_host /etc/hosts
@@ -119,11 +125,6 @@ EOF
echo "$VM_NAME" > "$MNTDIR/etc/hostname"
# fstab
- LOCAL rootdev="/dev/hda"
- if [[ BOOTSTRAP_PARTITION_TYPE -eq "msdos" ]]; then
- rootdev="/dev/hda1"
- fi
-
cat > "$MNTDIR/etc/fstab" << EOF
$rootdev / ext3 errors=remount-ro 0 1
proc /proc proc defaults 0 0
@@ -142,7 +143,7 @@ EOF
if [[ -n "$BOOTSTRAP_NET_ADDR" ]]; then
cat >> "$IF_FILE" << EOF
iface eth0 inet static
- address $BOOTSRAP_NET_ADDR
+ address $BOOTSTRAP_NET_ADDR
netmask $BOOTSTRAP_NET_MASK
network $BOOTSTRAP_NET_NW
gateway $BOOTSTRAP_NET_GW
@@ -158,6 +159,6 @@ EOF
cleanup
trap - EXIT
- desc_update_setting "KVM_APPEND" "root=/dev/hda ro"
+ desc_update_setting "KVM_APPEND" "root=$rootdev ro"
}
diff --git a/bootstrap/lenny/conf/etc/profile b/bootstrap/lenny/conf/etc/profile
index 7bb5659..6f280be 100644
--- a/bootstrap/lenny/conf/etc/profile
+++ b/bootstrap/lenny/conf/etc/profile
@@ -4,7 +4,7 @@
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
- PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
+ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
fi
if [ "$PS1" ]; then
@@ -22,3 +22,5 @@ fi
export PATH
umask 022
+
+. /etc/bash.bashrc