Clone script
This commit is contained in:
parent
212c95b3a7
commit
ad14ac673b
41
clone/clone
41
clone/clone
|
@ -46,31 +46,34 @@ echo " ))) replace by real code (((";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [4] Burn image to device
|
||||||
|
#========================================================#
|
||||||
|
echo "\n>>> [4] Burning image into disk";
|
||||||
|
|
||||||
|
# (1) Confirmation #
|
||||||
|
read -p" (!) Burn the whole disk ? it is irreversible! (y/n) [n]" confirm_burn;
|
||||||
|
( test -z "$confirm_burn" || test $confirm_burn != "y" ) \
|
||||||
|
&& (echo "<<< aborting" && exit);
|
||||||
|
|
||||||
|
# (2) Burning image into disk #
|
||||||
|
sudo dd if=./original.img of=$1 bs=4M \
|
||||||
|
|| ( echo "<<< ERROR: dd command failed" && exit );
|
||||||
|
|
||||||
|
echo "<<< done";
|
||||||
|
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|
||||||
# [2] Formatting USB #
|
# [5] Mount partition
|
||||||
########################################
|
#========================================================#
|
||||||
|
|
||||||
# [1] unmount before modifying
|
echo ">>> [5] Mounting partition ${1}2";
|
||||||
sudo umount $1;
|
|
||||||
|
|
||||||
# [2] format to fat
|
# [1] Mount device partition
|
||||||
sudo mkdosfs -n "SATS"-I $1;
|
sudo mount ${1}2 /mnt -o uid=$UID,gid=$GID,umask=022;
|
||||||
|
|
||||||
# [3] manage partition layout
|
|
||||||
....;
|
|
||||||
|
|
||||||
|
|
||||||
# [3] Extract files #
|
|
||||||
########################################
|
|
||||||
|
|
||||||
# [1] Mount device
|
|
||||||
sudo mount $1 /mnt -o uid=1000,gid=1000,umask=022;
|
|
||||||
|
|
||||||
# [2] Extract files
|
|
||||||
tar -xzvf ./image.tar.gz -C /mnt;
|
|
||||||
|
|
||||||
|
echo "<<< done";
|
||||||
|
|
||||||
|
|
||||||
# [4] Manage SSH keys #
|
# [4] Manage SSH keys #
|
||||||
|
|
Loading…
Reference in New Issue