From: Guillaume Pellerin Date: Tue, 23 Jan 2024 17:44:35 +0000 (+0100) Subject: add var and home parts to efi script X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=07e76c19d52b049bef02a5a8ca64e83f0a93a8ea;p=clone-me.git add var and home parts to efi script --- diff --git a/tc_clone_nuc_nv_efi.sh b/tc_clone_nuc_nv_efi.sh index 05c403e..972a7ed 100755 --- a/tc_clone_nuc_nv_efi.sh +++ b/tc_clone_nuc_nv_efi.sh @@ -10,7 +10,9 @@ FS_TYPE="ext4" DISK=nvme0n1 EFI_PART="nvme0n1p1" ROOT_PART="nvme0n1p2" -SWAP_PART="nvme0n1p3" +VAR_PART="nvme0n1p3" +SWAP_PART="nvme0n1p4" +SWAP_PART="nvme0n1p5" while getopts m:i:p:r:s:d:f flag do @@ -29,9 +31,10 @@ if [ ! -d $CLONE ]; then mkdir $CLONE fi -#umount /dev/$HOME_PART $$CLONE/home -#umount /dev/$VAR_PART $CLONE/var -#umount /dev/$ROOT_PART $CLONE +umount /dev/$HOME_PART $$CLONE/home +umount /dev/$VAR_PART $CLONE/var +umount /dev/$ROOT_PART $CLONE +umount /dev/$EFI_PART if [ $PARTITIONS ]; then sfdisk /dev/$DISK < $PARTITIONS @@ -41,6 +44,8 @@ if [ $FORMAT ]; then mkfs.vfat /dev/$EFI_PART mkfs.$FS_TYPE -q /dev/$ROOT_PART mkswap /dev/$SWAP_PART + mkfs.$FS_TYPE -q /dev/$VAR_PART + mkfs.$FS_TYPE -q /dev/$HOME_PART fi @@ -48,6 +53,19 @@ mount /dev/$ROOT_PART $CLONE mkdir -p $CLONE/boot/efi mount /dev/$EFI_PART $CLONE/boot/efi +DEST=$CLONE/var +if [ ! -d $DEST ]; then + mkdir $DEST +fi +mount /dev/$VAR_PART $CLONE/var + +DEST=$CLONE/home +if [ ! -d $DEST ]; then + mkdir $DEST +fi +mount /dev/$HOME_PART $CLONE/home + + if [ $SYNC ]; then # CLONING echo "rsyncing root..." @@ -55,6 +73,12 @@ if [ $SYNC ]; then echo "rsyncing efi..." rsync -a --one-file-system --delete $MASTER:$ROOT/boot/efi/ $CLONE/boot/efi/ + + echo "rsyncing var..." + rsync -a --one-file-system --delete $MASTER:$ROOT/var/ $CLONE/var/ + + echo "rsyncing home..." + rsync -a --one-file-system --exclude "archives/*" --exclude "trash/*" --exclude "test/*" --exclude "edit/*" $MASTER:$ROOT/home/ $CLONE/home/ fi # FSTAB @@ -74,6 +98,12 @@ uuid=`get_uuid $EFI_PART` echo "UUID=$uuid /bot/efi vfat umask=0077 0 1" >> $CLONE/etc/fstab uuid=`get_uuid $SWAP_PART` echo "UUID=$uuid none swap sw 0 0" >> $CLONE/etc/fstab +if [ ! $VAR_PART == $ROOT_PART ]; then + uuid=`get_uuid $VAR_PART` +echo "UUID=$uuid /var $FS_TYPE defaults,errors=remount-ro 0 2" >> $CLONE/etc/fstab +fi +uuid=`get_uuid $HOME_PART` +echo "UUID=$uuid /home $FS_TYPE defaults,errors=remount-ro 0 2" >> $CLONE/etc/fstab echo "RESUME=UUID=$uuid" >> $CLONE/etc/initramfs-tools/conf.d/resume @@ -96,6 +126,8 @@ umount $CLONE/dev umount $CLONE/proc umount $CLONE/sys umount $CLONE/boot/efi +umount $CLONE/var +umount $CLONE/home umount $CLONE echo "Hello world, I'm $ID cloned from $MASTER ! :)"