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