Implemented copying

This commit is contained in:
Kevin Veen-Birkenbach 2020-04-30 09:49:55 +02:00
parent 0d0a2d1d9a
commit 0643c3638d
2 changed files with 20 additions and 9 deletions

View File

@ -19,14 +19,15 @@ To install a Linux distribution manually on a SD card type in:
To pase the configuration to the program use this syntax:
```bash
(
echo "$USER" # The username
echo "mmcblk1" # The device
echo "3" # The raspberry pi number
echo "arch" # The operation system
echo "y" # Transfer image
echo "user_password" # The user password
echo "root_password" # The root password
echo "y" # Copy wifi configurations to target system
echo "$USER" # | The username
echo "mmcblk1" # | The device
echo "3" # | The raspberry pi number
echo "arch" # | The operation system
echo "y" # | Transfer image
echo "n" # ├── Overwrite device before copying
echo "user_password" # | The user password
echo "root_password" # | The root password
echo "y" # | Copy wifi configurations to target system
)| sudo bash ./sd_setup.sh
```

View File

@ -175,6 +175,16 @@ mount_partitions(){
echo "Should the image be transfered to $sd_card_path?(y/n)" && read -r transfer_image
if [ "$transfer_image" = "y" ]
then
echo "Should $sd_card_path be overwritten with zeros before copying?(y/n)" && read -r copy_zeros_to_device
if [ "$copy_zeros_to_device" = "y" ]
then
echo "Overwritting..."
dd if=/dev/zero of="$sd_card_path" bs=1M || error "Overwritting $sd_card_path failed."
else
echo "Skipping Overwritting..."
fi
echo "Starting image transfer..."
case "$os" in
"arch")
@ -194,7 +204,7 @@ if [ "$transfer_image" = "y" ]
echo "" #and then press ENTER twice to accept the default first and last sector.
echo ""
echo "w" #Write the partition table and exit by typing w.
)| fdisk "$sd_card_path" || error "Creating partitions failed. Try \"sudo dd if=/dev/zero of=$sd_card_path bs=1M\""
)| fdisk "$sd_card_path" || error "Creating partitions failed. Try to execute this script with the overwritting parameter."
echo "Format boot partition..."
mkfs.vfat "$boot_partition_path" || error "Format boot is not possible."