Implemented automatic boot_size and .xz file management

This commit is contained in:
Kevin Veen-Birkenbach 2024-07-22 23:23:40 +02:00
parent bd05fd4c2d
commit 3daed9447b

View File

@ -88,14 +88,17 @@ case "$operation_system" in
base_download_url="https://www.fosshub.com/Android-x86.html?dwl=android-x86_64-9.0-r2.iso"; base_download_url="https://www.fosshub.com/Android-x86.html?dwl=android-x86_64-9.0-r2.iso";
image_name="android-x86_64-9.0-r2.iso" image_name="android-x86_64-9.0-r2.iso"
image_checksum="f7eb8fc56f29ad5432335dc054183acf086c539f3990f0b6e9ff58bd6df4604e" image_checksum="f7eb8fc56f29ad5432335dc054183acf086c539f3990f0b6e9ff58bd6df4604e"
boot_size="+500M"
;; ;;
"torbox") "torbox")
base_download_url="https://www.torbox.ch/data/"; base_download_url="https://www.torbox.ch/data/";
image_name="torbox-20220102-v050.gz" image_name="torbox-20220102-v050.gz"
image_checksum="0E1BA7FFD14AAAE5F0462C8293D95B62C3BF1D9E726E26977BD04772C55680D3" image_checksum="0E1BA7FFD14AAAE5F0462C8293D95B62C3BF1D9E726E26977BD04772C55680D3"
boot_size="+200M"
;; ;;
"arch") "arch")
question "Which Raspberry Pi will be used (e.g.: 1, 2, 3b, 3b+, 4...):" && read -r raspberry_pi_version question "Which Raspberry Pi will be used (e.g.: 1, 2, 3b, 3b+, 4...):" && read -r raspberry_pi_version
boot_size="+500M"
base_download_url="http://os.archlinuxarm.org/os/"; base_download_url="http://os.archlinuxarm.org/os/";
case "$raspberry_pi_version" in case "$raspberry_pi_version" in
"1") "1")
@ -121,6 +124,7 @@ case "$operation_system" in
;; ;;
"manjaro") "manjaro")
question "Which version(e.g.:architect,gnome) should be used:" && read -r gnome_version question "Which version(e.g.:architect,gnome) should be used:" && read -r gnome_version
boot_size="+500M"
case "$gnome_version" in case "$gnome_version" in
"architect") "architect")
image_checksum="6b1c2fce12f244c1e32212767a9d3af2cf8263b2" image_checksum="6b1c2fce12f244c1e32212767a9d3af2cf8263b2"
@ -148,18 +152,23 @@ case "$operation_system" in
base_download_url="https://github.com/manjaro-arm/rpi4-images/releases/download/23.02/" base_download_url="https://github.com/manjaro-arm/rpi4-images/releases/download/23.02/"
image_name="Manjaro-ARM-gnome-rpi4-23.02.img.xz" image_name="Manjaro-ARM-gnome-rpi4-23.02.img.xz"
luks_memory_cost="256000" luks_memory_cost="256000"
raspberry_pi_version=4 raspberry_pi_version="4"
;;
*)
error "Gnome Version $gnome_version isn't supported."
;; ;;
esac esac
;; ;;
esac esac
;; ;;
"moode") "moode")
boot_size="+200M"
image_checksum="185cbc9a4994534bb7a4bc2744c78197" image_checksum="185cbc9a4994534bb7a4bc2744c78197"
base_download_url="https://github.com/moode-player/moode/releases/download/r651prod/" base_download_url="https://github.com/moode-player/moode/releases/download/r651prod/"
image_name="moode-r651-iso.zip"; image_name="moode-r651-iso.zip";
;; ;;
"retropie") "retropie")
boot_size="+500M"
question "Which version(e.g.:1,2,3,4) should be used:" && read -r raspberry_pi_version question "Which version(e.g.:1,2,3,4) should be used:" && read -r raspberry_pi_version
base_download_url="https://github.com/RetroPie/RetroPie-Setup/releases/download/4.8/"; base_download_url="https://github.com/RetroPie/RetroPie-Setup/releases/download/4.8/";
case "$raspberry_pi_version" in case "$raspberry_pi_version" in
@ -305,13 +314,8 @@ if [ "$transfer_image" = "y" ]
info "Starting image transfer..." info "Starting image transfer..."
if [ "$distribution" = "arch" ] if [ "$distribution" = "arch" ]
then then
# Set default size of the boot partition
# Default size of the boot partition boot_size=${boot_size:-"+500M"}
default_boot_size="+300M"
# Prompt to adjust the boot partition size
question "What size should the boot partition be? (Default: $default_boot_size):" && read -r boot_size
boot_size=${boot_size:-$default_boot_size}
# Use the provided size or the default size # Use the provided size or the default size
info "The boot partition will be set to $boot_size." info "The boot partition will be set to $boot_size."
@ -383,6 +387,12 @@ if [ "$transfer_image" = "y" ]
sudo dd if="$image_path" of="$device_path" bs="$OPTIMAL_BLOCKSIZE" conv=fsync status=progress && sudo dd if="$image_path" of="$device_path" bs="$OPTIMAL_BLOCKSIZE" conv=fsync status=progress &&
sync || sync ||
error error
elif [ "${image_path: -3}" = ".xz" ]
then
info "Transferring .xz file..." &&
unxz -c "$image_path" | sudo dd of="$device_path" bs="$OPTIMAL_BLOCKSIZE" conv=fsync status=progress &&
sync ||
error
else else
error "Image transfer for operation system \"$distribution\" is not supported yet!"; error "Image transfer for operation system \"$distribution\" is not supported yet!";
fi fi