mirror of
https://github.com/kevinveenbirkenbach/raspberry-pi-tools.git
synced 2024-11-22 18:11:03 +01:00
Implemented arch versions
This commit is contained in:
parent
c7aa167d06
commit
522631b7bd
@ -1,16 +1,16 @@
|
||||
#!/bin/bash
|
||||
echo "Setupscript fuer 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 "@since 2017-03-12"
|
||||
echo
|
||||
echo
|
||||
if [ `id -u` != 0 ];then
|
||||
echo "Das Script muss als Root aufgerufen werden!"
|
||||
exit 1
|
||||
fi
|
||||
echo "Liste der aktuell gemounteten Geraete:"
|
||||
echo
|
||||
echo
|
||||
ls -lasi /dev/ | grep -E "sd|mm"
|
||||
echo "(Die Liste zeigt nur Geraete an welche auf den Filter passen)"
|
||||
echo
|
||||
@ -19,8 +19,8 @@ while [ \! -b "$ofi" ]
|
||||
echo "Bitte waehlen Sie die korrekte SD-Karte aus:"
|
||||
echo "/dev/:"
|
||||
read device
|
||||
ofi="/dev/$device"
|
||||
done
|
||||
ofi="/dev/$device"
|
||||
done
|
||||
#Pruefen ob der Pfad existiert hinzufuegen
|
||||
while [ "$workingpath" == "" ]
|
||||
do
|
||||
@ -34,33 +34,42 @@ while [ "$workingpath" == "" ]
|
||||
then
|
||||
i=$((${#workingpath}-1)) #Letzte Zeichenstelle ermitteln
|
||||
if [ "${workingpath:$i:1}" != "/" ]
|
||||
then
|
||||
workingpath=$workingpath"/"
|
||||
fi
|
||||
then
|
||||
workingpath=$workingpath"/"
|
||||
fi
|
||||
else
|
||||
echo "Der ausgewaehlte Arbeitspfad existiert nicht."
|
||||
workingpath=""
|
||||
fi
|
||||
|
||||
done
|
||||
echo "Bitte geben Sie ein, für welchen Raspberry das Image aufgespielt werden soll:"
|
||||
read version
|
||||
if [ "$version" == "" ]
|
||||
then
|
||||
version="3"
|
||||
fi
|
||||
echo "Image für RaspberryPi $version wird verwendet..."
|
||||
imagename="ArchLinuxARM-rpi-$version-latest.tar.gz"
|
||||
downloadurl="http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-$version-latest.tar.gz"
|
||||
while [ "$imagepath" == "" ]
|
||||
do
|
||||
echo "Setzen Sie den Imagenamen(Standart:"$workingpath"ArchLinuxARM-rpi-2-latest.tar.gz)"
|
||||
echo "Setzen Sie den Imagenamen(Standart:$workingpath$imagename)"
|
||||
read image
|
||||
if [ "$image" == "" ]
|
||||
then
|
||||
imagepath=$workingpath"ArchLinuxARM-rpi-2-latest.tar.gz"
|
||||
then
|
||||
imagepath=$workingpath$imagename
|
||||
else
|
||||
imagepath=$workingpath$image
|
||||
fi
|
||||
if [ \! -f "$imagepath" ]
|
||||
then
|
||||
then
|
||||
echo "Das ausgewaehlte Image existiert nicht!"
|
||||
#Image ggf. downloaden
|
||||
if [ \! -f "$imagepath" ]
|
||||
then
|
||||
echo "Image wird gedownloadet..."
|
||||
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
|
||||
echo "Image wird gedownloadet..."
|
||||
wget $downloadurl
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -71,7 +80,7 @@ echo "Geben Sie den Nutzer an, von welchem der SSH-Key kopiert werden soll:"
|
||||
read user;
|
||||
|
||||
echo "Die Arbeitsvariablen werden gesetzt..."
|
||||
bootpath=$workingpath"boot"
|
||||
bootpath=$workingpath"boot"
|
||||
rootpath=$workingpath"root"
|
||||
|
||||
ssh_key_source="/home/$user/.ssh/id_rsa.pub"
|
||||
@ -81,7 +90,7 @@ if [ "${ofi:5:1}" != "s" ]
|
||||
then
|
||||
partion="p"
|
||||
else
|
||||
partion=""
|
||||
partion=""
|
||||
fi
|
||||
ofiboot=$ofi$partion"1"
|
||||
ofiroot=$ofi$partion"2"
|
||||
@ -110,7 +119,7 @@ echo "fdisk wird ausgefuehrt..."
|
||||
echo "p" #then p for primary,
|
||||
echo "2" #2 for the second partition on the drive,
|
||||
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.
|
||||
)| fdisk $ofi
|
||||
|
||||
@ -136,7 +145,7 @@ mv -v $rootpath"/boot/"* $bootpath
|
||||
if [ "$user" != "" ] && [ -f "$ssh_key_source" ]
|
||||
then
|
||||
echo "Der SSH-Key wird auf den Raspberry kopiert..."
|
||||
mkdir -v "$rootpath/home/alarm/.ssh"
|
||||
mkdir -v "$rootpath/home/alarm/.ssh"
|
||||
cat "$ssh_key_source" > "$ssh_key_target"
|
||||
chown -R 1000 "$rootpath/home/alarm/.ssh"
|
||||
chmod -R 400 "$rootpath/home/alarm/.ssh"
|
||||
|
Loading…
Reference in New Issue
Block a user