summaryrefslogtreecommitdiff
path: root/nfs/scripts/image_deploy_dual-I5734-I6510.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nfs/scripts/image_deploy_dual-I5734-I6510.sh')
-rw-r--r--nfs/scripts/image_deploy_dual-I5734-I6510.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/nfs/scripts/image_deploy_dual-I5734-I6510.sh b/nfs/scripts/image_deploy_dual-I5734-I6510.sh
new file mode 100644
index 0000000..0c5b2f9
--- /dev/null
+++ b/nfs/scripts/image_deploy_dual-I5734-I6510.sh
@@ -0,0 +1,72 @@
+#!/bin/busybox sh
+# Should only started from image_capture.sh, it defines some helper functions and variables)
+# echo_color() <text-color> <background-color> <message>
+# $outdir is the also the current working dir, garanted to be empty and writable
+# Many cloning/partitioning tools are available for use, see make-boot-image.sh
+
+last_win=$(cat "$imagedir/I5734/last") # FIXME ceci est provisoire et prends le windows périmé du master linux. Doit etre I5734 à terme
+last_win=${last_win:-XXXXXXXX}
+indir_win="$imagedir/I5734/$last_win/"
+
+last=$(cat "$imagedir/I6510/last")
+last=${last:-XXXXXXXX}
+indir="$imagedir/I6510/$last/"
+
+echo_color white blue ">>> DUALBOOT indir_win='$indir_win'"
+echo_color white blue ">>> DUALBOOT indir='$indir'"
+
+echo_color white blue ">>> Discarding whole ${firstdisk}"
+blkdiscard -v ${firstdisk}
+
+echo_color white blue ">>> Restoring ${firstdisk} boot sectors"
+pigz -dc "$indir/sda-dd.gz" | dd of=${firstdisk} count=2048
+
+echo_color white blue ">>> Detecting new partitions"
+echo -e "r\ne\ny\nw\ny" | gdisk ${firstdisk}
+
+echo_color white blue ">>> Restoring ${firstdiskp}1 NTFS WinRecovery"
+pigz -dc "$indir/sda1-partclone.gz" | partclone.restore -o ${firstdiskp}1
+
+echo_color white blue ">>> Restoring ${firstdiskp}2 FAT32 EFI"
+pigz -dc "$indir/sda2-partclone.gz" | partclone.restore -o ${firstdiskp}2
+
+echo_color white blue ">>> Restoring ${firstdiskp}3 RAW M$ Reserved"
+pigz -dc "$indir_win/sda3-dd.gz" | dd of=${firstdiskp}3
+
+echo_color white blue ">>> Restoring ${firstdiskp}4 NTFS Win10"
+pigz -dc "$indir_win/sda4-partclone.gz" | partclone.restore -o ${firstdiskp}4
+
+echo_color white blue ">>> Restoring ${firstdiskp}5 EXT4 LINUX"
+pigz -dc "$indir/sda5-partclone.gz" | partclone.restore -o ${firstdiskp}5
+
+echo_color white blue ">>> Restoring ${firstdiskp}6 Swap"
+pigz -dc "$indir/sda6-dd.gz" | dd of=${firstdiskp}6
+
+echo_color white blue ">>> Customizing WINDOWS"
+mkdir -p /mnt/win
+mount.ntfs ${firstdiskp}4 /mnt/win
+hostname > /mnt/win/EMAC/newhostname.txt
+echo "yes" > /mnt/win/EMAC/freshlycloned.txt
+echo $last_win > /mnt/win/EMAC/masterver.txt
+umount /mnt/win
+
+echo_color white blue ">>> Customizing LINUX"
+mkdir -p /mnt/lin
+mount ${firstdiskp}5 /mnt/lin
+#mount.ntfs ${firstdisk}1 /mnt/lin/boot
+#mount -t proc proc /mnt/lin/proc
+#mount -t sysfs sysfs /mnt/lin/sys
+#mount --bind /dev /mnt/lin/dev
+#chroot /mnt/lin update-grub
+#umount /mnt/lin/dev /mnt/lin/sys /mnt/lin/proc /mnt/lin/boot
+hostname > /mnt/lin/etc/hostname
+echo $last > /mnt/lin/masterver.txt
+sed --in-place "s/I6510/$(hostname)/g" /mnt/lin/etc/hosts
+umount /mnt/lin
+
+echo_color white blue ">>> Setting next boot to Windows"
+mkdir -p /mnt/boot
+mount ${firstdiskp}2 /mnt/boot
+cp /mnt/boot/grub/grubenv.freshlycloned /mnt/boot/grub/grubenv
+umount /mnt/boot
+