mirror of
https://github.com/kevinveenbirkenbach/raspberry-pi-tools.git
synced 2024-11-26 03:44:44 +01:00
Setup Raspi-Arch-Installionscript fertiggestellt
This commit is contained in:
parent
b7d6c84329
commit
4688da3647
@ -5,17 +5,21 @@ echo
|
|||||||
echo "@author KevinFrantz"
|
echo "@author KevinFrantz"
|
||||||
echo "@since 2017-03-12"
|
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 "Liste der aktuell gemounteten Geraete:"
|
||||||
echo
|
echo
|
||||||
ls -lasi /dev/ | grep "sd"
|
ls -lasi /dev/ | grep "sd"
|
||||||
echo "(Die Liste zeigt nur Geraete an welche auf den Filter /dev/sd* passen)"
|
echo "(Die Liste zeigt nur Geraete an welche auf den Filter /dev/sd* passen)"
|
||||||
echo
|
echo
|
||||||
while [ \! -b "$ifi" ]
|
while [ \! -b "$ofi" ]
|
||||||
do
|
do
|
||||||
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
|
||||||
ifi="/dev/$device"
|
ofi="/dev/$device"
|
||||||
done
|
done
|
||||||
#Pruefen ob der Pfad existiert hinzufuegen
|
#Pruefen ob der Pfad existiert hinzufuegen
|
||||||
while [ "$workingpath" == "" ]
|
while [ "$workingpath" == "" ]
|
||||||
@ -26,10 +30,10 @@ while [ "$workingpath" == "" ]
|
|||||||
then
|
then
|
||||||
workingpath=$(pwd)"/"$workingpath
|
workingpath=$(pwd)"/"$workingpath
|
||||||
fi
|
fi
|
||||||
if [-d "$workingpath" ]
|
if [ -d "$workingpath" ]
|
||||||
then
|
then
|
||||||
i=$((${#workingpath}-1))
|
i=$((${#workingpath}-1)) #Letzte Zeichenstelle ermitteln
|
||||||
if [ "${workingpath:$i:1}" != "/"]
|
if [ "${workingpath:$i:1}" != "/" ]
|
||||||
then
|
then
|
||||||
workingpath=$workingpath"/"
|
workingpath=$workingpath"/"
|
||||||
fi
|
fi
|
||||||
@ -43,39 +47,67 @@ echo "Die Arbeitsvariablen werden gesetzt..."
|
|||||||
imagepath=$workingpath"ArchLinuxARM-rpi-2-latest.tar.gz"
|
imagepath=$workingpath"ArchLinuxARM-rpi-2-latest.tar.gz"
|
||||||
bootpath=$workingpath"boot"
|
bootpath=$workingpath"boot"
|
||||||
rootpath=$workingpath"root"
|
rootpath=$workingpath"root"
|
||||||
|
if [ "${ofi:5:1}" != "s" ]
|
||||||
|
then
|
||||||
|
partion="p"
|
||||||
|
else
|
||||||
|
partion=""
|
||||||
|
fi
|
||||||
|
ofiboot=$ofi$partion"1"
|
||||||
|
ofiroot=$ofi$partion"2"
|
||||||
echo "Arbeitsverzeichnis: $workingpath"
|
echo "Arbeitsverzeichnis: $workingpath"
|
||||||
echo "Rootpath: $rootpath"
|
echo "Rootpath: $rootpath"
|
||||||
echo "Bootpath: $bootpath"
|
echo "Bootpath: $bootpath"
|
||||||
echo "Imagepath: $imagepath"
|
echo "Imagepath: $imagepath"
|
||||||
echo "SD-Karte: $ifi"
|
echo "SD-Karte: $ofi"
|
||||||
|
echo "SD-Karte-Partition 1(boot): $ofiboot"
|
||||||
|
echo "SD-Karte-Partition 2(root): $ofiroot"
|
||||||
echo "Bestaetigen Sie mit der Enter-Taste. Zum Abbruch Ctrl + Alt + C druecken"
|
echo "Bestaetigen Sie mit der Enter-Taste. Zum Abbruch Ctrl + Alt + C druecken"
|
||||||
read bestaetigung
|
read bestaetigung
|
||||||
echo
|
echo "fdisk wird ausgefuehrt..."
|
||||||
echo "Follow this steps:"
|
( echo "o" #Type o. This will clear out any partitions on the drive.
|
||||||
echo "Type o. This will clear out any partitions on the drive."
|
echo "p" #Type p to list partitions. There should be no partitions left
|
||||||
echo "Type p to list partitions. There should be no partitions left."
|
echo "n" #Type n,
|
||||||
echo "Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +100M for the last sector."
|
echo "p" #then p for primary,
|
||||||
echo "Type t, then c to set the first partition to type W95 FAT32 (LBA)."
|
echo "1" #1 for the first partition on the drive,
|
||||||
echo "Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first and last sector."
|
echo "" #press ENTER to accept the default first sector,
|
||||||
echo "Write the partition table and exit by typing w."
|
echo "+100M" #then type +100M for the last sector.
|
||||||
echo "Bestaetigen Sie mit der Enter-Taste. Zum Abbruch Ctrl + Alt + C druecken"
|
echo "t" #Type t,
|
||||||
read bestaetigung
|
echo "c" #then c to set the first partition to type W95 FAT32 (LBA).
|
||||||
fdisk $ifi
|
echo "n" #Type n,
|
||||||
|
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 "w" #Write the partition table and exit by typing w.
|
||||||
|
)| fdisk $ofi
|
||||||
|
|
||||||
|
#Bootpartion formatieren und mounten
|
||||||
echo "Generiere und mounte boot-Partition..."
|
echo "Generiere und mounte boot-Partition..."
|
||||||
mkfs.vfat $ifi"1"
|
mkfs.vfat $ofiboot
|
||||||
mkdir $bootpath
|
mkdir $bootpath
|
||||||
mount $ifi"1" $bootpath
|
mount $ofiboot $bootpath
|
||||||
|
|
||||||
|
#Rootpartition formatieren und mounten
|
||||||
echo "Generiere und mounte root-Partition..."
|
echo "Generiere und mounte root-Partition..."
|
||||||
mkfs.ext4 $ifi"2"
|
mkfs.ext4 $ofiroot
|
||||||
mkdir $rootpath
|
mkdir $rootpath
|
||||||
mount $ifi"2" $rootpath
|
mount $ofiroot $rootpath
|
||||||
if [\! -f "$imagepath" ]
|
|
||||||
|
#Image ggf. downloaden
|
||||||
|
if [ \! -f "$imagepath" ]
|
||||||
then
|
then
|
||||||
|
echo "Image wird gedownloadet..."
|
||||||
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
|
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Die Root-Dateien werden auf die SD-Karte aufgespielt..."
|
||||||
bsdtar -xpf $imagepath -C $rootpath
|
bsdtar -xpf $imagepath -C $rootpath
|
||||||
sync
|
sync
|
||||||
mv $rootpath"/boot/*" $bootpath
|
|
||||||
|
echo "Die Boot-Dateien werden auf die SD-Karte aufgespielt..."
|
||||||
|
mv $rootpath"/boot/"* $bootpath
|
||||||
|
|
||||||
echo "Script rauemt das Verzeichnis auf..."
|
echo "Script rauemt das Verzeichnis auf..."
|
||||||
umount $rootpath $bootpath
|
umount $rootpath $bootpath
|
||||||
rm -r $rootpath
|
rm -r $rootpath
|
||||||
|
Loading…
Reference in New Issue
Block a user