This commit is contained in:
simono41 2017-11-11 14:19:24 +01:00
parent 54aba595a1
commit 311ef23173

View file

@ -22,9 +22,7 @@ function minimalinstallation() {
function secureumount() { function secureumount() {
if [ "${dateisystem}" == "btrfs" ]; then if [ "${dateisystem}" == "btrfs" ]; then
if cat /proc/mounts | grep ${mountpoint} > /dev/null; then if cat /proc/mounts | grep ${mountpoint} > /dev/null; then
if [ "${Partition}" == "gpt" ]; then
umount ${mountpoint}/boot umount ${mountpoint}/boot
fi
btrfs fi df ${mountpoint} btrfs fi df ${mountpoint}
echo "umount!!!" echo "umount!!!"
umount ${mountpoint}/home umount ${mountpoint}/home
@ -42,9 +40,7 @@ function secureumount() {
fi fi
elif [ "${dateisystem}" == "ext4" ]; then elif [ "${dateisystem}" == "ext4" ]; then
if cat /proc/mounts | grep ${mountpoint} > /dev/null; then if cat /proc/mounts | grep ${mountpoint} > /dev/null; then
if [ "${Partition}" == "gpt" ]; then
umount ${mountpoint}/boot umount ${mountpoint}/boot
fi
umount ${mountpoint} umount ${mountpoint}
fi fi
fi fi
@ -163,15 +159,9 @@ echo ""
function installation { function installation {
#boot
#root
#swap
#boot #boot
echo "formatieren" echo "formatieren"
if [ "${Partition}" == "gpt" ]; then mkfs.vfat -F 32 ${device}${efipartitionnummer}
mkfs.vfat -F 32 ${device}${bootpartitionnummer}
fi
#root #root
if [ "${dateisystem}" == "btrfs" ]; then if [ "${dateisystem}" == "btrfs" ]; then
@ -243,11 +233,7 @@ echo "tmpfs /tmp tmpfs defaults 0 0" >> ${mountpoint}/etc/fstab
echo "tmpfs /dev/shm tmpfs defaults 0 0" >> ${mountpoint}/etc/fstab echo "tmpfs /dev/shm tmpfs defaults 0 0" >> ${mountpoint}/etc/fstab
#fstab #fstab
if [ "${Partition}" == "gpt" ]; then
rootbind=$(blkid -s PARTUUID -o value ${device}${rootpartitionnummer}) rootbind=$(blkid -s PARTUUID -o value ${device}${rootpartitionnummer})
elif [ "${Partition}" == "mbr" ]; then
rootbind=$(blkid -s UUID -o value ${device}${rootpartitionnummer})
fi
#genfstab -Up ${mountpoint} >> ${mountpoint}/etc/fstab #genfstab -Up ${mountpoint} >> ${mountpoint}/etc/fstab
@ -256,17 +242,9 @@ if [ "${dateisystem}" == "btrfs" ]; then
mkdir -p ${mountpoint}/run/btrfs-root mkdir -p ${mountpoint}/run/btrfs-root
if [ "${verschluesselung}" == "y" ]; then if [ "${verschluesselung}" == "y" ]; then
if [ "${Partition}" == "gpt" ]; then
echo "${deviceluks} /run/btrfs-root/ btrfs defaults 0 0" >> ${mountpoint}/etc/fstab #btrfs echo "${deviceluks} /run/btrfs-root/ btrfs defaults 0 0" >> ${mountpoint}/etc/fstab #btrfs
elif [ "${Partition}" == "mbr" ]; then
echo "${deviceluks} /run/btrfs-root/ btrfs defaults 0 0" >> ${mountpoint}/etc/fstab #btrfs
fi
else else
if [ "${Partition}" == "gpt" ]; then
echo "PARTUUID=${rootbind} /run/btrfs-root/ btrfs defaults 0 0" >> ${mountpoint}/etc/fstab #btrfs echo "PARTUUID=${rootbind} /run/btrfs-root/ btrfs defaults 0 0" >> ${mountpoint}/etc/fstab #btrfs
elif [ "${Partition}" == "mbr" ]; then
echo "UUID=${rootbind} /run/btrfs-root/ btrfs defaults 0 0" >> ${mountpoint}/etc/fstab #btrfs
fi
fi fi
#grep -v "/var/lib" < ${mountpoint}/etc/fstab > fstab.neu; mv fstab.neu ${mountpoint}/etc/fstab #grep -v "/var/lib" < ${mountpoint}/etc/fstab > fstab.neu; mv fstab.neu ${mountpoint}/etc/fstab
@ -276,40 +254,25 @@ if [ "${dateisystem}" == "btrfs" ]; then
elif [ "${dateisystem}" == "ext4" ]; then elif [ "${dateisystem}" == "ext4" ]; then
if [ "${verschluesselung}" == "y" ]; then if [ "${verschluesselung}" == "y" ]; then
if [ "${Partition}" == "gpt" ]; then
echo "${deviceluks} / ext4 rw,defaults,noatime,nodiratime,discard 0 0" >> ${mountpoint}/etc/fstab echo "${deviceluks} / ext4 rw,defaults,noatime,nodiratime,discard 0 0" >> ${mountpoint}/etc/fstab
elif [ "${Partition}" == "mbr" ]; then
echo "${deviceluks} / ext4 rw,defaults,noatime,nodiratime,discard 0 0" >> ${mountpoint}/etc/fstab
fi
else else
if [ "${Partition}" == "gpt" ]; then
echo "PARTUUID=${rootbind} / ext4 rw,defaults,noatime,nodiratime,discard 0 0" >> ${mountpoint}/etc/fstab echo "PARTUUID=${rootbind} / ext4 rw,defaults,noatime,nodiratime,discard 0 0" >> ${mountpoint}/etc/fstab
elif [ "${Partition}" == "mbr" ]; then
echo "UUID=${rootbind} / ext4 rw,defaults,noatime,nodiratime,discard 0 0" >> ${mountpoint}/etc/fstab
fi
fi fi
fi fi
if [ "${Partition}" == "gpt" ]; then
bootbind=$(blkid -s PARTUUID -o value ${device}${bootpartitionnummer}) bootbind=$(blkid -s PARTUUID -o value ${device}${efipartitionnummer})
echo -e "PARTUUID=${bootbind} /boot vfat rw,relatime 0 2" >> ${mountpoint}/etc/fstab echo -e "PARTUUID=${bootbind} /boot vfat rw,relatime 0 2" >> ${mountpoint}/etc/fstab
fi
if [ "${swap}" != "n" ]; then if [ "${swap}" != "n" ]; then
if [ "${verschluesselung}" == "y" ]; then if [ "${verschluesselung}" == "y" ]; then
swappartition=$(blkid -s UUID -o value ${device}${swappartitionnummer}) swappartition=$(blkid -s UUID -o value ${device}${swappartitionnummer})
echo "swap UUID=${swappartition} /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256" >> ${mountpoint}/etc/crypttab echo "swap UUID=${swappartition} /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256" >> ${mountpoint}/etc/crypttab
else else
if [ "${Partition}" == "gpt" ]; then
swappartition=$(blkid -s PARTUUID -o value ${device}${swappartitionnummer}) swappartition=$(blkid -s PARTUUID -o value ${device}${swappartitionnummer})
echo "PARTUUID=${swappartition} none swap defaults 0 0" >> ${mountpoint}/etc/fstab echo "PARTUUID=${swappartition} none swap defaults 0 0" >> ${mountpoint}/etc/fstab
elif [ "${Partition}" == "mbr" ]; then
swappartition=$(blkid -s UUID -o value ${device}${swappartitionnummer})
echo "UUID=${swappartition} none swap defaults 0 0" >> ${mountpoint}/etc/fstab
fi
fi fi
fi fi
@ -396,15 +359,10 @@ btrfs filesystem show
function btrfsfstab() { function btrfsfstab() {
if [ "${Partition}" == "gpt" ]; then
rootbind=$(blkid -s PARTUUID -o value ${device}${rootpartitionnummer}) rootbind=$(blkid -s PARTUUID -o value ${device}${rootpartitionnummer})
elif [ "${Partition}" == "mbr" ]; then
rootbind=$(blkid -s UUID -o value ${device}${rootpartitionnummer})
fi
if [ "${verschluesselung}" == "y" ]; then if [ "${verschluesselung}" == "y" ]; then
if [ "${Partition}" == "gpt" ]; then
echo -e "${deviceluks} / btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT 0 0" >> ${mountpoint}/etc/fstab echo -e "${deviceluks} / btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT 0 0" >> ${mountpoint}/etc/fstab
@ -419,25 +377,8 @@ if [ "${verschluesselung}" == "y" ]; then
done done
elif [ "${Partition}" == "mbr" ]; then
echo -e "${deviceluks} / btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT 0 0" >> ${mountpoint}/etc/fstab
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
# 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
fi
else else
if [ "${Partition}" == "gpt" ]; then
echo -e "PARTUUID=${rootbind} / btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT 0 0" >> ${mountpoint}/etc/fstab echo -e "PARTUUID=${rootbind} / btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT 0 0" >> ${mountpoint}/etc/fstab
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} /home btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/home 0 0" >> ${mountpoint}/etc/fstab
@ -451,22 +392,6 @@ else
done done
elif [ "${Partition}" == "mbr" ]; then
echo -e "UUID=${rootbind} / btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/ROOT 0 0" >> ${mountpoint}/etc/fstab
echo -e "UUID=${rootbind} /home btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/home 0 0" >> ${mountpoint}/etc/fstab
echo -e "UUID=${rootbind} /opt btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current/opt 0 0" >> ${mountpoint}/etc/fstab
echo -e "UUID=${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
# custom-mounts
for wort in ${mountsnaps}
do
echo -e "UUID=${rootbind} ${wort} btrfs rw,noatime,nodiratime,space_cache,discard,ssd,compress=lzo,subvol=__current${wort} 0 0" >> ${mountpoint}/etc/fstab
done
fi
fi fi
} }
@ -526,9 +451,7 @@ if [ "${1}" == "2" ] || [ "${1}" == "" ]; then
fi fi
# boot mount # boot mount
mkdir -p ${mountpoint}/boot mkdir -p ${mountpoint}/boot
if [ "${Partition}" == "gpt" ]; then mount -t vfat ${device}${efipartitionnummer} ${mountpoint}/boot
mount -t vfat ${device}${bootpartitionnummer} ${mountpoint}/boot
fi
fi fi
} }
@ -589,7 +512,9 @@ parameter=""
if [ "${swap}" == "y" ]; then if [ "${swap}" == "y" ]; then
parameter="${parameter}resume=PARTUUID=${swappartitionpart} " parameter="${parameter}resume=PARTUUID=${swappartitionpart} "
fi fi
if [ "${verschluesselung}" == "y" ]; then
parameter="${parameter}cryptdevice=UUID=${tobootdevice}:luks0 "
fi
if [ "${dateisystem}" == "btrfs" ]; then if [ "${dateisystem}" == "btrfs" ]; then
parameter="${parameter}rootflags=subvol=__current/ROOT " parameter="${parameter}rootflags=subvol=__current/ROOT "
fi fi
@ -639,13 +564,13 @@ read -p "Wie heissen sie?: " name
[[ -z "${name}" ]] && name=arch-linux [[ -z "${name}" ]] && name=arch-linux
# Partionierung # Partionierung
# GPT oder MBR # UEFI oder Legacy-BIOS
echo "" echo ""
echo "GPT = GUID Partition Table 64 Bit UEFI" echo "UEFI = Unified Extensible Firmware Interface"
echo "Empfohlen fuer Neuere PCs" 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 "WICHTIG DAFUER MUESSEN SIE IM BOOTMENUE DEN UEFI USB_STICK AUSGEWAEHLT HABEN SONST KANN KEIN UEFI BOOTEINTRAG ERSTELLT WERDEN!!!"
echo "" echo ""
echo "MBR = Master Boot Record 32 Bit Legacy" echo "BIOS = basic input/output system"
echo "Empfohlen fuer Alte PCs und portable USB-Sticks" echo "Empfohlen fuer Alte PCs und portable USB-Sticks"
echo "" echo ""
echo "Bitte die Eingaben klein schreiben :D !!!" echo "Bitte die Eingaben klein schreiben :D !!!"
@ -653,15 +578,15 @@ echo "Für jedes ja must du ein y machen und für jedes nein ein n ok !!!"
echo "" echo ""
if mount | grep efi > /dev/null; then if mount | grep efi > /dev/null; then
echo "System unterstützt UEFI" echo "System unterstützt UEFI"
read -p "Wie moechten sie ihre Festplatte partioniert haben: [GPT/mbr] " Partition read -p "Wie moechten sie ihre Festplatte partioniert haben: [UEFI/bios] " Partition
[[ -z "${Partition}" ]] && Partition=gpt [[ -z "${Partition}" ]] && Partition=uefi
else else
echo "System unterstützt kein UEFI" echo "System unterstützt kein UEFI"
read -p "Wie moechten sie ihre Festplatte partioniert haben: [gpt/MBR] " Partition read -p "Wie moechten sie ihre Festplatte partioniert haben: [uefi/BIOS] " Partition
[[ -z "${Partition}" ]] && Partition=mbr [[ -z "${Partition}" ]] && Partition=bios
fi fi
if [ "${Partition}" == "gpt" ] if [ "${Partition}" == "uefi" ]
then then
read -p "Soll mit systemd gebootet werden oder mit grub? [systemd/GRUB] : " boot read -p "Soll mit systemd gebootet werden oder mit grub? [systemd/GRUB] : " boot
if [ "${boot}" == "systemd" ]; then if [ "${boot}" == "systemd" ]; then
@ -786,7 +711,7 @@ fi
# Partitionierung # Partitionierung
if [ "${dateisystem}" == "btrfs" ]; then if [ "${dateisystem}" == "btrfs" ]; then
if [ "${Partition}" == "gpt" ]; then if [ "${Partition}" == "uefi" ]; then
bootpartitionnummer=1 bootpartitionnummer=1
efipartitionnummer=2 efipartitionnummer=2
rootpartitionnummer=3 rootpartitionnummer=3
@ -794,7 +719,7 @@ if [ "${dateisystem}" == "btrfs" ]; then
swappartitionnummer=3 swappartitionnummer=3
rootpartitionnummer=4 rootpartitionnummer=4
fi fi
elif [ "${Partition}" == "mbr" ]; then elif [ "${Partition}" == "bios" ]; then
bootpartitionnummer=1 bootpartitionnummer=1
efipartitionnummer=2 efipartitionnummer=2
rootpartitionnummer=3 rootpartitionnummer=3
@ -804,7 +729,7 @@ if [ "${dateisystem}" == "btrfs" ]; then
fi fi
fi fi
elif [ "${dateisystem}" == "ext4" ]; then elif [ "${dateisystem}" == "ext4" ]; then
if [ "${Partition}" == "gpt" ]; then if [ "${Partition}" == "uefi" ]; then
bootpartitionnummer=1 bootpartitionnummer=1
efipartitionnummer=2 efipartitionnummer=2
rootpartitionnummer=3 rootpartitionnummer=3
@ -812,7 +737,7 @@ elif [ "${dateisystem}" == "ext4" ]; then
swappartitionnummer=3 swappartitionnummer=3
rootpartitionnummer=4 rootpartitionnummer=4
fi fi
elif [ "${Partition}" == "mbr" ]; then elif [ "${Partition}" == "bios" ]; then
bootpartitionnummer=1 bootpartitionnummer=1
efipartitionnummer=2 efipartitionnummer=2
rootpartitionnummer=3 rootpartitionnummer=3
@ -870,6 +795,7 @@ else
exit 0 exit 0
fi fi
fi fi
fi
# debug = Installation überspringen zu arch-graphical-install und DEBEUG-MODUS # debug = Installation überspringen zu arch-graphical-install und DEBEUG-MODUS
abfrage abfrage
@ -891,16 +817,14 @@ then
fi fi
fi
# #
echo "Eine Säuberung erhört die chance der Installation auf dem System." echo "Eine Säuberung erhört die chance der Installation auf dem System."
echo "Es kann eine Zeit lang dauern!" echo "Es kann eine Zeit lang dauern!"
dd if=/dev/zero of=${device} bs=64M count=10 status=progress dd if=/dev/zero of=${device} bs=64M count=10 status=progress
# #
if [ "${Partition}" == "gpt" ] if [ "${Partition}" == "uefi" ]
then then
echo "Partioniere in GPT" echo "Partioniere mit UEFI"
if [ "${swap}" != "n" ]; then if [ "${swap}" != "n" ]; then
echo "Erstelle zustzliche swap-partition" echo "Erstelle zustzliche swap-partition"
@ -928,8 +852,8 @@ else
fi fi
removeinstaller removeinstaller
echo "Fertig" echo "Fertig"
elif [ "${Partition}" == "mbr" ]; then elif [ "${Partition}" == "bios" ]; then
echo "Partioniere in MBR" echo "Partioniere mit bios"
if [ "${swap}" != "n" ]; then if [ "${swap}" != "n" ]; then
echo "Erstelle zustzliche swap-partition" echo "Erstelle zustzliche swap-partition"
partionierenmitswap partionierenmitswap