|
|
@ -9,25 +9,33 @@ do case $opt in
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init() {
|
|
|
|
|
|
|
|
[ -z "$NAME" ] && read -p "Hostname: " NAME
|
|
|
|
|
|
|
|
[ -z "$PASSWD" ] && while [ "$PASSWD" = "$CHECK"]; do
|
|
|
|
|
|
|
|
&& read -sp "Root password: " PASSWD && read -sp "Repeat: " CHECK &&
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
# Show some possible disks
|
|
|
|
|
|
|
|
[ -z "$DEV" ] && lsblk -nrpo "name,size,model" && read -s "Provide installation medium (e.g. /dev/sda): " DEV
|
|
|
|
|
|
|
|
[[ "$DEV" =~ "sd[a-z]" ]] && SUF="1-3" && MODE="SATA"
|
|
|
|
|
|
|
|
[[ "$DEV" =~ "nvme[0-9]n[0-9]" ]] && SUF="p1-3" && MODE="NVME"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "+---------------------+"
|
|
|
|
|
|
|
|
echo "| Archlinux Bootstrap |"
|
|
|
|
|
|
|
|
echo "+---------------------+"
|
|
|
|
|
|
|
|
echo "HOSTNAME = $NAME"
|
|
|
|
|
|
|
|
echo "ROOTPASSWD = $PASSWD"
|
|
|
|
|
|
|
|
echo "DEVICEPARTS = $DEV$SUF"
|
|
|
|
|
|
|
|
read -s "Do you want to continue with these values (y/n): " cont
|
|
|
|
|
|
|
|
[ ! "$cont" = "y" ] && unset NAME PASSWD DEV && init
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# stop on error
|
|
|
|
# stop on error
|
|
|
|
set -e
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# initialize important values
|
|
|
|
|
|
|
|
init
|
|
|
|
|
|
|
|
|
|
|
|
PASSWD=${PASSWD:="toor"}
|
|
|
|
# All values set, start bootstrapping
|
|
|
|
NAME=${NAME:="archibald"}
|
|
|
|
|
|
|
|
DEV=${DEV:="nvme0n1"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "+---------------------+"
|
|
|
|
|
|
|
|
echo "| Archlinux Bootstrap |"
|
|
|
|
|
|
|
|
echo "+---------------------+"
|
|
|
|
|
|
|
|
echo "ROOTPASSWD = $PASSWD"
|
|
|
|
|
|
|
|
echo "HOSTNAME = $NAME"
|
|
|
|
|
|
|
|
echo -e "DEVICE = $DEV\n"
|
|
|
|
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
timedatectl set-ntp true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gdisk <<EOF
|
|
|
|
gdisk <<EOF
|
|
|
|
o
|
|
|
|
o
|
|
|
|
y
|
|
|
|
y
|
|
|
@ -51,10 +59,18 @@ y
|
|
|
|
|
|
|
|
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|
mkfs.fat -F 32 -n P_EFI /dev/${DEV}p1
|
|
|
|
case $MODE in
|
|
|
|
mkfs.ext4 -L P_ROOT /dev/${DEV}p3
|
|
|
|
"NVME")
|
|
|
|
mkswap -L P_SWAP /dev/${DEV}p2
|
|
|
|
mkfs.fat -F 32 -n P_EFI /dev/${DEV}p1
|
|
|
|
|
|
|
|
mkfs.ext4 -L P_ROOT /dev/${DEV}p3
|
|
|
|
|
|
|
|
mkswap -L P_SWAP /dev/${DEV}p2
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
"SATA")
|
|
|
|
|
|
|
|
mkfs.fat -F 32 -n P_EFI /dev/${DEV}1
|
|
|
|
|
|
|
|
mkfs.ext4 -L P_ROOT /dev/${DEV}3
|
|
|
|
|
|
|
|
mkswap -L P_SWAP /dev/${DEV}2
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
mount -L P_ROOT /mnt # root
|
|
|
|
mount -L P_ROOT /mnt # root
|
|
|
|
mkdir -p /mnt/boot
|
|
|
|
mkdir -p /mnt/boot
|
|
|
@ -64,14 +80,12 @@ swapon -L P_SWAP # swap
|
|
|
|
sed -e '/## Germany/,+1!d' /etc/pacman.d/mirrorlist
|
|
|
|
sed -e '/## Germany/,+1!d' /etc/pacman.d/mirrorlist
|
|
|
|
|
|
|
|
|
|
|
|
# for server dhcpcd and other programs are not required -> see good2know
|
|
|
|
# for server dhcpcd and other programs are not required -> see good2know
|
|
|
|
pacstrap /mnt base base-devel linux linux-firmware vi dhcpcd wpa_supplicant dialog git netctl
|
|
|
|
pacstrap /mnt base base-devel linux linux-firmware vi dhcpcd wpa_supplicant dialog git netctl curl
|
|
|
|
genfstab -p /mnt > /mnt/etc/fstab
|
|
|
|
genfstab -p /mnt > /mnt/etc/fstab
|
|
|
|
|
|
|
|
|
|
|
|
cat <<EOF > /mnt/root/bootstrap2.sh
|
|
|
|
cat <<EOF > /mnt/root/bootstrap2.sh
|
|
|
|
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
|
|
|
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
|
|
|
hwclock --systohc -utc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
|
|
|
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
|
|
|
locale-gen
|
|
|
|
locale-gen
|
|
|
@ -84,7 +98,7 @@ mkinitcpio -p linux
|
|
|
|
pacman -Sy --noconfirm efibootmgr dosfstools gptfdisk
|
|
|
|
pacman -Sy --noconfirm efibootmgr dosfstools gptfdisk
|
|
|
|
|
|
|
|
|
|
|
|
bootctl install
|
|
|
|
bootctl install
|
|
|
|
|
|
|
|
# MAYBE: add intel-ucode images, check for amd
|
|
|
|
cat <<EEE > /boot/loader/entries/arch-uefi.conf
|
|
|
|
cat <<EEE > /boot/loader/entries/arch-uefi.conf
|
|
|
|
title Arch
|
|
|
|
title Arch
|
|
|
|
linux /vmlinuz-linux
|
|
|
|
linux /vmlinuz-linux
|
|
|
@ -110,6 +124,10 @@ reflector --country 'Germany' --sort rate --protocol https --save /etc/pacman.d/
|
|
|
|
|
|
|
|
|
|
|
|
printf "${PASSWD}\n${PASSWD}\n" | passwd root
|
|
|
|
printf "${PASSWD}\n${PASSWD}\n" | passwd root
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd && curl -L https://g.phga.de/toerd/fresh/archive/master.tar.gz -o fresh.tar.gz && tar -xzf fresh.tar.gz
|
|
|
|
|
|
|
|
# basically a shitty one time job
|
|
|
|
|
|
|
|
echo '/root/fresh/fresh.sh' > .bashrc
|
|
|
|
|
|
|
|
|
|
|
|
exit
|
|
|
|
exit
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|