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-27 01:54:37 +02:00
|
|
|
if [ "${device}" == "/dev/mmcblk0" ]; then
|
|
|
|
m2ssddevice=p
|
|
|
|
fi
|
|
|
|
|
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
|
|
|
|
|
2018-06-27 01:54:37 +02:00
|
|
|
if cat /proc/mounts | grep ${device}${m2ssddevice}1 > /dev/null; then
|
2018-02-26 02:41:29 +01:00
|
|
|
echo "gemountet"
|
2018-06-27 01:54:37 +02:00
|
|
|
umount ${device}${m2ssddevice}1
|
2018-02-26 02:41:29 +01:00
|
|
|
else
|
|
|
|
echo "nicht gemountet"
|
|
|
|
fi
|
|
|
|
|
2018-06-27 01:54:37 +02:00
|
|
|
if cat /proc/mounts | grep ${device}${m2ssddevice}2 > /dev/null; then
|
2018-02-26 02:41:29 +01:00
|
|
|
echo "gemountet"
|
2018-06-27 01:54:37 +02:00
|
|
|
umount ${device}${m2ssddevice}2
|
2018-02-26 02:41:29 +01:00
|
|
|
else
|
|
|
|
echo "nicht gemountet"
|
|
|
|
fi
|
|
|
|
|
2018-06-27 01:54:37 +02:00
|
|
|
mount ${device}${m2ssddevice}1 boot
|
|
|
|
mount ${device}${m2ssddevice}2 root
|
2018-02-26 02:41:29 +01:00
|
|
|
|
|
|
|
cp -R boot/* root/boot/
|
|
|
|
|
|
|
|
cd root/
|
|
|
|
mkdir -p ../${out_dir}/
|
2018-06-09 00:48:53 +02:00
|
|
|
tar -Ipixz -cpf ../${out_dir}/arch-${name}-$(date "+%y.%m.%d")-${arch}.tar.pxz *
|
2018-02-26 02:41:29 +01:00
|
|
|
cd ..
|
2018-06-09 00:58:13 +02:00
|
|
|
|
|
|
|
umount boot root
|
|
|
|
|
|
|
|
sync
|
|
|
|
|
2018-02-26 02:41:29 +01:00
|
|
|
echo "FERTIG!!!"
|
|
|
|
exit 0
|