Desktop Image choceable, typos, datum is now variable

This commit is contained in:
dewomser 2021-11-01 13:51:58 +01:00
parent e9d48ae1ae
commit c50c2007f8

View file

@ -3,20 +3,26 @@
#https://github.com/dewomser/Raspi-auto-downloader #https://github.com/dewomser/Raspi-auto-downloader
attribut=$1 attribut=$1
datum="[0-9]{4}-[0-9]{2}-[0-9]{2}"
if [[ "$attribut" = "-h" ]] if [[ "$attribut" = "-h" ]]
then then
echo " echo "
Aufruf raspi-install.sh [OPTION] Aufruf raspi-install.sh [OPTION]
Option Bedeutung Option Bedeutung
-f raspios_full_armhf -f raspios_full_armhf Raspberry Pi OS with desktop and recommended software
-l raspios_lite_armhf -l raspios_lite_armhf Raspberry Pi OS Lite
-d raspios_armhf Raspberry Pi OS with desktop
-h Diese Hilfe -h Diese Hilfe
" && exit " && exit
elif [[ "$attribut" = "-l" ]] elif [[ "$attribut" = "-l" ]]
then then
rimage="raspios_lite_armhf" rimage="raspios_lite_armhf"
echo "lite" elif [[ "$attribut" = "-d" ]]
then
rimage="raspios_armhf"
else else
rimage="raspios_full_armhf" rimage="raspios_full_armhf"
fi fi
@ -25,12 +31,12 @@ fi
cd ~/Downloads || exit cd ~/Downloads || exit
dirr=$(curl --silent https://downloads.raspberrypi.org/$rimage/images/ | grep -o -E "$rimage-[0-9]{4}-[0-9]{2}-[0-9]{2}" | tail -1 ) dirr=$(curl --silent https://downloads.raspberrypi.org/$rimage/images/ | grep -o -E "$rimage-$datum" | tail -1 )
pathr="https://downloads.raspberrypi.org/$rimage/images/$dirr/" pathr="https://downloads.raspberrypi.org/$rimage/images/$dirr/"
rname=$(curl --silent "$pathr" | grep -o -E -w "[0-9]{4}-[0-9]{2}-[0-9]{2}-[[:lower:]-]*\.zip" | head -1) rname=$(curl --silent "$pathr" | grep -o -E -w "$datum-[[:lower:]-]*\.zip" | head -1)
wget -erobots=off "$pathr""$rname" -O raspi.zip wget -erobots=off "$pathr""$rname" -O raspi.zip
#echo Test kompletter Pfad :: "$pathr""$rname" #echo Test kompletter Pfad :: "$pathr""$rname"
shaname=$(curl --silent "$pathr" | grep -o -E -w "[0-9]{4}-[0-9]{2}-[0-9]{2}-[[:lower:]-]*\.zip\.sha256" | head -1) shaname=$(curl --silent "$pathr" | grep -o -E -w "$datum-[[:lower:]-]*\.zip\.sha256" | head -1)
#echo Test kompletter sha256-Pfad :: $pathr$shaname #echo Test kompletter sha256-Pfad :: $pathr$shaname
wget "$pathr""$shaname" -O raspi.sha256 wget "$pathr""$shaname" -O raspi.sha256
echo "Bitte ein paar Sekunden warten. Der Hash wird erzeugt." echo "Bitte ein paar Sekunden warten. Der Hash wird erzeugt."
@ -41,9 +47,9 @@ echo Prüfsumme aus Download "$sha1"
echo Prüfsumme von Webseite "$sha2" echo Prüfsumme von Webseite "$sha2"
if [ "$sha1" == "$sha2" ]; then if [ "$sha1" == "$sha2" ]; then
echo "Prüfsumme stimmt" echo "Prüfsumme stimmt."
echo "-----------------" echo "-----------------"
echo "SD-Karte auf die geschieben werden soll ENTFERNEN !" \"y\" echo "SD-Karte auf die geschrieben werden soll ENTFERNEN !" \"y\"
read -r input read -r input
if [ "$input" == "y" ]; then if [ "$input" == "y" ]; then
mapfile -t laufwerke < <(lsblk -l -o Name | grep -E -v "[0-9]" | grep -E "sd[a-z]") mapfile -t laufwerke < <(lsblk -l -o Name | grep -E -v "[0-9]" | grep -E "sd[a-z]")
@ -51,25 +57,25 @@ else
exit exit
fi fi
echo Es gibt diese seriellen Blockdevices "${laufwerke[@]}" echo Es gibt diese seriellen Blockdevices "${laufwerke[*]}"
echo SD- Karte, die überschrieben werden soll einstecken, \"y\" echo "SD-Karte auf die geschrieben werden soll EINSCHIEBEN !" \"y\"
read -r input read -r input
if [ "$input" == "y" ]; then if [ "$input" == "y" ]; then
mapfile -t laufwerke1 < <(lsblk -l -o Name | grep -E -v "[0-9]" | grep -E "sd[a-z]") mapfile -t laufwerke1 < <(lsblk -l -o Name | grep -E -v "[0-9]" | grep -E "sd[a-z]")
mapfile -t laufwerke2 < <({ printf "%s\n" "${laufwerke[@]}" | sort -u; printf "%s\n" "${laufwerke1[@]}" "${laufwerke[@]}"; } | sort | uniq -u) mapfile -t laufwerke2 < <({ printf "%s\n" "${laufwerke[@]}" | sort -u; printf "%s\n" "${laufwerke1[@]}" "${laufwerke[@]}"; } | sort | uniq -u)
echo Es gibt jetzt dieses neue seriellen Blockdevices "${laufwerke2[@]}" echo Es gibt jetzt dieses neue serielle Blockdevice: "${laufwerke2[0]}"
else else
exit exit
fi fi
echo Ich bin mir SICHER und will auf SD Karte schreiben ! "${laufwerke2[@]}" \"y\" oder \"n\" echo Ich bin mir SICHER und will auf SD-Karte schreiben : /dev/"${laufwerke2[0]}" \"y\" oder \"n\"
read -r endgueltigja read -r endgueltigja
if [ "$endgueltigja" == "y" ]; then if [ "$endgueltigja" == "y" ]; then
# das hier aktivieren --TOTENKOPF--- zum Schreiben # das hier aktivieren --TOTENKOPF--- zum Schreiben
#unzip raspi.zip | dd of=/dev/${laufwerke2[@]} status=progress #unzip raspi.zip | dd of=/dev/${laufwerke2[0]} status=progress
echo "Tatatatah ! fertig" echo "Tatatatah ! fertig"
else else
exit exit