Compare commits

...

32 commits
image ... main

Author SHA1 Message Date
e049be0cf6
Comment out date regex assignment
Comment out the date regex assignment in the script.
2026-02-14 17:19:09 +01:00
ea7400e183
Merge remote-tracking branch 'refs/remotes/origin/main' 2026-02-14 17:13:47 +01:00
def511e244
Dietpi muss noch getestet werden 2026-02-14 17:09:56 +01:00
8b866efb8a
test ob läuft 2024-10-17 02:41:46 +02:00
18a6f40626
typo .\ 2023-05-15 10:27:41 +02:00
b15e329dbe
nee version mit v3 2023-01-24 02:25:42 +01:00
0ccbe9c4c2
curl URL gequotet. Alles für Shellcheck 2023-01-24 02:22:57 +01:00
10bcc31ca8
dd ist jetzt sudo 2022-09-26 02:13:56 +02:00
7f39d64240
readme pfad screenshot angepasst 2022-09-20 08:41:10 +02:00
8054c4af04
shellchecked 2022-09-06 14:01:04 +02:00
8b8c93d558
Update README.md 2022-09-06 13:59:51 +02:00
b4286f28fb
brackets vergessen Shellcheck 2022-09-02 09:01:50 +02:00
b38c267ffb
README.md 2022-09-02 08:38:53 +02:00
ef42312676 Schreibprobleme und entpacken gefixt 2022-05-05 21:39:32 +02:00
605b950d3a
Vorsichtig benutzen !
Nur teilweise getestet
2022-05-05 20:55:59 +02:00
11d8bae657
unsinnige Variable entfernt 2022-05-05 20:51:06 +02:00
dewomser
69b70cfebd Gefährliche Testversion umgestellt von zip auf xZ 2022-05-05 20:46:50 +02:00
b0b72d2f9b Und immer wieder grüsst das Murmeltier .. shellcheck 2022-02-24 18:21:40 +01:00
312a91a6fd Nervige Fehlermelung beim unmounten weg gemacht. 2022-02-24 18:04:04 +01:00
1836a5ea6f Merge branch 'main' of github.com:dewomser/Raspi-auto-downloader into main 2022-02-24 01:03:21 +01:00
d84dbdbff2 aktualisiertes help.png 2022-02-24 01:01:55 +01:00
ee04158e73
typo 2022-02-23 23:48:56 +01:00
038ba40494 Der shellcheck schon wieder … Grrr . Hoffentlich hilfts 2022-02-23 23:40:15 +01:00
1fdf9dc29d sorry falsches Repository, aber jetzt ! 2022-02-23 23:23:48 +01:00
4a56da9763
Achtung Schreibt jetzt 2022-02-23 23:13:27 +01:00
5249631648 Achtung der Downloader schreibt jetzt wirklich !
Abhilfe bei fehlenden Rootrechten werden erklärt
2022-02-23 23:01:20 +01:00
5bb63744a5 shellchecked 2022-02-04 11:59:30 +01:00
badce00de2 Jetzt mit Raspi 64 und neuer Fehlerseite wenn kein Attribut 2022-02-04 11:51:02 +01:00
b3e1a89f5c Merge branch 'main' of github.com:dewomser/Raspi-auto-downloader into main 2021-11-25 17:13:33 +01:00
a7c9c704ad Ups! Ohne Exit funktioniert das besser /Zeile 33 2021-11-25 17:11:18 +01:00
d6ea7dfe30
Update README.md 2021-11-10 17:50:31 +01:00
13f240dbaa
Update README.md 2021-11-10 17:48:53 +01:00
5 changed files with 202 additions and 25 deletions

View file

@ -10,6 +10,6 @@ jobs:
name: Shellcheck name: Shellcheck
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Run ShellCheck - name: Run ShellCheck
uses: ludeeus/action-shellcheck@master uses: ludeeus/action-shellcheck@master

View file

