shell-scripte-code/Simon-OS/arch-install

910 lines
29 KiB
Text
Raw Normal View History

2017-11-11 01:18:46 +01:00
#!/bin/bash
#
set -ex
echo "Version: Di 7. Nov 19:17:34 CET 2017"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
echo "Als root Angemeldet"
function minimalinstallation() {
#Mehrzeiler
while read line
do
pacstrap -c -d -G -M ${mountpoint} $line
done < /etc/packages_all.txt
2017-11-11 01:43:12 +01:00
}
function secureumount() {
if [ "${dateisystem}" == "btrfs" ]; then
if cat /proc/mounts | grep ${mountpoint} > /dev/null; then
2017-11-11 14:19:24 +01:00
umount ${mountpoint}/boot
2017-11-11 01:43:12 +01:00
btrfs fi df ${mountpoint}
echo "umount!!!"
umount ${mountpoint}/home
umount ${mountpoint}/opt
umount ${mountpoint}/var/cache/pacman/pkg
umount ${mountpoint}/var/lib
# custom-mounts
for wort in ${mountsnaps}
do
umount ${mountpoint}${wort}
done
2017-11-11 01:55:39 +01:00
umount ${mountpoint}
2017-11-11 01:43:12 +01:00
umount /mnt/btrfs-root
#umount -R /mnt
fi
elif [ "${dateisystem}" == "ext4" ]; then
if cat /proc/mounts | grep ${mountpoint} > /dev/null; then
2017-11-11 14:19:24 +01:00
umount ${mountpoint}/boot
2017-11-11 01:43:12 +01:00
umount ${mountpoint}
fi
fi
2017-11-11 01:18:46 +01:00
}
function partionierenmitswap() {
2017-11-11 01:43:12 +01:00
wipefs -a -f ${device}
sgdisk -o ${device}
sgdisk -a 2048 -n 1::+1024K -c 1:"BIOS Boot Partition" -t 1:ef02 ${device}
sgdisk -a 2048 -n 2::+1G -c 2:"EFI Boot Partition" -t 2:ef00 ${device}
sgdisk -a 2048 -n 3::+8G -c 3:"Linux swap" -t 3:8200 ${device}
sgdisk -a 2048 -n 4:: -c 4:"Linux filesystem" -t 4:8300 ${device}
2017-11-11 01:18:46 +01:00
2017-11-11 02:14:31 +01:00
if [ "${verschluesselung}" == "y" ]; then
2017-11-11 02:48:42 +01:00
echo "Bitte groß YES schreiben"
2017-11-11 02:44:22 +01:00
cryptsetup -c aes-xts-plain64 -y -s 512 luksFormat ${device}${rootpartitionnummer}
2017-11-11 02:26:34 +01:00
cryptsetup luksOpen ${device}${rootpartitionnummer} luks0
2017-11-11 02:44:22 +01:00
deviceluks="/dev/mapper/luks0"
2017-11-11 02:14:31 +01:00
fi
2017-11-11 01:18:46 +01:00
}
function partionierenohneswap() {
2017-11-11 01:43:12 +01:00
wipefs -a -f ${device}
sgdisk -o ${device}
sgdisk -a 2048 -n 1::+1024K -c 1:"BIOS Boot Partition" -t 1:ef02 ${device}
sgdisk -a 2048 -n 2::+1G -c 2:"EFI Boot Partition" -t 2:ef00 ${device}
sgdisk -a 2048 -n 3:: -c 4:"Linux filesystem" -t 3:8300 ${device}
2017-11-11 01:18:46 +01:00
2017-11-11 02:14:31 +01:00
if [ "${verschluesselung}" == "y" ]; then
2017-11-11 02:48:42 +01:00
echo "Bitte groß YES schreiben"
2017-11-11 02:44:22 +01:00
cryptsetup -c aes-xts-plain64 -y -s 512 luksFormat ${device}${rootpartitionnummer}
2017-11-11 02:26:34 +01:00
cryptsetup luksOpen ${device}${rootpartitionnummer} luks0
2017-11-11 02:44:22 +01:00
deviceluks="/dev/mapper/luks0"
2017-11-11 02:14:31 +01:00
fi
2017-11-11 01:18:46 +01:00
}
function usbsecret() {
2017-11-11 01:43:12 +01:00
/usr/bin/curl -v -C - -f https://raw.githubusercontent.com/simono41/Simon-OS/master/install/usbsecret > ${mountpoint}/usr/lib/initcpio/install/usbsecret
/usr/bin/curl -v -C - -f https://raw.githubusercontent.com/simono41/Simon-OS/master/hooks/usbsecret > ${mountpoint}/root/usbsecret
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# hooks
#cp install/usbsecret ${mountpoint}/usr/lib/initcpio/install/usbsecret
#cp hooks/usbsecret ${mountpoint}/usr/lib/initcpio/hooks/usbsecret
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
sed "s|%USB_UUID%|${usbsecretdeviceuuid}|g;" ${mountpoint}/root/usbsecret > ${mountpoint}/usr/lib/initcpio/hooks/usbsecret
2017-11-11 01:18:46 +01:00
}
function cron() {
2017-11-11 01:43:12 +01:00
echo "cron-job snapshot"
mkdir -p ${mountpoint}/var/spool/cron/
echo "0 18 * * * /usr/bin/snapshot make ROOT home opt var/cache/pacman/pkg ${mountsnaps}" > ${mountpoint}/var/spool/cron/root
if [ "${update}" != "n" ]; then
/usr/bin/curl -v -C - -f https://raw.githubusercontent.com/simono41/Simon-OS/master/snapshot.sh > ${mountpoint}/usr/bin/snapshot
chmod 755 ${mountpoint}/usr/bin/snapshot
fi
2017-11-11 01:18:46 +01:00
}
function makeswapfile() {
2017-11-11 01:43:12 +01:00
#swapfile
fallocate -l ${swapfilespeicher} ${mountpoint}/swapfile
chmod 600 ${mountpoint}/swapfile
mkswap ${mountpoint}/swapfile
echo "/swapfile none swap defaults 0 0" >> ${mountpoint}/etc/fstab
2017-11-11 01:18:46 +01:00
}
function makebtrfsswapfile() {
2017-11-11 01:43:12 +01:00
/usr/bin/curl -v -C - -f https://raw.githubusercontent.com/simono41/Simon-OS/master/btrfs-swapon > ${mountpoint}/usr/bin/btrfs-swapon
/usr/bin/curl -v -C - -f https://raw.githubusercontent.com/simono41/Simon-OS/master/btrfs-swapoff > ${mountpoint}/usr/bin/btrfs-swapoff
/usr/bin/curl -v -C - -f https://raw.githubusercontent.com/simono41/Simon-OS/master/btrfs-swapon.service > ${mountpoint}/root/btrfs-swapon.service
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
chmod +x ${mountpoint}/usr/bin/btrfs-swapon
chmod +x ${mountpoint}/usr/bin/btrfs-swapoff
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
sed "s|%swapfilespeicher%|${swapfilespeicher}|g;" ${mountpoint}/root/btrfs-swapon.service > ${mountpoint}/etc/systemd/system/btrfs-swapon.service
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
arch-chroot ${mountpoint} systemctl enable btrfs-swapon
2017-11-11 01:18:46 +01:00
}
function removeinstaller {
2017-11-11 01:43:12 +01:00
echo ""
if [ -f ${mountpoint}/usr/share/applications/arch-install.desktop ]
then
rm ${mountpoint}/usr/share/applications/arch-install.desktop
fi
echo ""
if [ -f ${mountpoint}/root/Schreibtisch/arch-install.desktop ]
then
rm ${mountpoint}/root/Schreibtisch/arch-install.desktop
fi
echo ""
if [ -f ${mountpoint}/home/user/Schreibtisch/arch-install.desktop ]
then
rm ${mountpoint}/home/user/Schreibtisch/arch-install.desktop
fi
echo ""
if [ -f ${mountpoint}/root/Desktop/arch-install.desktop ]
then
rm ${mountpoint}/root/Desktop/arch-install.desktop
fi
echo ""
if [ -f ${mountpoint}/home/user/Desktop/arch-install.desktop ]
then
rm ${mountpoint}/home/user/Desktop/arch-install.desktop
fi
echo ""
2017-11-11 01:18:46 +01:00
}
function installation {
2017-11-11 01:43:12 +01:00
#boot
echo "formatieren"
2017-11-11 14:19:24 +01:00
mkfs.vfat -F 32 ${device}${efipartitionnummer}
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#root
if [ "${dateisystem}" == "btrfs" ]; then
#mkfs.btrfs -f -L p_arch ${device}2
btrfsformat #btrfs
subvolume #btrfs
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
elif [ "${dateisystem}" == "ext4" ]; then
echo "mit j bestätigen"
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
mkfs.ext4 -L p_arch ${deviceluks} #ext4
mount ${deviceluks} ${mountpoint}
else
mkfs.ext4 -L p_arch ${device}${rootpartitionnummer} #ext4
mount ${device}${rootpartitionnummer} ${mountpoint}
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#swap
if [ "${swap}" != "n" ]; then
mkswap -L p_swap ${device}${swappartitionnummer}
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#installation
if [ "${offline}" != "n" ]
then
if [ -f /run/archiso/bootmnt/arch/$(uname -m)/airootfs.sfs ]
2017-11-11 01:18:46 +01:00
then
2017-11-11 01:43:12 +01:00
echo "Es ist kein copytoram System."
unsquashfs -f -d ${mountpoint} /run/archiso/bootmnt/arch/$(uname -m)/airootfs.sfs
2017-11-11 01:18:46 +01:00
else
2017-11-11 01:43:12 +01:00
echo "Es ist ein copytoram System."
unsquashfs -f -d ${mountpoint} /run/archiso/copytoram/airootfs.sfs
2017-11-11 01:18:46 +01:00
fi
2017-11-11 01:43:12 +01:00
else
minimalinstallation
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#kernel
parameter="base udev "
if [ "${swap}" != "n" ]; then
parameter="${parameter}resume "
fi
2017-11-11 02:14:31 +01:00
if [ "${verschluesselung}" == "y" ]; then
parameter="${parameter}encrypt "
fi
2017-11-11 01:43:12 +01:00
parameter="${parameter}block filesystems keyboard "
2017-11-11 14:47:37 +01:00
if [ "${verschluesselung}" == "y" ]; then
echo "btrfs-hook wird übersprungen!"
else
if [ "${dateisystem}" == "btrfs" ]; then
parameter="${parameter}btrfs "
fi
2017-11-11 01:43:12 +01:00
fi
if [ "${usbsecret}" == "y" ]; then
parameter="${parameter}usbsecret "
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
echo ""
echo "MODULES=\"i915 radeon\"" > ${mountpoint}/etc/mkinitcpio.conf
echo "HOOKS=\"${parameter}\"" >> ${mountpoint}/etc/mkinitcpio.conf
echo "COMPRESSION=\"lz4\"" >> ${mountpoint}/etc/mkinitcpio.conf
echo "FILES=\"/etc/modprobe.d/blacklist-floppy.conf\"" >> ${mountpoint}/etc/mkinitcpio.conf
echo ""
echo "blacklist floppy" > ${mountpoint}/etc/modprobe.d/blacklist-floppy.conf
echo ""
#cp /etc/X11/xinit/xinitrc ${mountpoint}/etc/X11/xinit/xinitrc
echo "exec startxfce4" > ${mountpoint}/etc/X11/xinit/xinitrc
#
echo ""
echo "tmpfs /tmp tmpfs defaults 0 0" >> ${mountpoint}/etc/fstab
echo "tmpfs /dev/shm tmpfs defaults 0 0" >> ${mountpoint}/etc/fstab
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#fstab
2017-11-11 14:19:24 +01:00
rootbind=$(blkid -s PARTUUID -o value ${device}${rootpartitionnummer})
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#genfstab -Up ${mountpoint} >> ${mountpoint}/etc/fstab
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
if [ "${dateisystem}" == "btrfs" ]; then
btrfsfstab #btrfs
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
mkdir -p ${mountpoint}/run/btrfs-root
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
2017-11-11 14:19:24 +01:00
echo "${deviceluks} /run/btrfs-root/ btrfs defaults 0 0" >> ${mountpoint}/etc/fstab #btrfs
2017-11-11 03:46:13 +01:00
else
2017-11-11 14:19:24 +01:00
echo "PARTUUID=${rootbind} /run/btrfs-root/ btrfs defaults 0 0" >> ${mountpoint}/etc/fstab #btrfs
2017-11-11 01:43:12 +01:00
fi
#grep -v "/var/lib" < ${mountpoint}/etc/fstab > fstab.neu; mv fstab.neu ${mountpoint}/etc/fstab
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
echo "/run/btrfs-root/__current/ROOT/var/lib /var/lib none bind 0 0" >> ${mountpoint}/etc/fstab #btrfs
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
cron
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
elif [ "${dateisystem}" == "ext4" ]; then
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
2017-11-11 14:19:24 +01:00
echo "${deviceluks} / ext4 rw,defaults,noatime,nodiratime,discard 0 0" >> ${mountpoint}/etc/fstab
2017-11-11 03:46:13 +01:00
else
2017-11-11 14:19:24 +01:00
echo "PARTUUID=${rootbind} / ext4 rw,defaults,noatime,nodiratime,discard 0 0" >> ${mountpoint}/etc/fstab
2017-11-11 01:43:12 +01:00
fi
fi
2017-11-11 01:18:46 +01:00
2017-11-11 14:19:24 +01:00
bootbind=$(blkid -s PARTUUID -o value ${device}${efipartitionnummer})
2017-11-11 01:18:46 +01:00
2017-11-11 14:19:24 +01:00
echo -e "PARTUUID=${bootbind} /boot vfat rw,relatime 0 2" >> ${mountpoint}/etc/fstab
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
if [ "${swap}" != "n" ]; then
2017-11-11 03:54:36 +01:00
if [ "${verschluesselung}" == "y" ]; then
2017-11-11 14:33:13 +01:00
swappartition=$(blkid -s PARTUUID -o value ${device}${swappartitionnummer})
echo "swap PARTUUID=${swappartition} /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256" >> ${mountpoint}/etc/crypttab
2017-11-11 03:54:36 +01:00
else
2017-11-11 14:19:24 +01:00
swappartition=$(blkid -s PARTUUID -o value ${device}${swappartitionnummer})
echo "PARTUUID=${swappartition} none swap defaults 0 0" >> ${mountpoint}/etc/fstab
2017-11-11 01:18:46 +01:00
fi
2017-11-11 01:43:12 +01:00
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#makeswapfile+fstab
if [ "${swapfile}" == "y" ]; then
if [ "${dateisystem}" == "btrfs" ]; then
makebtrfsswapfile
elif [ "${dateisystem}" == "ext4" ]; then
makeswapfile
2017-11-11 01:18:46 +01:00
fi
2017-11-11 01:43:12 +01:00
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#hostname
echo "${name}"s-OS > ${mountpoint}/etc/hostname
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#openvpn
if [ "${openvpn}" != "n" ]; then
arch-chroot ${mountpoint} systemctl enable openvpn-client@client.service
else
arch-chroot ${mountpoint} systemctl disable openvpn-client@client.service
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
if [ "${usbsecret}" == "y" ]; then
usbsecret
fi
2017-11-11 01:18:46 +01:00
2017-11-11 02:14:31 +01:00
if [ "${verschluesselung}" == "y" ]; then
if [ "${boot}" == "grub" ]; then
2017-11-11 14:33:13 +01:00
tobootdevice=$(blkid -s PARTUUID -o value ${device}${rootpartitionnummer})
sed -i 's/GRUB_CMDLINE_LINUX=.*$/GRUB_CMDLINE_LINUX="cryptdevice=PARTUUID='$tobootdevice':luks0"/' ${mountpoint}/etc/default/grub
2017-11-11 03:46:13 +01:00
echo "GRUB_ENABLE_CRYPTODISK=y" >> ${mountpoint}/etc/default/grub
2017-11-11 02:14:31 +01:00
fi
fi
2017-11-11 01:43:12 +01:00
#sie könne hier ihre scripte die bei der installation ausgeführt werden sollen hinzufügen :D
2017-11-11 02:14:31 +01:00
2017-11-11 01:18:46 +01:00
}
function btrfsformat() {
2017-11-11 01:43:12 +01:00
if [ "$raid" == "raid0" ]; then
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
mkfs.btrfs -f -m raid10 -d raid10 ${deviceluks} ${device1}
else
mkfs.btrfs -f -m raid0 -d raid0 ${device}${rootpartitionnummer} ${device1}
fi
2017-11-11 01:43:12 +01:00
elif [ "$raid" == "raid1" ]; then
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
mkfs.btrfs -f -m raid10 -d raid10 ${deviceluks} ${device1}
else
mkfs.btrfs -f -m raid1 -d raid1 ${device}${rootpartitionnummer} ${device1}
fi
2017-11-11 01:43:12 +01:00
elif [ "$raid" == "raid10" ]; then
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
mkfs.btrfs -f -m raid10 -d raid10 ${deviceluks} ${device1}
else
mkfs.btrfs -f -m raid10 -d raid10 ${device}${rootpartitionnummer} ${device1}
fi
2017-11-11 01:43:12 +01:00
else
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
mkfs.btrfs -f -m single ${deviceluks}
else
mkfs.btrfs -f -m single ${device}${rootpartitionnummer}
fi
2017-11-11 02:48:42 +01:00
fi
2017-11-11 01:43:12 +01:00
btrfs filesystem show
2017-11-11 01:18:46 +01:00
}
function btrfsfstab() {
2017-11-11 14:19:24 +01:00
rootbind=$(blkid -s PARTUUID -o value ${device}${rootpartitionnummer})
2017-11-11 01:18:46 +01:00
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
2017-11-11 01:18:46 +01:00
2017-11-11 14:19:24 +01:00
echo -e "${deviceluks} / btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT 0 0" >> ${mountpoint}/etc/fstab
2017-11-11 01:18:46 +01:00
2017-11-11 14:19:24 +01:00
echo -e "${deviceluks} /home btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/home 0 0" >> ${mountpoint}/etc/fstab
echo -e "${deviceluks} /opt btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/opt 0 0" >> ${mountpoint}/etc/fstab
echo -e "${deviceluks} /var/cache/pacman/pkg btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/var/cache/pacman/pkg 0 0" >> ${mountpoint}/etc/fstab
2017-11-11 01:18:46 +01:00
2017-11-11 14:19:24 +01:00
# custom-mounts
for wort in ${mountsnaps}
do
echo -e "${deviceluks} ${wort} btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current${wort} 0 0" >> ${mountpoint}/etc/fstab
done
2017-11-11 01:18:46 +01:00
2017-11-11 03:46:13 +01:00
else
2017-11-11 14:19:24 +01:00
echo -e "PARTUUID=${rootbind} / btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT 0 0" >> ${mountpoint}/etc/fstab
2017-11-11 01:18:46 +01:00
2017-11-11 14:19:24 +01:00
echo -e "PARTUUID=${rootbind} /home btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/home 0 0" >> ${mountpoint}/etc/fstab
echo -e "PARTUUID=${rootbind} /opt btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/opt 0 0" >> ${mountpoint}/etc/fstab
echo -e "PARTUUID=${rootbind} /var/cache/pacman/pkg btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/var/cache/pacman/pkg 0 0" >> ${mountpoint}/etc/fstab
2017-11-11 03:46:13 +01:00
2017-11-11 14:19:24 +01:00
# custom-mounts
for wort in ${mountsnaps}
do
echo -e "PARTUUID=${rootbind} ${wort} btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current${wort} 0 0" >> ${mountpoint}/etc/fstab
done
2017-11-11 03:46:13 +01:00
fi
2017-11-11 01:18:46 +01:00
}
function btrfsmount() {
2017-11-11 01:43:12 +01:00
#[[ -z "${device}" ]] && device=${2}
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
if [ "${1}" == "1" ] || [ "${1}" == "" ]; then
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
mkdir -p /mnt/btrfs-root
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo ${deviceluks} /mnt/btrfs-root
else
mkdir -p /mnt/btrfs-root
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo ${device}${rootpartitionnummer} /mnt/btrfs-root
fi
2017-11-11 02:56:13 +01:00
fi
2017-11-11 01:43:12 +01:00
if [ "${1}" == "2" ] || [ "${1}" == "" ]; then
2017-11-11 03:46:13 +01:00
if [ "${verschluesselung}" == "y" ]; then
mkdir -p ${mountpoint}
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT ${deviceluks} ${mountpoint}
2017-11-11 02:56:13 +01:00
2017-11-11 03:46:13 +01:00
mkdir -p ${mountpoint}/home
mkdir -p ${mountpoint}/opt
mkdir -p ${mountpoint}/var/cache/pacman/pkg
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/home ${deviceluks} ${mountpoint}/home
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/opt ${deviceluks} ${mountpoint}/opt
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/var/cache/pacman/pkg ${deviceluks} ${mountpoint}/var/cache/pacman/pkg
2017-11-11 02:56:13 +01:00
2017-11-11 03:46:13 +01:00
# custom-mounts
for wort in ${mountsnaps}
do
mkdir -p ${mountpoint}${wort}
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current${wort} ${deviceluks} ${mountpoint}${wort}
done
2017-11-11 02:56:13 +01:00
2017-11-11 03:46:13 +01:00
mkdir -p ${mountpoint}/var/lib
mount --bind /mnt/btrfs-root/__current/ROOT/var/lib ${mountpoint}/var/lib
else
mkdir -p ${mountpoint}
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT ${device}${rootpartitionnummer} ${mountpoint}
2017-11-11 01:18:46 +01:00
2017-11-11 03:46:13 +01:00
mkdir -p ${mountpoint}/home
mkdir -p ${mountpoint}/opt
mkdir -p ${mountpoint}/var/cache/pacman/pkg
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/home ${device}${rootpartitionnummer} ${mountpoint}/home
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/opt ${device}${rootpartitionnummer} ${mountpoint}/opt
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/var/cache/pacman/pkg ${device}${rootpartitionnummer} ${mountpoint}/var/cache/pacman/pkg
2017-11-11 01:18:46 +01:00
2017-11-11 03:46:13 +01:00
# custom-mounts
for wort in ${mountsnaps}
do
mkdir -p ${mountpoint}${wort}
mount -o defaults,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current${wort} ${device}${rootpartitionnummer} ${mountpoint}${wort}
done
2017-11-11 01:18:46 +01:00
2017-11-11 03:46:13 +01:00
mkdir -p ${mountpoint}/var/lib
mount --bind /mnt/btrfs-root/__current/ROOT/var/lib ${mountpoint}/var/lib
fi
2017-11-11 01:43:12 +01:00
# boot mount
mkdir -p ${mountpoint}/boot
2017-11-11 14:19:24 +01:00
mount -t vfat ${device}${efipartitionnummer} ${mountpoint}/boot
2017-11-11 01:43:12 +01:00
fi
2017-11-11 01:18:46 +01:00
}
function subvolume() {
2017-11-11 01:43:12 +01:00
# Mount
btrfsmount 1
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# Create
mkdir -p /mnt/btrfs-root/__snapshot
mkdir -p /mnt/btrfs-root/__current
btrfs subvolume create /mnt/btrfs-root/__current/ROOT
btrfs subvolume create /mnt/btrfs-root/__current/home
btrfs subvolume create /mnt/btrfs-root/__current/opt
mkdir -p /mnt/btrfs-root/__current/var/cache/pacman
btrfs subvolume create /mnt/btrfs-root/__current/var/cache/pacman/pkg/
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# custom-mounts
for wort in ${mountsnaps}
do
mkdir -p /mnt/btrfs-root/__current${wort%/*}
btrfs subvolume create /mnt/btrfs-root/__current${wort}
done
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
btrfs subvolume list -p /mnt/btrfs-root
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# Mount
btrfsmount 2
2017-11-11 01:18:46 +01:00
}
function update() {
2017-11-11 01:43:12 +01:00
#statements
local if="${1}"
local of="${2}"
local parameters="${3}"
local before="${4}"
if [ -f "${of}" ]
then
rm ${of}
else
echo "${of} nicht vorhanden!"
fi
/usr/bin/curl -v -C - -f ${if} > ${of}
chmod 755 ${of}
[[ -n "${5}" ]] && of=${5}
${before} ${of} ${parameters}
2017-11-11 01:18:46 +01:00
}
function systemdboot() {
2017-11-11 01:43:12 +01:00
tobootdevice=$(blkid -s PARTUUID -o value ${device}${rootpartitionnummer})
swappartitionpart=$(blkid -s PARTUUID -o value ${device}${swappartitionnummer})
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# zurücksetzen der parameter
parameter=""
2017-11-11 01:18:46 +01:00
2017-11-11 14:47:37 +01:00
if [ "${swap}" != "n" ]; then
2017-11-11 01:43:12 +01:00
parameter="${parameter}resume=PARTUUID=${swappartitionpart} "
fi
2017-11-11 14:19:24 +01:00
if [ "${verschluesselung}" == "y" ]; then
2017-11-11 14:33:13 +01:00
parameter="${parameter}cryptdevice=PARTUUID=${tobootdevice}:luks0 "
2017-11-11 14:19:24 +01:00
fi
2017-11-11 01:43:12 +01:00
if [ "${dateisystem}" == "btrfs" ]; then
parameter="${parameter}rootflags=subvol=__current/ROOT "
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#rootsub=$(btrfs subvolume list /mnt | awk 'NR<0 && NR>2 {print $2}')
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
mkdir -p ${mountpoint}/boot/EFI/systemd/
mkdir -p ${mountpoint}/boot/EFI/BOOT/
cp ${mountpoint}/usr/lib/systemd/boot/efi/systemd-bootx64.efi ${mountpoint}/boot/EFI/systemd/systemd-bootx64.efi
cp ${mountpoint}/usr/lib/systemd/boot/efi/systemd-bootx64.efi ${mountpoint}/boot/EFI/BOOT/BOOTX64.EFI
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
mkdir -p ${mountpoint}/boot/loader/entries/
echo "title "${name}"s-os" > ${mountpoint}/boot/loader/entries/arch-uefi.conf
echo "linux /vmlinuz-linux" >> ${mountpoint}/boot/loader/entries/arch-uefi.conf
echo "initrd /intel-ucode.img" >> ${mountpoint}/boot/loader/entries/arch-uefi.conf
echo "initrd /initramfs-linux.img" >> ${mountpoint}/boot/loader/entries/arch-uefi.conf
echo "options root=PARTUUID=${tobootdevice} rw ${parameter}" >> ${mountpoint}/boot/loader/entries/arch-uefi.conf
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
echo "title "${name}"s-os" > ${mountpoint}/boot/loader/entries/arch-uefi-fallback.conf
echo "linux /vmlinuz-linux" >> ${mountpoint}/boot/loader/entries/arch-uefi-fallback.conf
echo "initrd /intel-ucode.img" >> ${mountpoint}/boot/loader/entries/arch-uefi-fallback.conf
echo "initrd /initramfs-linux-fallback.img" >> ${mountpoint}/boot/loader/entries/arch-uefi-fallback.conf
echo "options root=PARTUUID=${tobootdevice} rw ${parameter}" >> ${mountpoint}/boot/loader/entries/arch-uefi-fallback.conf
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
echo "default arch-uefi" > ${mountpoint}/boot/loader/loader.conf
echo "timeout 1" >> ${mountpoint}/boot/loader/loader.conf
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
if [ "${booteintraege}" != "n" ]; then
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
echo "Zusätzliche Booteinträge werden erstellt!!!"
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
arch-chroot ${mountpoint} efibootmgr -c -d ${device} -p 1 -l /EFI/systemd/systemd-bootx64.efi -L "Linux Boot Manager"
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
arch-chroot ${mountpoint} efibootmgr -c -d ${device} -p 1 -l \vmlinuz-linux -L "Arch Linux efistub" -u "initrd=/initramfs-linux.img root=PARTUUID=${tobootdevice} rw ${parameter}"
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# überschreibt die efistub deswegen entfernt
#arch-chroot ${mountpoint} efibootmgr -c -d ${device} -p 1 -l \vmlinuz-linux -L "Arch Linux fallback efistub" -u "initrd=/initramfs-linux-fallback.img root=PARTUUID=${tobootdevice} rw ${parameter}"
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#arch-chroot ${mountpoint} bootctl install
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
fi
2017-11-11 01:18:46 +01:00
}
function abfrage() {
2017-11-11 01:43:12 +01:00
read -p "Wie heissen sie?: " name
[[ -z "${name}" ]] && name=arch-linux
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# Partionierung
2017-11-11 14:19:24 +01:00
# UEFI oder Legacy-BIOS
2017-11-11 01:43:12 +01:00
echo ""
2017-11-11 14:19:24 +01:00
echo "UEFI = Unified Extensible Firmware Interface"
2017-11-11 01:43:12 +01:00
echo "Empfohlen fuer Neuere PCs"
echo "WICHTIG DAFUER MUESSEN SIE IM BOOTMENUE DEN UEFI USB_STICK AUSGEWAEHLT HABEN SONST KANN KEIN UEFI BOOTEINTRAG ERSTELLT WERDEN!!!"
echo ""
2017-11-11 14:19:24 +01:00
echo "BIOS = basic input/output system"
2017-11-11 01:43:12 +01:00
echo "Empfohlen fuer Alte PCs und portable USB-Sticks"
echo ""
echo "Bitte die Eingaben klein schreiben :D !!!"
echo "Für jedes ja must du ein y machen und für jedes nein ein n ok !!!"
echo ""
if mount | grep efi > /dev/null; then
echo "System unterstützt UEFI"
2017-11-11 14:19:24 +01:00
read -p "Wie moechten sie ihre Festplatte partioniert haben: [UEFI/bios] " Partition
[[ -z "${Partition}" ]] && Partition=uefi
2017-11-11 01:43:12 +01:00
else
echo "System unterstützt kein UEFI"
2017-11-11 14:19:24 +01:00
read -p "Wie moechten sie ihre Festplatte partioniert haben: [uefi/BIOS] " Partition
[[ -z "${Partition}" ]] && Partition=bios
2017-11-11 01:43:12 +01:00
fi
2017-11-11 01:18:46 +01:00
2017-11-11 14:19:24 +01:00
if [ "${Partition}" == "uefi" ]
2017-11-11 01:43:12 +01:00
then
read -p "Soll mit systemd gebootet werden oder mit grub? [systemd/GRUB] : " boot
if [ "${boot}" == "systemd" ]; then
read -p "Sollen noch zusätzliche Booteinträge erstelt werden? [Y/n] : " booteintraege
2017-11-11 01:18:46 +01:00
fi
2017-11-11 01:43:12 +01:00
fi
[[ -z "${boot}" ]] && boot=grub
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
fdisk -l
read -p "Geben sie eine Festplatte an: /dev/sda " device
[[ -z "${device}" ]] && device=/dev/sda
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
read -p "Welches Passwort soll der Root erhalten?: root " pass
[[ -z "${pass}" ]] && pass=root
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
read -p "Welches Dateisystem soll benutzt werden? [BTRFS/ext4] " dateisystem
[[ -z "${dateisystem}" ]] && dateisystem=btrfs
if [ "${dateisystem}" == "btrfs" ]; then
read -p "Soll ein raid gemacht werden?: [raid0/raid1/raid10/n] " raid
[[ -z "${raid}" ]] && raid=n
if [ "${raid}" == "n" ]; then
echo "Kein raid wird erzeugt!"
else
fdisk -l
read -p "Bitte geben sie die Festplatten in eine Reihe an die zu einem Raid verbunden werden sollen!!!: " device1
2017-11-11 01:18:46 +01:00
fi
2017-11-11 01:43:12 +01:00
echo "Standartmässige Snapshots / /home /opt /var/cache/pacman/pkg"
echo "Die Verzeichnisse dürfen sich nicht überlappen sonst kann es zu problemen mit dem unmounten kommen!!!"
read -p "Sollen mehr Snapshots erstellt werden?: " mountsnaps
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
read -p "Wollen sie eine swap-partition erstellen? : [Y/n] " swap
read -p "Wollen sie eine swapfile erstellen? : [y/N] " swapfile
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
if [ "${update}" != "n" ]; then
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
echo "Diese einstellung kann man mit: "
echo "systemctl enable openvpn-client@client.service aktivieren und mit"
echo "systemctl disable openvpn-client@client.service deaktivieren"
echo "Die Bandbreite wird dadurch reduziert aber die Sicherheit deutlich erhöht"
read -p "Soll die Verbindung mit einer VPN verschlüsselt werden? : [Y/n] " openvpn
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
if [ "${update}" != "n" ]; then
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
echo "WARNUNG das System wird nicht verschlüsselt!!!"
echo "WARNUNG ohne den USB-Stick startet das System nicht mehr!!!"
read -p "Soll ein USB-Stick als Schlüssel für das System installiert werden? : [y/N] " usbsecret
if [ "${usbsecret}" == "y" ]; then
read -p "Welcher USB-Stick soll ausgewählt werden für die USB-secret Schlüssel?: /dev/sdb1 " usbsecretdevice
[[ -z "${usbsecretdevice}" ]] && device=/dev/sdb1
2017-11-11 14:33:13 +01:00
usbsecretdeviceuuid=$(blkid -s PARTUUID -o value ${usbsecretdevice})
2017-11-11 01:43:12 +01:00
[[ -z "${usbsecretdeviceuuid}" ]] && mkfs.ext4 ${usbsecretdevice}
2017-11-11 01:18:46 +01:00
fi
2017-11-11 01:43:12 +01:00
fi
2017-11-11 01:18:46 +01:00
2017-11-11 14:47:37 +01:00
if [ "${raid}" == "n" ]; then
read -p "Soll die Festplatte verschlüsselt werden? : [y/N] " verschluesselung
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# berechnungen
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
if [ "${update}" != "n" ] && [ "spectre-os" != "$(cat /etc/hostname)" ]; then
read -p "Soll eine Offline-Installation durchgefuehrt werden? : [Y/n] " offline
if [ "${offline}" != "n" ]
then
2017-11-11 01:18:46 +01:00
install="offline"
2017-11-11 01:43:12 +01:00
else
install="online"
2017-11-11 01:18:46 +01:00
fi
2017-11-11 01:43:12 +01:00
else
install="offline"
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# Dateisystem
if [ "${dateisystem}" == "btrfs" ]; then
mountpoint="/mnt/btrfs-current"
elif [ "${dateisystem}" == "ext4" ]; then
mountpoint="/mnt"
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
#
echo "Name: ${name}"
echo "Partionsart: ${Partition}"
echo "Bootloader: ${boot}"
echo "Laufwerk: ${device}"
if [ "${raid}" != "n" ]; then
echo "Raid: ${raid}"
echo "Festplatten: ${device1}"
fi
echo "Dateisystem: ${dateisystem}"
2017-11-11 02:14:31 +01:00
#echo "System-Partition ${speicher}"
#if [ "${swap}" != "n" ]; then
# echo "Swap-partition ${swapspeicher}"
#fi
#if [ "${swapfile}" == "y" ]; then
# echo "Swapfile ${swapfilespeicher}"
#fi
2017-11-11 01:43:12 +01:00
echo "Rootpasswort: ${pass}"
echo "Architektur: $(uname -m)"
echo "Installation: ${install}"
if [ "${dateisystem}" == "btrfs" ]; then
for wort in ${mountsnaps}
do
echo "Snapshot ${wort} wird erstellt!!!"
done
fi
if [ "${openvpn}" != "n" ]; then
echo "VPN-Verschlüsselung: aktiv"
fi
if [ "${usbsecret}" == "y" ]; then
echo "USB-secret: aktiv"
echo "USB-UIDD: ${usbsecretdeviceuuid}"
echo "USB-Label: ${usbsecretdevice}"
fi
2017-11-11 02:14:31 +01:00
if [ "${verschluesselung}" == "y" ]; then
echo "Fesptplatte mit Luks 512KB verschlüsselung: aktiv"
fi
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
# Partitionierung
2017-11-11 01:18:46 +01:00
2017-11-11 01:43:12 +01:00
if [ "${dateisystem}" == "btrfs" ]; then
2017-11-11 14:19:24 +01:00
if [ "${Partition}" == "uefi" ]; then
2017-11-11 01:43:12 +01:00
bootpartitionnummer=1
efipartitionnummer=2
rootpartitionnummer=3
if [ "${swap}" != "n" ]; then
swappartitionnummer=3
rootpartitionnummer=4
2017-11-11 01:18:46 +01:00
fi
2017-11-11 14:19:24 +01:00
elif [ "${Partition}" == "bios" ]; then
2017-11-11 01:43:12 +01:00
bootpartitionnummer=1
efipartitionnummer=2
rootpartitionnummer=3
if [ "${swap}" != "n" ]; then
swappartitionnummer=3
rootpartitionnummer=4
2017-11-11 01:18:46 +01:00
fi
fi
2017-11-11 01:43:12 +01:00
elif [ "${dateisystem}" == "ext4" ]; then
2017-11-11 14:19:24 +01:00
if [ "${Partition}" == "uefi" ]; then
2017-11-11 01:43:12 +01:00
bootpartitionnummer=1
efipartitionnummer=2
rootpartitionnummer=3
if [ "${swap}" != "n" ]; then
swappartitionnummer=3
rootpartitionnummer=4
fi
2017-11-11 14:19:24 +01:00
elif [ "${Partition}" == "bios" ]; then
2017-11-11 01:43:12 +01:00
bootpartitionnummer=1
efipartitionnummer=2
rootpartitionnummer=3
if [ "${swap}" != "n" ]; then
swappartitionnummer=3
rootpartitionnummer=4
2017-11-11 01:18:46 +01:00
fi
fi
2017-11-11 01:43:12 +01:00
fi
echo "Boot-Partition = ${device}${bootpartitionnummer}"
echo "EFI-Partition = ${device}${efipartitionnummer}"
echo "Swap-Partition = ${device}${swappartitionnummer}"
echo "ROOT-Partition = ${device}${rootpartitionnummer}"
#
read -p "Sind alle Angaben Richtig?: [y/N] " sicherheitsabfrage
if [ "$sicherheitsabfrage" != "y" ]
then
echo "ABGEBROCHEN"
exit 1
fi
if [ "${update}" != "n" ] && [ "spectre-os" != "$(cat /etc/hostname)" ]; then
echo "Nur für reine arch-linux systeme benötigend!!!"
read -p "Sollen noch wichtige Packete für die installation installiert werden? [y/N] " packete
if [ "${packete}" == "y" ]; then
pacman -Syu base base-devel syslinux efibootmgr efitools grub intel-ucode os-prober btrfs-progs dosfstools arch-install-scripts xorriso cdrtools squashfs-tools wget dosfstools btrfs-progs gdisk dialog bash-completion git iw wireless_tools wpa_supplicant
fi
fi
echo "Betriebssystem wird installiert!!!"
sleep 5
2017-11-11 01:18:46 +01:00
}
if [ "${1}" != "n" ]
then
2017-11-11 01:43:12 +01:00
read -p "Soll im Internet geguckt werden ob es ein neues Install-Script gibt und dann ausgefuehrt werden?: [Y/n] " update
if [ "${update}" == "debug" ]
then
echo "Überspringe das herunterladen einen neuen Scriptes!!!"
else
if [ "${update}" != "n" ]
2017-11-11 01:18:46 +01:00
then
2017-11-11 01:43:12 +01:00
update https://raw.githubusercontent.com/simono41/Simon-OS/master/arch-install /root/arch-install.new n
exit 0
2017-11-11 01:18:46 +01:00
fi
fi
2017-11-11 14:19:24 +01:00
fi
2017-11-11 01:18:46 +01:00
# debug = Installation überspringen zu arch-graphical-install und DEBEUG-MODUS
abfrage
2017-11-11 01:43:12 +01:00
secureumount
2017-11-11 01:18:46 +01:00
2017-11-11 02:56:13 +01:00
if [ "${name}" == "debug" ]
then
2017-11-11 14:19:24 +01:00
echo "DEBEUG-MODUS"
echo "Wenn kein befehl mehr ausgefuehrt werden muss einfach eingabetaste druecken"
echo "Welcher befehl soll ausgefuert werden? "
2017-11-11 02:56:13 +01:00
2017-11-11 14:19:24 +01:00
befehl=blablabla
while [ "$befehl" != "" ]
do
read -p "" befehl
$befehl
done
2017-11-11 02:56:13 +01:00
2017-11-11 01:43:12 +01:00
fi
#
echo "Eine Säuberung erhört die chance der Installation auf dem System."
echo "Es kann eine Zeit lang dauern!"
dd if=/dev/zero of=${device} bs=64M count=10 status=progress
#
2017-11-11 14:19:24 +01:00
if [ "${Partition}" == "uefi" ]
2017-11-11 01:43:12 +01:00
then
2017-11-11 14:19:24 +01:00
echo "Partioniere mit UEFI"
2017-11-11 01:43:12 +01:00
if [ "${swap}" != "n" ]; then
2017-11-11 01:55:39 +01:00
echo "Erstelle zustzliche swap-partition"
partionierenmitswap
2017-11-11 01:43:12 +01:00
else
2017-11-11 01:55:39 +01:00
partionierenohneswap
2017-11-11 01:43:12 +01:00
fi
echo "installation"
installation
arch-chroot ${mountpoint} /bin/bash <<EOT
2017-11-11 01:18:46 +01:00
mkinitcpio -p linux
passwd
${pass}
${pass}
EOT
2017-11-11 01:43:12 +01:00
echo ""
if [ "${boot}" == "grub" ]
then
2017-11-11 01:55:39 +01:00
arch-chroot ${mountpoint} /bin/bash <<EOT
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="${name}"s-os --recheck
grub-mkconfig -o /boot/grub/grub.cfg
2017-11-11 01:18:46 +01:00
EOT
2017-11-11 01:43:12 +01:00
else
2017-11-11 01:55:39 +01:00
systemdboot
2017-11-11 01:43:12 +01:00
fi
removeinstaller
echo "Fertig"
2017-11-11 14:19:24 +01:00
elif [ "${Partition}" == "bios" ]; then
echo "Partioniere mit bios"
2017-11-11 01:43:12 +01:00
if [ "${swap}" != "n" ]; then
2017-11-11 01:55:39 +01:00
echo "Erstelle zustzliche swap-partition"
partionierenmitswap
2017-11-11 01:43:12 +01:00
else
2017-11-11 01:55:39 +01:00
partionierenohneswap
2017-11-11 01:43:12 +01:00
fi
echo "installation"
installation
arch-chroot ${mountpoint} /bin/bash <<EOT
2017-11-11 01:18:46 +01:00
mkinitcpio -p linux
passwd
${pass}
${pass}
grub-install --target=i386-pc --recheck ${device}
grub-mkconfig -o /boot/grub/grub.cfg
EOT
2017-11-11 01:43:12 +01:00
removeinstaller
echo "Fertig"
else
echo "Eingabe Ungueltig"
exit 1
fi
2017-11-11 01:18:46 +01:00
if [ "${update}" != "n" ] && [ "spectre-os" != "$(cat /etc/hostname)" ]; then
2017-11-11 01:43:12 +01:00
read -p "Soll die erweiterte Installation durchgeführt werden? [Y/n] " graphical
if [ "$graphical" != "n" ]
then
2017-11-11 01:55:39 +01:00
update https://raw.githubusercontent.com/simono41/Simon-OS/master/arch-graphical-install ${mountpoint}/root/arch-graphical-install "n" "arch-chroot ${mountpoint}" /root/arch-graphical-install
2017-11-11 01:43:12 +01:00
fi
2017-11-11 01:18:46 +01:00
fi
echo "df!!!"
2017-11-11 02:56:13 +01:00
df -h
2017-11-11 01:18:46 +01:00
if [ "${dateisystem}" == "btrfs" ]; then
2017-11-11 01:43:12 +01:00
btrfs filesystem df ${mountpoint}
2017-11-11 01:18:46 +01:00
fi
2017-11-11 01:43:12 +01:00
echo "umount!!!"
2017-11-11 03:46:13 +01:00
sleep 5
2017-11-11 01:43:12 +01:00
secureumount
2017-11-11 01:18:46 +01:00
echo ""
echo "Fertig!!!"
read -p "Installation erfolgreich Abgeschlossen. Wollen sie den PC NEUSTARTEN?: [Y/n] " sicherheitsabfrage
if [ "$sicherheitsabfrage" != "n" ]
then
echo "starte neu"
reboot
fi
exit 0