summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Raymond <kraymond@avencall.com>2012-07-13 16:05:00 +0200
committerKévin Raymond <kraymond@avencall.com>2012-07-13 16:05:00 +0200
commitc89a61e1d4af3a8aba0745c90bb9f3a54763d9a4 (patch)
tree6e6fa8f0960427eeb762c169043b168c86c87b01
parente5b8b9f05ec0a48a4674c3032b7c434d4b0013d1 (diff)
czilla cloning script need the source image name as argument. Better as we could change it on the boot args
-rwxr-xr-xclonezilla/cloning_disks.sh23
-rw-r--r--clonezilla/syslinux.cfg2
2 files changed, 17 insertions, 8 deletions
diff --git a/clonezilla/cloning_disks.sh b/clonezilla/cloning_disks.sh
index 2a8c636..3e96ce4 100755
--- a/clonezilla/cloning_disks.sh
+++ b/clonezilla/cloning_disks.sh
@@ -4,6 +4,9 @@
# then edit each drives to set the network config
# TODO:
# - Need to have the pool of ip adress in an external file
+# - Should match the complete UUID, not only a small part to prevent
+# use = instead of greap!
+# - Should get the live dongle uuid dynamicly
boards=(1 2 3 4 5)
default_ip="192.168.0.8"
@@ -13,8 +16,10 @@ devices_to_clone=""
the_dont_touch_devices=""
SRC_DISK_UUID="7b61c082-5dcb-4b65-83dc-9fd10b7572bf"
-CZILLA_UUID="CC03-F474"
-SRC_IMG="2012-06-27-14-img"
+# Add to the CZILLA_UUID variable all UUID of disks that needs to be blacklisted
+# from cloning. Use `|' as separator (would be used as regexp). You only need on
+# UUID, don't list all partitions as we are going to blacklist the device node.
+CZILLA_UUID="CC03-F474|941A-E0FD"
SRC_DIR="/home/partimag/"
WK_TPM="/wk_tmp"
@@ -51,8 +56,8 @@ set_ntw()
mount | grep -q $partition && sudo umount $partition
sudo mount $partition $WK_TPM
- sudo sed -i "s|192\.168\.0\.80|$default_ip${boards[$idx]}|" $WK_TP/etc/rc.local
- sudo sed -i "s|pcb-test|$default_hostname${boards[$idx]}|" $WK_TP/etc/hostname
+ sudo sed -i "s|^\(ifconfig eth[0-9] \)\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}|\1$default_ip${boards[$idx]}|" $WK_TP/etc/rc.local
+ sudo echo "$default_hostname${boards[$idx]}" > $WK_TP/etc/hostname
sudo umount $WK_TPM
echo ""
$((idx++))
@@ -99,7 +104,7 @@ blacklist_devices()
device=`echo $partition | sed -n "s|^/dev/\([a-z]\+\)[0-9]*|\1|p"`
# Escaping the live media hosting Clonezilla
- echo "$dev" | grep -q "$CZILLA_UUID" \
+ echo "$dev" | grep -qE "$CZILLA_UUID" \
&& the_dont_touch_devices="$the_dont_touch_devices $device" && continue
# Mount the partition holding the source image
@@ -115,12 +120,16 @@ blacklist_devices()
#
# Fire!
#
+[ ! $# -eq 1 ]
+exit_on_error "Error, you need to give the image name as the only argument"
+
blacklist_devices
add_device_as_target
-ocs-restore-mdisks --batch -p "-g auto -e1 auto -e2 -c -r -j2 -p true" $SRC_IMG $devices_to_clone
+ocs-restore-mdisks --batch -p "-g auto -e1 auto -e2 -c -r -j2 -p true" $1 $devices_to_clone
+echo Setting the network now
set_ntw $devices_to_clone
-echo "\nDONE, you could Halt now to process again."
+echo " DONE, you could Halt now to process again."
exit 0
# vi: sw=2 ts=2
diff --git a/clonezilla/syslinux.cfg b/clonezilla/syslinux.cfg
index 937a0a9..3a530b3 100644
--- a/clonezilla/syslinux.cfg
+++ b/clonezilla/syslinux.cfg
@@ -34,7 +34,7 @@ label Clonezilla live custom
MENU LABEL Clonezilla live custom (Default settings, VGA 800x600)
# MENU PASSWD
kernel /live/vmlinuz
- append initrd=/live/initrd.img boot=live config noswap nolocales edd=on nomodeset noprompt ocs_live_run="/live/image/utils/cloning_disks.sh" ocs_live_keymap="NONE" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash
+ append initrd=/live/initrd.img boot=live config noswap nolocales edd=on nomodeset noprompt ocs_live_run="/live/image/utils/cloning_disks.sh xivo-factory-120713-img" ocs_live_keymap="NONE" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash
TEXT HELP
* This is going to restore one image to several Hard Drives!
* WARNING it could erase your datas. Make sure of what you're running!