mirror of
https://github.com/kevinveenbirkenbach/raspberry-pi-tools.git
synced 2024-11-22 18:11:03 +01:00
Added optional copying to sd_card
This commit is contained in:
parent
7a4f700f0f
commit
30f1d3e021
@ -23,6 +23,7 @@ To pase the configuration to the program use this syntax:
|
|||||||
echo "mmcblk1" # The device
|
echo "mmcblk1" # The device
|
||||||
echo "3" # The raspberry pi number
|
echo "3" # The raspberry pi number
|
||||||
echo "arch" # The operation system
|
echo "arch" # The operation system
|
||||||
|
echo "y" # Transfer image
|
||||||
echo "user_password" # The user password
|
echo "user_password" # The user password
|
||||||
echo "root_password" # The root password
|
echo "root_password" # The root password
|
||||||
echo "y" # Copy wifi configurations to target system
|
echo "y" # Copy wifi configurations to target system
|
||||||
|
23
sd_setup.sh
23
sd_setup.sh
@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# shellcheck disable=SC2010 # ls | grep allowed
|
# shellcheck disable=SC2010 # ls | grep allowed
|
||||||
|
# shellcheck disable=SC2143 # Suppress wrong grep -q warning
|
||||||
|
|
||||||
echo "Setupscript for Raspberry Pi SD's"
|
echo "Setupscript for Raspberry Pi SD's"
|
||||||
echo
|
echo
|
||||||
@ -176,8 +177,11 @@ mount_partitions(){
|
|||||||
echo "The following mounts refering this setup exist:" && mount | grep "$working_folder"
|
echo "The following mounts refering this setup exist:" && mount | grep "$working_folder"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Copy data to $sd_card_path..."
|
echo "Should the image be transfered to $sd_card_path?(y/n)"
|
||||||
|
read -r transfer_image
|
||||||
|
if [ "$transfer_image" = "y" ]
|
||||||
|
then
|
||||||
|
echo "Starting image transfer..."
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"arch")
|
"arch")
|
||||||
echo "Execute fdisk..."
|
echo "Execute fdisk..."
|
||||||
@ -217,19 +221,26 @@ case "$os" in
|
|||||||
"moode")
|
"moode")
|
||||||
unzip -p "$image_path" | sudo dd of="$sd_card_path" bs=1M conv=fsync || error "DD to $sd_card_path failed."
|
unzip -p "$image_path" | sudo dd of="$sd_card_path" bs=1M conv=fsync || error "DD to $sd_card_path failed."
|
||||||
sync
|
sync
|
||||||
|
|
||||||
mount_partitions;
|
|
||||||
;;
|
;;
|
||||||
"retropie")
|
"retropie")
|
||||||
gunzip -c "$image_path" | sudo dd of="$sd_card_path" bs=1M conv=fsync
|
gunzip -c "$image_path" | sudo dd of="$sd_card_path" bs=1M conv=fsync
|
||||||
sync
|
sync
|
||||||
|
|
||||||
mount_partitions;
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
error "Image transfer for operation system \"$os\" is not supported yet!";
|
error "Image transfer for operation system \"$os\" is not supported yet!";
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
else
|
||||||
|
echo "Skipping image transfer..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Start regular mounting procedure..."
|
||||||
|
if [ "$(mount | grep -q "$boot_mount_path")" ] && [ "$(mount | grep -q "$root_mount_path")" ]
|
||||||
|
then
|
||||||
|
echo "Everything allready mounted. Skipping..."
|
||||||
|
else
|
||||||
|
mount_partitions
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Define target paths..."
|
echo "Define target paths..."
|
||||||
target_home_path="$root_mount_path/home/";
|
target_home_path="$root_mount_path/home/";
|
||||||
|
Loading…
Reference in New Issue
Block a user