diff --git a/README.md b/README.md index f02cced..b56257c 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,11 @@ To pase the configuration to the program use this syntax: ( echo "$USER" # | The username echo "mmcblk1" # | The device - echo "3" # | The raspberry pi number - echo "arch" # | The operation system + echo "4" # | The raspberry pi number + echo "retropie" # | The operation system echo "n" # | Force image download - echo "y" # | Transfer image - echo "n" # ├── Overwrite device before copying + echo "n" # | 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 diff --git a/sd_setup.sh b/sd_setup.sh index 8bb572e..8f5dd6b 100644 --- a/sd_setup.sh +++ b/sd_setup.sh @@ -1,6 +1,5 @@ #!/bin/bash # shellcheck disable=SC2010 # ls | grep allowed -# shellcheck disable=SC2143 # Suppress wrong grep -q warning echo "Setupscript for Raspberry Pi SD's" echo @@ -56,12 +55,19 @@ echo "Select sd-card..." echo "List of actual mounted devices:" ls -lasi /dev/ | grep -E "sd|mm" echo -while [ ! -b "$sd_card_path" ] - do - echo "Please type in the name of the correct sd-card." - echo "/dev/:" && read -r device - sd_card_path="/dev/$device" -done +echo "Please type in the name of the correct sd-card." +echo "/dev/:" && read -r device +sd_card_path="/dev/$device" + +if [ ! -b "$sd_card_path" ] + then + error "$sd_card_path is not valid device." +fi + +if mount | grep -q "$sd_card_path" + then + error "Device $sd_card_path is allready mounted. Umount with \"umount $sd_card_path*\"." +fi echo "Select which Raspberry Pi version should be used:" && read -r version @@ -251,7 +257,7 @@ if [ "$transfer_image" = "y" ] fi echo "Start regular mounting procedure..." -if [ "$(mount | grep -q "$boot_mount_path")" ] && [ "$(mount | grep -q "$root_mount_path")" ] +if mount | grep -q "$boot_mount_path" && mount | grep -q "$root_mount_path" then echo "Everything allready mounted. Skipping..." else