Merge branch 'master' of trov.ar:ianmethyst/bin

main
Ian Mancini 4 years ago
commit 522e1eaeac

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

Loading…
Cancel
Save