From 6e46eb638230075f65b997655dcd35977cb9d690 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Jul 2012 11:44:19 +0200 Subject: [PATCH] fix fstab edit for new clones --- bin/tc_clone.sh | 41 ----------------------------------- bin/tc_clone_pxe.sh | 48 +++++++++++++++++++++++++++++++++++++++++ bin/tc_clone_pxe_s10.sh | 46 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 41 deletions(-) delete mode 100755 bin/tc_clone.sh create mode 100755 bin/tc_clone_pxe.sh create mode 100755 bin/tc_clone_pxe_s10.sh diff --git a/bin/tc_clone.sh b/bin/tc_clone.sh deleted file mode 100755 index d209352..0000000 --- a/bin/tc_clone.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -set -e - -CLONE=/mnt/custom/root - -sfdisk -d /dev/sda | sfdisk /dev/sdb -ls /dev/sd* - -mkfs.ext4 /dev/sdb1 -mkfs.ext4 /dev/sdb2 -mkfs.ext4 /dev/sdb5 -mkswap /dev/sdb6 - -mount /dev/sdb1 $CLONE -df - -rsync -a --one-file-system / $CLONE/ - -mount /dev/sdb2 $CLONE/home -mount /dev/sdb5 $CLONE/var -df - -rsync -a /home/ $CLONE/home/ -rsync -a /var/ $CLONE/var/ - -mount -t proc none $CLONE/proc -mount -o bind /dev $CLONE/dev -mount -o bind /sys $CLONE/sys - -chroot $CLONE - -umount $CLONE/sys -umount $CLONE/proc -umount $CLONE/dev -umount $CLONE/var -umount $CLONE/home -umount $CLONE - -echo "OK, I'm cloned!" - diff --git a/bin/tc_clone_pxe.sh b/bin/tc_clone_pxe.sh new file mode 100755 index 0000000..5aad12d --- /dev/null +++ b/bin/tc_clone_pxe.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -e + +MASTER=192.168.0.64 +MASTERPATH=/mnt/custom +NAME=$1 +CLONE=/mnt/$NAME + +if [ ! -d $CLONE ]; then + mkdir $CLONE +fi + +# CLONING +mount /dev/sda1 $CLONE +#df +echo "rsyncing root..." +rsync -a --delete --one-file-system $MASTER:$MASTERPATH/ $CLONE/ + +echo "rsyncing home..." +mount /dev/sda2 $CLONE/home +#df +rsync -a --exclude=/home/telecaster/archives/ --exclude=/home/telecaster/trash/ --exclude=/home/telecaster/test/ $MASTER:$MASTERPATH/home/ $CLONE/home/ +umount $CLONE/home + +echo "rsyncing var..." +mount /dev/sda5 $CLONE/var +#df +rsync -a --delete $MASTER:$MASTERPATH/var/ $CLONE/var/ + +# CHROOT +mount -t proc none $CLONE/proc +mount -o bind /dev $CLONE/dev +mount -o bind /sys $CLONE/sys + +chroot $CLONE grub-install /dev/sda +chroot $CLONE update-grub + +umount $CLONE/sys +umount $CLONE/dev +umount $CLONE/proc + +umount $CLONE/var +umount $CLONE +#df + +echo "Hello world, I'm an NEW TC clone ! :)" + diff --git a/bin/tc_clone_pxe_s10.sh b/bin/tc_clone_pxe_s10.sh new file mode 100755 index 0000000..ca9bab7 --- /dev/null +++ b/bin/tc_clone_pxe_s10.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e + +MASTER=192.168.0.64 +MASTERPATH=/mnt/custom +NAME=$1 +CLONE=/mnt/$NAME + +if [ ! -d $CLONE ]; then + mkdir $CLONE +fi + +mount /dev/sda1 $CLONE +echo "rsyncing root..." +rsync -a --delete $MASTER:$MASTERPATH/ $CLONE/ + +echo "rsyncing home..." +mount /dev/sda3 $CLONE/home +rsync -a --delete --exclude=/home/telecaster/archives/ --exclude=/home/telecaster/trash/ --exclude=/home/telecaster/test/ $MASTER:$MASTERPATH/home/ $CLONE/home/ +umount $CLONE/home + +echo "rsyncing var..." +rsync -a --delete $MASTER:$MASTERPATH/var/ $CLONE/var/ + +# CHROOT +mount -t proc none $CLONE/proc +mount -o bind /dev $CLONE/dev +mount -o bind /sys $CLONE/sys + +chroot $CLONE grub-install /dev/sda +chroot $CLONE ls -tl /dev/disk/by-uuid >> /etc/fstab +chroot $CLONE vi /etc/fstab +chroot $CLONE grub-install /dev/sda +chroot $CLONE update-grub + +umount $CLONE/sys +umount $CLONE/dev +umount $CLONE/proc + +#umount $CLONE/var +umount $CLONE + +echo "Hello world, I'm a NEW TC (s10) clone ! :)\nDon't forget to update /etc/fstab in the chroot !" + + -- 2.39.5