]> git.parisson.com Git - clone-me.git/commitdiff
add condition for restoring from backup
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Tue, 11 Mar 2025 08:05:19 +0000 (09:05 +0100)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Tue, 11 Mar 2025 08:05:19 +0000 (09:05 +0100)
tc_clone_nuc_nv_efi.sh

index fd8d0524ec7d55fc0b1f2996a020877f6834095f..903e58b7f50cbbeb6456c87afd5d85d0852e0b92 100755 (executable)
@@ -14,7 +14,7 @@ VAR_PART="nvme0n1p3"
 SWAP_PART="nvme0n1p4"
 HOME_PART="nvme0n1p5"
 
-while getopts m:i:p:r:s:d:f flag
+while getopts m:i:p:r:s:d:f:b flag
 do
     case "${flag}" in
         m) MASTER=${OPTARG};;
@@ -23,6 +23,7 @@ do
         r) ROOT=${OPTARG};;
         s) SYNC=true;;
         p) PARTITIONS=${OPTARG};;
+        b) backup=false;;
     esac
 done
 
@@ -81,7 +82,12 @@ mount /dev/$HOME_PART $CLONE/home
 if [ $SYNC ]; then
     # CLONING
     echo "rsyncing root..."
-    rsync -a --delete --one-file-system $MASTER:$ROOT/ $CLONE/
+
+    if [ $BACKUP ]; then
+        rsync -a --delete --one-file-system $MASTER:$ROOT/ $CLONE/
+    else
+        rsync -a --delete --one-file-system $MASTER:$ROOT/root/ $CLONE/
+    fi
 
     echo "rsyncing efi..."
     rsync -a --one-file-system --delete $MASTER:$ROOT/boot/efi/ $CLONE/boot/efi/