SpectreOS-old/make_arch-pi.sh

45 lines
777 B
Bash
Raw 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
sudo $0
exit 0
fi
fdisk -l
read -p "Geben sie eine Festplatte an: /dev/sda : " device
[[ -z "${device}" ]] && device=/dev/sda
2018-06-04 21:58:56 +02:00
name=spectre_os
2018-02-26 02:41:29 +01:00
arch=armV7
2018-06-04 23:18:59 +02:00
out_dir=out
2018-02-26 02:41:29 +01:00
mkdir -p boot
mkdir -p root
if cat /proc/mounts | grep "$device"1 > /dev/null; then
echo "gemountet"
umount "$device"1
else
echo "nicht gemountet"
fi
if cat /proc/mounts | grep "$device"2 > /dev/null; then
echo "gemountet"
umount "$device"2
else
echo "nicht gemountet"
fi
mount "$device"1 boot
mount "$device"2 root
cp -R boot/* root/boot/
cd root/
mkdir -p ../${out_dir}/
tar -cpf ../${out_dir}/arch-${name}-$(date "+%y.%m.%d")-${arch}.tar.gz *
cd ..
echo "FERTIG!!!"
exit 0