SpectreOS-old/arch-installpi-spectre_os.sh

97 lines
1.3 KiB
Bash
Raw Permalink Normal View History

2018-02-26 02:41:29 +01:00
#!/bin/bash
#
set -ex
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
echo "Als root Angemeldet"
fdisk -l
2018-06-04 21:12:44 +02:00
read -p "Wo soll das Image aufgespielt werden?: /dev/sda : " device
[[ -z "${device}" ]] && device=/dev/sda
2018-02-26 02:41:29 +01:00
2018-06-09 08:57:21 +02:00
if [ -f out/arch-spectre_os-*-armV7.tar.pxz ]
2018-02-26 02:41:29 +01:00
then
2018-06-09 08:57:21 +02:00
image=$(find out/arch-spectre_os-*-armV7.tar.pxz)
2018-02-26 02:41:29 +01:00
echo $datei
else
echo "ABGEBROCHEN"
exit 1
fi
2018-06-04 21:12:44 +02:00
echo "device: ${device}"
echo "Image: ${image}"
2018-02-26 02:41:29 +01:00
read -p "Sind alle Angaben Richtig?: [Y/n] " sicherheitsabfrage
if [ "$sicherheitsabfrage" == "n" ]
then
echo "ABGEBROCHEN"
exit 1
fi
if [ -f /usr/bin/pacman ]
then
2018-06-04 21:12:44 +02:00
pacman -S dosfstools wget --needed --noconfirm
2018-02-26 02:41:29 +01:00
else
2018-06-04 21:12:44 +02:00
apt-get install bsdtar dosfstools -y
2018-02-26 02:41:29 +01:00
fi
2018-07-28 19:00:09 +02:00
if cat /proc/mounts | grep ${device}1 > /dev/null; then
2018-02-26 02:41:29 +01:00
echo "gemountet"
2018-07-28 19:00:09 +02:00
umount ${device}1
2018-02-26 02:41:29 +01:00
else
echo "nicht gemountet"
fi
2018-07-28 19:00:09 +02:00
if cat /proc/mounts | grep ${device}2 > /dev/null; then
2018-02-26 02:41:29 +01:00
echo "gemountet"
2018-07-28 19:00:09 +02:00
umount ${device}2
2018-02-26 02:41:29 +01:00
else
echo "nicht gemountet"
fi
2018-07-28 19:00:09 +02:00
fdisk -W always ${device} <<EOT
2018-02-26 02:41:29 +01:00
o
p
n
p
1
+100M
t
c
n
p
2
p
w
EOT
sleep 1
2018-07-28 19:00:09 +02:00
mkfs.vfat ${device}1
2018-02-26 02:41:29 +01:00
mkdir -p boot
2018-07-28 19:00:09 +02:00
mount ${device}1 boot
2018-02-26 02:41:29 +01:00
2018-07-28 19:00:09 +02:00
mkfs.ext4 ${device}2
2018-02-26 02:41:29 +01:00
mkdir -p root
2018-07-28 19:00:09 +02:00
mount ${device}2 root
2018-02-26 02:41:29 +01:00
2018-06-09 08:57:21 +02:00
tar -Ipixz -xpf out/arch-spectre_os-*-armV7.tar.pxz -C root
2018-02-26 02:41:29 +01:00
sync
mv root/boot/* boot
umount boot root
2018-06-09 00:58:13 +02:00
sync
2018-02-26 02:41:29 +01:00
echo "Fertig!!!"