From: Guy Om Date: Tue, 15 Jun 2021 21:58:54 +0000 (+0000) Subject: fix options X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=9a2760f7d44def61fbb4daa84e7ffae4a1086b38;p=clone-me.git fix options --- diff --git a/tc_clone_nuc_nv.sh b/tc_clone_nuc_nv.sh index fe267ae..6eae5f7 100755 --- a/tc_clone_nuc_nv.sh +++ b/tc_clone_nuc_nv.sh @@ -13,12 +13,12 @@ VAR_PART="nvme0n1p2" SWAP_PART="nvme0n1p3" HOME_PART="nvme0n1p4" -while getopts m:i:p:r:s:d flag +while getopts m:i:p:r:s:d:f flag do case "${flag}" in m) MASTER_HOST=${OPTARG};; i) ID=${OPTARG};; - f) FORMAT=true;; + f) FORMAT=tdrue;; r) ROOT=${OPTARG};; s) SYNC=true;; p) PARTITIONS=${OPTARG};; @@ -30,31 +30,42 @@ if [ ! -d $CLONE ]; then mkdir $CLONE fi +#umount /dev/$HOME_PART $$CLONE/home +#umount /dev/$VAR_PART $CLONE/var +#umount /dev/$ROOT_PART $CLONE + if [ $PARTITION ]; then sfdisk /dev/DISK < $PARTITIONS fi if [ $FORMAT ]; then - mkfs.$FS_TYPE /dev/$ROOT_PART - mkfs.$FS_TYPE /dev/$VAR_PART - mkfs.$FS_TYPE /dev/$HOME_PART + mkfs.$FS_TYPE -q /dev/$ROOT_PART + mkfs.$FS_TYPE -q /dev/$VAR_PART + mkfs.$FS_TYPE -q /dev/$HOME_PART mkswap /dev/$SWAP_PART fi -mount /dev/$ROOT_PART $CLONE -mount /dev/$VAR_PART $CLONE/var -mount /dev/$HOME_PART $$CLONE/home - if [ $SYNC ]; then # CLONING + mount /dev/$ROOT_PART $CLONE echo "rsyncing root..." - rsync -a --delete --exclude "/var/*" --exclude "/home/*" --one-file-system $MASTER_HOST:$MASTER_PATH/ $CLONE/ + rsync -a --delete --exclude "/var/*" --exclude "/home/*" --one-file-system $MASTER_HOST:$ROOT/ $CLONE/ + DEST=$CLONE/var + if [ ! -d $DEST ]; then + mkdir $DEST + fi + mount /dev/$VAR_PART $CLONE/var echo "rsyncing var..." - rsync -a --one-file-system --delete $MASTER_HOST:$MASTER_PATH/var/ $CLONE/var/ + rsync -a --one-file-system --delete $MASTER_HOST:$ROOT/var/ $CLONE/var/ + DEST=$CLONE/home + if [ ! -d $DEST ]; then + mkdir $DEST + fi + mount /dev/$HOME_PART $CLONE/home echo "rsyncing home..." - rsync -a --one-file-system --exclude "archives/*" --exclude "trash/*" --exclude "test/*" --exclude "edit/*" $MASTER_HOST:$MASTER_PATH/home/ $CLONE/home/ + rsync -a --one-file-system --exclude "archives/*" --exclude "trash/*" --exclude "test/*" --exclude "edit/*" $MASTER_HOST:$ROOT/home/ $CLONE/home/ fi # FSTAB @@ -72,7 +83,7 @@ uuid=`get_uuid $ROOT_PART` echo "UUID=$uuid / $FS_TYPE defaults,errors=remount-ro 0 1" > $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 +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 @@ -85,7 +96,7 @@ echo $ID > $CLONE/etc/hostname # CHROOT mount --bind /sys $CLONE/sys -mount --bind /prc $CLONE/proc +mount --bind /proc $CLONE/proc mount --bind /dev $CLONE/dev mount --bind /dev/pts $CLONE/dev/pts @@ -95,10 +106,10 @@ chroot $CLONE update-initramfs -u chroot $CLONE update-grub # UMOUNT -umount $CLONE/sys -umount $CLONE/proc umount $CLONE/dev/pts umount $CLONE/dev +umount $CLONE/proc +umount $CLONE/sys umount $CLONE/var umount $CLONE/home umount $CLONE