Update raspi-flash script

main
Ian Mancini 4 years ago
parent 9b44c4eec4
commit 5b03dba607

@ -5,7 +5,6 @@ shopt -s extglob
# TODO: Add help message
# TODO: Add parameter to set $DOWNLOADS_DIR
DOWNLOADS_DIR="$HOME/Downloads/os"
URL="https://downloads.raspberrypi.org/os_list_imagingutility_v2.json"
@ -62,7 +61,7 @@ flash() {
sudo dd bs=4M status=progress oflag=sync if="$1" of="$2"
}
# TODO: Improve this filter, it's a mess
# TODO: Improve this messy filter
read -rd '' FILTER << EOF || true
(.os_list[] | select(has("url"))), (.os_list[] | select(.subitems) | .subitems[])
| select(any(.name; contains("Raspberry Pi OS")))
@ -134,6 +133,7 @@ if [[ $confirm =~ [yY] ]]; then
sudo umount "$partition" || true
done
flash "$DOWNLOADS_DIR/$IMG_FILENAME" "$DEVICE_SELECTION"
sync
else
exit 1
fi
@ -157,7 +157,9 @@ enable_wifi=${enable_wifi:-Y}
if [[ $enable_wifi =~ [yY] ]]; then
read -rp "Network name: " ssid
read -rsp "Password (hidden): " psk
printf "\n"
read -rp "Country (Two letters. Example: AR): " country
[ -f /mnt/raspi-flash/wpa_supplicant.conf ] && \
sudo rm /mnt/raspi-flash/wpa_supplicant.conf
sudo bash -c 'cat > /mnt/raspi-flash/wpa_supplicant.conf' <<EOF
country=$country
@ -173,6 +175,7 @@ network={
EOF
fi
sudo umount "$DEVICE_SELECTION"1
sudo umount "$DEVICE_SELECTION"
sudo rmdir /mnt/raspi-flash
echo "Finished successfully!"

Loading…
Cancel
Save