130 lines
2.5 KiB
Bash
130 lines
2.5 KiB
Bash
USER="user"
|
|
PASSWORD="saturn"
|
|
NET=`ip -br l | awk '$1 !~ "lo|vir|wl" { print $1}'|head -n 1`
|
|
ALL_NICS=`ip -br l | awk '{ print $1}'`
|
|
DISK1=`lsblk -dn |awk '{print $1}'|grep -E "sda|nvme"|head -n 1`
|
|
|
|
echo
|
|
echo "NOTE: "
|
|
echo " * This script will setup system to use DHCP by default."
|
|
echo " * If you have a single wired NIC on a network with DHCP it should work by default."
|
|
echo " * Same password is the same for root and non root user by default. Change this after install or override."
|
|
echo " * The default selected disk is the first block device found."
|
|
echo " * This installer should support both BIOS and UEFI."
|
|
echo " * Swap is set to zero"
|
|
echo " * Timezone, locale, and keyboard layout are hardcoded. Override if needed."
|
|
echo;echo
|
|
|
|
echo "Default non-root user: ${USER}"
|
|
echo "Default password: ${PASSWORD}"
|
|
echo
|
|
|
|
echo "Selected wired interface: "
|
|
echo $NET
|
|
echo "All interfaces found:"
|
|
echo $ALL_NICS
|
|
echo
|
|
|
|
echo "Selected disk:"
|
|
echo $DISK1
|
|
echo
|
|
|
|
echo "Disks on system:"
|
|
lsblk -d
|
|
echo
|
|
|
|
|
|
DISK="/dev/$DISK1"
|
|
|
|
echo export USER=${USER} > environment.sh
|
|
echo export PASSWORD=${PASSWORD} >> environment.sh
|
|
echo export NET=${NET} >> environment.sh
|
|
echo export ALL_NICS=${ALL_NICS} >> environment.sh
|
|
echo export DISK1=${DISK1} >> environment.sh
|
|
echo export DISK=${DISK} >> environment.sh
|
|
|
|
chmod a+x environment.sh
|
|
|
|
START=1
|
|
ESP=$(( $START+512 ))
|
|
BIOS_BOOT=$(( $ESP+2 ))
|
|
ROOT=100%
|
|
|
|
echo
|
|
echo "Wiping Disk"
|
|
|
|
wipefs -a $DISK
|
|
|
|
echo
|
|
echo
|
|
echo "Creating Label"
|
|
|
|
parted -s ${DISK} mklabel gpt
|
|
|
|
echo
|
|
echo
|
|
echo "Partitioning"
|
|
|
|
parted -s --align=optimal ${DISK} mkpart ESP fat32 ${START}MiB ${ESP}MiB
|
|
parted -s ${DISK} set 1 esp on
|
|
parted -s --align=optimal ${DISK} mkpart BIOS_BOOT fat32 ${ESP}MiB ${BIOS_BOOT}MiB
|
|
parted -s ${DISK} set 2 bios_grub on
|
|
parted -s --align=optimal ${DISK} mkpart linux ${BIOS_BOOT}MiB 100%
|
|
|
|
parted -s ${DISK} print
|
|
|
|
echo
|
|
echo "Formatting Filesystems"
|
|
|
|
|
|
mkfs.ext4 -F ${DISK}3
|
|
mkfs.fat -F 32 ${DISK}1
|
|
|
|
mount ${DISK}3 /mnt
|
|
mkdir -p /mnt/boot/efi
|
|
mount ${DISK}1 /mnt/boot/efi
|
|
|
|
echo
|
|
echo "Pacstrapping System"
|
|
|
|
#update keys
|
|
echo "update keys"
|
|
gpg --refresh-keys
|
|
pacman-key --init && pacman-key --populate
|
|
pacman-key --refresh-keys
|
|
|
|
pacstrap -K /mnt base linux linux-firmware
|
|
|
|
echo
|
|
echo "Generating Filesystem Table"
|
|
|
|
genfstab -U /mnt >> /mnt/etc/fstab
|
|
|
|
|
|
echo
|
|
echo ${PASSWORD}
|
|
echo ${USER}
|
|
echo ${DISK}
|
|
echo
|
|
echo "Entering Chroot Environment"
|
|
|
|
|
|
cp fast_install_stage2.sh /mnt
|
|
cp environment.sh /mnt
|
|
|
|
arch-chroot /mnt /fast_install_stage2.sh
|
|
|
|
echo
|
|
echo "One Last Link"
|
|
|
|
|
|
ln -sf /run/systemd/resolve/stub-resolv.conf /mnt/etc/resolv.conf
|
|
|
|
|
|
reboot
|
|
|
|
|
|
|
|
|
|
|