mirror of
https://github.com/kevinveenbirkenbach/raspberry-pi-tools.git
synced 2024-11-22 10:01:04 +01:00
In between commit implementing moode, retropie, arch
This commit is contained in:
parent
fc4a54e3af
commit
8ec630053d
@ -1,27 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Setupscript fuer Raspberry Pi SD's"
|
echo "Setupscript for Raspberry Pi SD's"
|
||||||
echo "Dieses Script muss aus dem Ordner aufgerufen werden, in welchem ArchLinuxARM-rpi-2-latest.tar.gz liegt"
|
|
||||||
echo
|
echo
|
||||||
echo "@author KevinFrantz"
|
echo "@author Kevin Veen-Birkenbach [kevin@veen.world]"
|
||||||
echo "@since 2017-03-12"
|
echo "@since 2017-03-12"
|
||||||
echo
|
echo
|
||||||
if [ `id -u` != 0 ];then
|
echo "The images will be stored in /home/\$username/images/."
|
||||||
echo "Das Script muss als Root aufgerufen werden!"
|
tmp_folder="/tmp/raspberry-pi-tools-$(date +%s)";
|
||||||
exit 1
|
echo "Create temporary working folder in $tmp_folder";
|
||||||
|
if [ $(id -u) != 0 ];then
|
||||||
|
echo "This script must be executed as root!" && exit 1
|
||||||
fi
|
fi
|
||||||
echo "Liste der aktuell gemounteten Geraete:"
|
echo "Please type in the username from which the SSH-Key should be copied:"
|
||||||
|
read username;
|
||||||
|
image_folder="/home/$username/images/";
|
||||||
|
echo "List of actual mounted devices:"
|
||||||
echo
|
echo
|
||||||
ls -lasi /dev/ | grep -E "sd|mm"
|
ls -lasi /dev/ | grep -E "sd|mm"
|
||||||
echo "(Die Liste zeigt nur Geraete an welche auf den Filter passen)"
|
|
||||||
echo
|
echo
|
||||||
while [ \! -b "$ofi" ]
|
while [ \! -b "$ofi" ]
|
||||||
do
|
do
|
||||||
echo "Bitte waehlen Sie die korrekte SD-Karte aus:"
|
echo "Please select the correct SD-Card."
|
||||||
echo "/dev/:"
|
echo "/dev/:"
|
||||||
read device
|
read device
|
||||||
ofi="/dev/$device"
|
ofi="/dev/$device"
|
||||||
done
|
done
|
||||||
#Pruefen ob der Pfad existiert hinzufuegen
|
|
||||||
while [ "$workingpath" == "" ]
|
while [ "$workingpath" == "" ]
|
||||||
do
|
do
|
||||||
echo "Bitte waehlen Sie den Arbeitspfad zu $(pwd) aus:"
|
echo "Bitte waehlen Sie den Arbeitspfad zu $(pwd) aus:"
|
||||||
@ -43,15 +45,62 @@ while [ "$workingpath" == "" ]
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
echo "Bitte geben Sie ein, für welchen Raspberry das Image aufgespielt werden soll:"
|
echo "Which raspberry pi version do you want to use?"
|
||||||
read version
|
read version
|
||||||
if [ "$version" == "" ]
|
echo "Image for RaspberryPi $version will be used..."
|
||||||
then
|
echo "Which OS do you want to use?"
|
||||||
version="3"
|
echo "1) arch"
|
||||||
fi
|
echo "2) moode"
|
||||||
echo "Image für RaspberryPi $version wird verwendet..."
|
echo "3) retropie"
|
||||||
imagename="ArchLinuxARM-rpi-$version-latest.tar.gz"
|
echo "Please type in the os:"
|
||||||
downloadurl="http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-$version-latest.tar.gz"
|
read os
|
||||||
|
case "$os" in
|
||||||
|
"arch")
|
||||||
|
base_download_url="http://os.archlinuxarm.org/os/";
|
||||||
|
case "$version" in
|
||||||
|
"1")
|
||||||
|
imagename="ArchLinuxARM-rpi-latest.tar.gz"
|
||||||
|
;;
|
||||||
|
"2" | "3")
|
||||||
|
imagename="ArchLinuxARM-rpi-2-latest.tar.gz"
|
||||||
|
;;
|
||||||
|
"4")
|
||||||
|
imagename="ArchLinuxARM-rpi-4-latest.tar.gz"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ArchLinux for RaspberryPi Version $version is not supported!" && exit 1;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
downloadurl="http://os.archlinuxarm.org/os/$imagename"
|
||||||
|
;;
|
||||||
|
"moode")
|
||||||
|
imagename="moode-r651-iso.zip";
|
||||||
|
downloadurl="https://github.com/moode-player/moode/releases/download/r651prod/moode-r651-iso.zip";
|
||||||
|
;;
|
||||||
|
"retropie")
|
||||||
|
base_download_url="https://github.com/RetroPie/RetroPie-Setup/releases/download/4.6/";
|
||||||
|
case "$version" in
|
||||||
|
"1")
|
||||||
|
imagename="retropie-buster-4.6-rpi1_zero.img.gz"
|
||||||
|
;;
|
||||||
|
|
||||||
|
"2" | "3")
|
||||||
|
imagename="retropie-buster-4.6-rpi2_rpi3.img.gz"
|
||||||
|
;;
|
||||||
|
|
||||||
|
"4")
|
||||||
|
imagename="retropie-buster-4.6-rpi4.img.gz"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "RetroPie for RaspberryPi Version $version is not supported!" && exit 1;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
downloadurl="$base_download_url$imagename"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "The operation system \"$os\" is not supported yet!" && exit 1;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
while [ "$imagepath" == "" ]
|
while [ "$imagepath" == "" ]
|
||||||
do
|
do
|
||||||
echo "Setzen Sie den Imagenamen(Standart:$workingpath$imagename)"
|
echo "Setzen Sie den Imagenamen(Standart:$workingpath$imagename)"
|
||||||
@ -75,10 +124,6 @@ while [ "$imagepath" == "" ]
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
#Nutzer definieren
|
|
||||||
echo "Geben Sie den Nutzer an, von welchem der SSH-Key kopiert werden soll:"
|
|
||||||
read user;
|
|
||||||
|
|
||||||
echo "Die Arbeitsvariablen werden gesetzt..."
|
echo "Die Arbeitsvariablen werden gesetzt..."
|
||||||
bootpath=$workingpath"boot"
|
bootpath=$workingpath"boot"
|
||||||
rootpath=$workingpath"root"
|
rootpath=$workingpath"root"
|
||||||
@ -121,26 +166,26 @@ echo "fdisk wird ausgefuehrt..."
|
|||||||
echo "" #and then press ENTER twice to accept the default first and last sector.
|
echo "" #and then press ENTER twice to accept the default first and last sector.
|
||||||
echo ""
|
echo ""
|
||||||
echo "w" #Write the partition table and exit by typing w.
|
echo "w" #Write the partition table and exit by typing w.
|
||||||
)| fdisk $ofi
|
)| fdisk "$ofi"
|
||||||
|
|
||||||
#Bootpartion formatieren und mounten
|
#Bootpartion formatieren und mounten
|
||||||
echo "Generiere und mounte boot-Partition..."
|
echo "Generiere und mounte boot-Partition..."
|
||||||
mkfs.vfat $ofiboot
|
mkfs.vfat "$ofiboot"
|
||||||
mkdir $bootpath
|
mkdir "$bootpath"
|
||||||
mount $ofiboot $bootpath
|
mount "$ofiboot" "$bootpath"
|
||||||
|
|
||||||
#Rootpartition formatieren und mounten
|
#Rootpartition formatieren und mounten
|
||||||
echo "Generiere und mounte root-Partition..."
|
echo "Generiere und mounte root-Partition..."
|
||||||
mkfs.ext4 $ofiroot
|
mkfs.ext4 "$ofiroot"
|
||||||
mkdir $rootpath
|
mkdir "$rootpath"
|
||||||
mount $ofiroot $rootpath
|
mount "$ofiroot" "$rootpath"
|
||||||
|
|
||||||
echo "Die Root-Dateien werden auf die SD-Karte aufgespielt..."
|
echo "Die Root-Dateien werden auf die SD-Karte aufgespielt..."
|
||||||
bsdtar -xpf $imagepath -C $rootpath
|
bsdtar -xpf "$imagepath" -C "$rootpath"
|
||||||
sync
|
sync
|
||||||
|
|
||||||
echo "Die Boot-Dateien werden auf die SD-Karte aufgespielt..."
|
echo "Die Boot-Dateien werden auf die SD-Karte aufgespielt..."
|
||||||
mv -v $rootpath"/boot/"* $bootpath
|
mv -v $rootpath"/boot/"* "$bootpath"
|
||||||
|
|
||||||
if [ "$user" != "" ] && [ -f "$ssh_key_source" ]
|
if [ "$user" != "" ] && [ -f "$ssh_key_source" ]
|
||||||
then
|
then
|
||||||
@ -154,6 +199,6 @@ if [ "$user" != "" ] && [ -f "$ssh_key_source" ]
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Script rauemt das Verzeichnis auf..."
|
echo "Script rauemt das Verzeichnis auf..."
|
||||||
umount $rootpath $bootpath
|
umount "$rootpath" "$bootpath"
|
||||||
rm -r $rootpath
|
rm -r "$rootpath"
|
||||||
rm -r $bootpath
|
rm -r "$bootpath"
|
Loading…
Reference in New Issue
Block a user