Ein Installscript hinzugefügt, welches auch inerhalb des neuen Systems funktionieren sollte

This commit is contained in:
eichehome 2023-07-16 22:55:29 +02:00
parent 511227c034
commit 976c3cce5d

156
install.uefi Normal file
View file

@ -0,0 +1,156 @@
#!/bin/bash
####################
# Einfache Version #
####################
# processor manufacturer: amd
MICROCODE="amd-ucode"
# kernel: linux
KERNEL="linux"
# hostname: arch
HOSTNAME_NEW="arch"
# rootpassword: testen
ROOTPASSWORD="testen"
# username: eichehome
USERNAME="eichehome"
# userpassword: testen
USERPASSWORD="testen"
# graphics card: amd
GRAPHICS_CARD="amd"
# timezone: Europe/Berlin
TIMEZONE="Europe/Berlin"
# language: de_DE.UTF-8
LANG="de_DE.UTF-8"
# Drive: /dev/vda
DRIVE="/dev/vda"
# disklayout: ESP (512MiB), Root (100% - 512MiB)
###########################
#Discoverable Partitions Specification
sgdisk -og "${DRIVE}"
sgdisk -n 0:0:+512M -t 0:C12A7328-F81F-11D2-BA4B-00A0C93EC93B -c 0:efi "${DRIVE}"
#sgdisk -n 0:0:+512M -t 0:ef00 -c 0:ESP "${DRIVE}"
sgdisk -n 0:0:0 -t 0:4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709 -c 0:root "${DRIVE}"
mkfs.vfat -n EFI -F 32 /dev/vda1
mkfs.ext4 -L root /dev/vda2
mount /dev/vda2 /mnt
mkdir -p /mnt/efi
mount /dev/vda1 /mnt/efi
#ln -sf /run/systemd/resolve/stub-resolv.conf /mnt/etc/resolv.conf # tmpfiles.d macht das
pacstrap /mnt base linux-firmware vim git "${KERNEL}" "${MICROCODE}" #dracut
arch-chroot /mnt
# ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime -> L /etc/localtime - - - - "/usr/share/zoneinfo/${TIMEZONE}"
ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
sed -i 's/#\(Color\)/\1/' /etc/pacman.conf
# Umbruch notwendug
sed -i 's/#\(ParallelDownloads\s=\s5\)/\1\
ILoveCandy/' /etc/pacman.conf
sed -i "s/#\(${LANG}\)/\1/" /etc/locale.gen
locale-gen
echo "LANG=${LANG}" > /etc/locale.conf
echo "KEYMAP=${KEYMAP}" > /etc/vconsole.conf
echo "${HOSTNAME_NEW}" > /etc/hostname
cat > /etc/hosts << EOF
127.0.0.1 localhost
::1 localhost
127.0.1.1 ${HOSTNAME_NEW}.localedomain ${HOSTNAME_NEW}
EOF
#echo "127.0.0.1 localhost" > /etc/hosts
#echo "::1 localhost" >> /etc/hosts
#echo "127.0.1.1 ${HOSTNAME_NEW}.localedomain ${HOSTNAME_NEW}" >> /etc/hosts
echo root:"${ROOTPASSWORD}" | chpasswd
pacman -S base-devel "${KERNEL}-header"
pacman -S opendoas firewalld iptables-nft openssh bash-completion man-db man-pages reflector xdg-user-dirs
#pacman -S iwd dialog reflector xdg-user-dirs xdg-utils inetutils ldns bash-completion openssh rsync iptables-nft ipset firewalld lynx man-db man-pages texinfo opendoas pacman-contrib rebuild-detector
pacman -S efibootmgr mtools dosfstools
if [[ ${GRAPHICS_CARD} == "amd"]]; then
pacman -S xf86-video-amdgpu
elif [[ ${GRAPHICS_CARD} == "nvidia"]]; then
pacman -S nvidia nvidia-utils nvidia-settings
fi
# GNOME installieren
pacman -S gnome gnome-extras gdm avahi bluez bluez-utils pipewire pipewire-audio pipewire-alsa pipewire-pulse pipewire-jack pipewire-zeroconf pipewire-v4l2 pipewire-docs pipewire-roc helvum wireplumber gstreamer gst-plugin-pipewire gst-libav gst-plugins-good gst-plugins-base xdg-desktop-portal-gnome networkmanager modemmanager networkmanager-openconnect networkmanager-openvpn networkmanager-pptp networkmanager-vpnc power-profiles-daemon plymouth libreoffice-fresh-de
#################################################################
sed -i 's/#\(CHARACTER_SET:\).*/\1utf-8/' /etc/lynx.cfg
cat > /etc/xdg/reflector/reflector.conf << EOF
--save /etc/pacman.d/mirrorlist
--country Germany
--protocol https
--latest 5
EOF
cat > /etc/doas.conf << EOF
permit :wheel
permit persist eichehome as root
EOF
#echo "permit :wheel" > /etc/doas.conf
#echo "permit persist eichehome as root" >> /etc/doas.conf
#echo "" >> /etc/doas.conf
doas -C /etc/doas.conf && echo "config ok" || echo "config error"
sleep 1
cat > /etc/systemd/resolved.conf.d/disable-multicastDNS.conf << EOF
[Resolve]
MulticastDNS=no
EOF
systemctl enable systemd-resolved
systemctl enable systemd-timesyncd
systemctl enable reflector.timer
systemctl enable firewalld
systemctl enable fstrim.timer
systemctl enable gdm
systemctl enable avahi-daemon
systemctl enable bluetooth
if [[ ${GRAPHICS_CARD} == "amd" ]]; then
sed -i 's/MODULES=()/MODULES=(amdgpu)/' /etc/mkinitcpio.conf #AMD
elif [[ ${GRAPHICS_CARD} == "intel" ]]; then
sed -i 's/MODULES=()/MODULES=(i915)/' /etc/mkinitcpio.conf #Intel
elif [[ ${GRAPHICS_CARD} == "nvidia" ]]; then
sed -i 's/MODULES=()/MODULES=(nvidia)/' /etc/mkinitcpio.conf #Nvidia
fi
sed -i 's/^HOOKS=(.*)/HOOKS=(base systemd keyboard plymouth autodetect sd-vconsole modconf kms block filesystems fsck)/' /etc/mkinitcpio.conf
mkinitcpio -p "${KERNEL}"
bootctl install
cat > /efi/loader/loader.conf << EOF
timeout 5
console-mode max
editor yes
default *
EOF
cat > /efi/loader/entries/arch.conf << EOF
title Arch Linux
version 0.1
linux /vmlinuz-${KERNEL}
initrd /${MICROCODE}.img
initrd /initramfs-${KERNEL}.img
options quiet rw
EOF
useradd -mG wheel "${USERNAME}"
echo "${USERNAME}:${USERPASSWORD}" | chpasswd
exit(0)