@ -1,17 +1,35 @@
# Raspi-auto-downloader # Raspi-auto-downloader
[![Trigger: Push action](https://github.com/dewomser/Raspi-auto-downloader/actions/workflows/main.yml/badge.svg)](https://github.com/dewomser/Raspi-auto-downloader/actions/workflows/main.yml) Shellchecked
.
05.05.2022 Diese Version kann jetzt Images die mit xz gepackt wurden.
.[![Trigger: Push action](https://github.com/dewomser/Raspi-auto-downloader/actions/workflows/main.yml/badge.svg)](https://github.com/dewomser/Raspi-auto-downloader/actions/workflows/main.yml) Shellchecked
Load fresh images for the Raspberry Load fresh images for the Raspberry
Pi, check SHA256, and copy to SD-Card, a Bashscript. Pi, check SHA256, and copy to SD-Card, a Bashscript.
## Hilfe raspi-install -h Jetzt auch mit den 64er Images
![alt text](https://github.com/dewomser/Raspi-auto-downloader/blob/main/bilder/help.png "help") ## Hilfe raspi-install.sh -h
![alt text](./bilder/help.png "help")
## Copy and check SD-Image ## Copy and check SD-Image
![alt text](https://github.com/dewomser/Raspi-auto-downloader/blob/main/bilder/copy.png "copy and check") ![alt text](./bilder/copy.png "copy and check")
## Fork, Issue, Pull request, Clone ## Fork, Issue, Pull request, Clone
Be carefull, this script is in status Alpha 0.2. ! Be carefull, this script is in status Beta 0.2. !
## Bei fehlenden Rootrechten zum Schreiben auf SD-Karte
Wenn die Karte nur als Root gemountet werden kann, muss dd durch sudo dd ersetzt werden. umount -> sudo umount. Gilt ab Zeile 105
### Alternative für Ubuntu:
echo 'KERNEL=="sd*", SUBSYSTEMS=="usb", MODE="0666"' | sudo tee /etc/udev/rules.d/99-usb-storage.rules
Quelle : https://askubuntu.com/questions/828545/using-dd-without-sudo

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

119
dietpi-install.sh Executable file
View file

@ -0,0 +1,119 @@
#!/bin/bash
# gemacht von Stefan Höhn
#https://github.com/dewomser/Raspi-auto-downloader
#ACHTUNG : Zeile 106-112 Beachten !
attribut=$1
# datum="[0-9]{4}-[0-9]{2}-[0-9]{2}"
url="https://dietpi.com/downloads/images/"
if [[ "$attribut" = "-h" ]]
then
echo "
Aufruf dietpi-install.sh [OPTION]
Option Bedeutung
-1 dietpi für Raspberry v1 ARMv6
-2 dietpi für Raspberry v2 ARNv7
-234 dietpi für Raspberry v2-4 ARMv8
-h Diese Hilfe
-5 dietpi für Raspberrx v5 ARMv8
" && exit
elif [[ "$attribut" = "-1" ]]
then
rimage="DietPi_RPi1-ARMv6-Trixie"
elif [[ "$attribut" = "-2" ]]
then
rimage="DietPi_RPi2-ARMv7-Trixie"
elif [[ "$attribut" = "-234" ]]
then
rimage="DietPi_RPi234-ARM8-Trixie"
elif [[ "$attribut" = "-5" ]]
then
rimage="DietPi_RPi5-ARMv8-Trixie"
else
echo "Kein Pi-Image ausgewählt. \"raspi-install.sh -h \" für Hilfe!" && exit
fi
cd "$HOME/Downloads" || echo"Downloads Ordner nicht vorhanden"
#https://dietpi.com/downloads/images/DietPi_RPi2-ARMv7-Trixie.img.xz
pathr="$url$rimage.img.xz"
pathrs="$pathr.sha256"
# -c
wget -c "$pathr" -O "$rimage.img.xz"
wget "$pathrs" -O "$rimage.img.xz.sha256"
echo "Bitte ein paar Sekunden warten. Der Hash wird erzeugt."
sha1=$(shasum -a 256 "$rimage.img.xz")
sha2=$(cat "$rimage.img.xz.sha256")
sleep 1
echo Prüfsumme aus Download "$sha1"
echo Prüfsumme von Webseite "$sha2"
if [ "$sha1" == "$sha2" ]; then
echo "Prüfsumme stimmt."
echo "-----------------"
echo "SD-Karte auf die geschrieben werden soll ENTFERNEN !" \"y\"
read -r input
if [ "$input" == "y" ]; then
mapfile -t laufwerke < <(lsblk -l -o Name | grep -E "^sd[a-z]*$")
laufwerke[0]="lolo"
laufwerke1[0]="lolo"
else
exit
fi
echo Es gibt diese seriellen Blockdevices "${laufwerke[*]}"
echo "SD-Karte auf die geschrieben werden soll EINSCHIEBEN !" \"y\"
read -r input
if [ "$input" == "y" ]; then
mapfile -t laufwerke1 < <(lsblk -l -o Name |grep -E "^sd[a-z]*$")
echo "${laufwerke1[0]}"
mapfile -t laufwerke2 < <({ printf "%s\n" "${laufwerke[@]}" | sort -u; printf "%s\n" "${laufwerke1[@]}" "${laufwerke[@]}"; } | sort | uniq -u)
zahl_laufwerke="${#laufwerke2[@]}"
echo neu erkannte Es gibt jetzt dieses neue serielle Blockdevice: "${laufwerke2[@]}"
echo Laufwerke ${#laufwerke2[@]}
echo lwo:"${laufwerke2[0]}"
echo lw1:"${laufwerke2[1]}"
if [ "$zahl_laufwerke" -eq 1 ]; then
echo Es gibt jetzt dieses neue serielle Blockdevice: "${laufwerke2[0]}"
else
echo "Es kann nicht geschrieben werden. Es wurden mehr oder weniger als 1 SD-Karte erkannt" ; exit
fi
else
exit
fi
echo Ich bin mir SICHER und will auf SD-Karte schreiben : /dev/"${laufwerke2[0]}" \"y\" oder \"n\"
read -r endgueltigja
if [ "$endgueltigja" == "y" ]; then
# Wenn die Karte nur als root gemountet werden kann, muss dd durch sudo dd ersetzt werden. umount -> sudo umount
## sudo ddd is now on
# Alternative für Ubuntu:
# echo 'KERNEL=="sd*", SUBSYSTEMS=="usb", MODE="0666"' | sudo tee /etc/udev/rules.d/99-usb-storage.rules
# Quelle : https://askubuntu.com/questions/828545/using-dd-without-sudo
# Wenn die nächsten 3 Zeilen aktiviert sind: "don't blame me!"
#umount /dev/"${laufwerke2[0]}"[0-9] > /dev/null 2>&1
xz --keep --decompress dietpi"$attribut".xz
sudo dd if=raspi"$attribut" of=/dev/"${laufwerke2[0]}" bs=4M conv=fsync status=progress || echo "Es gibt Probleme mit Schreibrechten.Ab Zeile 105 gibts Hilfe"
echo "Tatatatah ! fertig"
#umount /dev/"${laufwerke2[0]}"[0-9] > /dev/null 2>&1
else
exit
fi
else
echo "Achtung,Prüfsumme stimmt nicht überein !"
fi

View file

@ -1,11 +1,10 @@
#!/bin/bash #!/bin/bash
# gemacht von Stefan Höhn # gemacht von Stefan Höhn
#https://github.com/dewomser/Raspi-auto-downloader #https://github.com/dewomser/Raspi-auto-downloader
#ACHTUNG : Zeile 106-112 Beachten !
attribut=$1 attribut=$1
datum="[0-9]{4}-[0-9]{2}-[0-9]{2}" datum="[0-9]{4}-[0-9]{2}-[0-9]{2}"
if [[ "$attribut" = "-h" ]] if [[ "$attribut" = "-h" ]]
then then
echo " echo "
@ -16,32 +15,55 @@ Option Bedeutung
-l raspios_lite_armhf Raspberry Pi OS Lite -l raspios_lite_armhf Raspberry Pi OS Lite
-d raspios_armhf Raspberry Pi OS with desktop -d raspios_armhf Raspberry Pi OS with desktop
-h Diese Hilfe -h Diese Hilfe
-f64 raspios_full_arm64
-l64 raspios_lite_arm64
-d64 raspios_arm64
" && exit " && exit
elif [[ "$attribut" = "-f" ]]
then
rimage="raspios_full_armhf"
elif [[ "$attribut" = "-l" ]] elif [[ "$attribut" = "-l" ]]
then then
rimage="raspios_lite_armhf" rimage="raspios_lite_armhf"
elif [[ "$attribut" = "-d" ]] elif [[ "$attribut" = "-d" ]]
then then
rimage="raspios_armhf" rimage="raspios_armhf"
elif [[ "$attribut" = "-f64" ]]
then
rimage="raspios_full_arm64"
elif [[ "$attribut" = "-l64" ]]
then
rimage="raspios_lite_arm64"
elif [[ "$attribut" = "-d64" ]]
then
rimage="raspios_arm64"
else else
rimage="raspios_full_armhf" echo "Kein Pi-Image ausgewählt. \"raspi-install.sh -h \" für Hilfe!" && exit
attribut="-f"
fi fi
#rimage ="raspios_lite_armhf" #rimage ="raspios_lite_armhf"
#rimage="raspios_full_armhf" #rimage="raspios_full_armhf"
cd "$HOME/Downloads" || exit cd "$HOME/Downloads" || echo"Downloads Ordner nicht vorhanden"
dirr=$(curl --silent https://downloads.raspberrypi.org/$rimage/images/ | grep -o -E "$rimage-$datum" | 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 "$datum-[[:lower:]-]*\.zip" | head -1) #rname=$(curl --silent "$pathr" | grep -o -E -w "$datum-[[:lower:]-]*\.zip" | head -1)
wget -c "$pathr""$rname" -O "raspi$attribut".zip #rname=$(curl --silent "$pathr" | grep -o -E "$datum-[[:alnum:]-]*\.xz" | head -1)
rname=$(curl --silent "$pathr" | grep -o -E "$datum-[[:alnum:]-]*\.img\.xz"|tail -1)
wget -c "$pathr""$rname" -O "raspi$attribut".xz
#echo Test kompletter Pfad :: "$pathr""$rname" #echo Test kompletter Pfad :: "$pathr""$rname"
shaname=$(curl --silent "$pathr" | grep -o -E -w "$datum-[[:lower:]-]*\.zip\.sha256" | head -1) shaname=$(curl --silent "$pathr" | grep -o -E -w "$datum-[[:alnum:]-]*\.img.\xz\.sha256" | tail -1)
#echo Test kompletter sha256-Pfad :: $pathr$shaname #echo Test kompletter sha256-Pfad :: $pathr$shaname
wget "$pathr""$shaname" -O raspi"$attribut".sha256 wget "$pathr""$shaname" -O raspi"$attribut".sha256
echo "Bitte ein paar Sekunden warten. Der Hash wird erzeugt." echo "Bitte ein paar Sekunden warten. Der Hash wird erzeugt."
sha1=$(shasum -a 256 raspi"$attribut".zip | grep -o -P "[0-9a-z]{40,}") sha1=$(shasum -a 256 raspi"$attribut".xz | grep -o -P "[0-9a-z]{40,}")
sha2=$( grep -o -P "[0-9a-z]{40,}" < raspi"$attribut".sha256 ) sha2=$( grep -o -P "[0-9a-z]{40,}" < raspi"$attribut".sha256 )
sleep 1 sleep 1
echo Prüfsumme aus Download "$sha1" echo Prüfsumme aus Download "$sha1"
@ -53,7 +75,9 @@ echo "-----------------"
echo "SD-Karte auf die geschrieben 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 "^sd[a-z]*$")
laufwerke[0]="lolo"
laufwerke1[0]="lolo"
else else
exit exit
fi fi
@ -62,11 +86,19 @@ echo Es gibt diese seriellen Blockdevices "${laufwerke[*]}"
echo "SD-Karte auf die geschrieben werden soll EINSCHIEBEN !" \"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 "^sd[a-z]*$")
echo "${laufwerke1[0]}"
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)
zahl_laufwerke="${#laufwerke2[@]}" zahl_laufwerke="${#laufwerke2[@]}"
echo neu erkannte Laufwerke "$zahl_laufwerke"
echo neu erkannte Es gibt jetzt dieses neue serielle Blockdevice: "${laufwerke2[@]}"
echo Laufwerke ${#laufwerke2[@]}
echo lwo:"${laufwerke2[0]}"
echo lw1:"${laufwerke2[1]}"
if [ "$zahl_laufwerke" -eq 1 ]; then if [ "$zahl_laufwerke" -eq 1 ]; then
echo Es gibt jetzt dieses neue serielle Blockdevice: "${laufwerke2[0]}" echo Es gibt jetzt dieses neue serielle Blockdevice: "${laufwerke2[0]}"
else else
@ -80,14 +112,22 @@ echo Ich bin mir SICHER und will auf SD-Karte schreiben : /dev/"${laufwerke2[0]}
read -r endgueltigja read -r endgueltigja
if [ "$endgueltigja" == "y" ]; then if [ "$endgueltigja" == "y" ]; then
# das hier aktivieren --TOTENKOPF--- zum Schreiben
#unzip -p raspi"attribut".zip | dd of=/dev/${laufwerke2[0]} bs=4M conv=fsync status=progress # Wenn die Karte nur als root gemountet werden kann, muss dd durch sudo dd ersetzt werden. umount -> sudo umount
## sudo ddd is now on
# Alternative für Ubuntu:
# echo 'KERNEL=="sd*", SUBSYSTEMS=="usb", MODE="0666"' | sudo tee /etc/udev/rules.d/99-usb-storage.rules
# Quelle : https://askubuntu.com/questions/828545/using-dd-without-sudo
# Wenn die nächsten 3 Zeilen aktiviert sind: "don't blame me!"
#umount /dev/"${laufwerke2[0]}"[0-9] > /dev/null 2>&1
xz --keep --decompress raspi"$attribut".xz
sudo dd if=raspi"$attribut" of=/dev/"${laufwerke2[0]}" bs=4M conv=fsync status=progress || echo "Es gibt Probleme mit Schreibrechten.Ab Zeile 105 gibts Hilfe"
echo "Tatatatah ! fertig" echo "Tatatatah ! fertig"
#umount /dev/"${laufwerke2[0]}"[0-9] > /dev/null 2>&1
else else
exit exit
fi fi
else else
echo "Achtung,Prüfsumme stimmt nicht überein !" echo "Achtung,Prüfsumme stimmt nicht überein !"
fi fi
#http://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2021-05-28/2021-05-07-raspios-buster-armhf-full.zip