(hopefully) finished the base installation portion
This commit is contained in:
parent
7fb14abcd8
commit
f689f2cbba
17
install.sh
17
install.sh
|
@ -3,7 +3,7 @@ set -e
|
|||
|
||||
source funcs.sh
|
||||
|
||||
log_msg INFO "Welcome to the simple Gentoo installer script!"
|
||||
log_msg INFO "Welcome to the code stolen Gentoo installer script!"
|
||||
log_msg INFO "$(cat <<-END
|
||||
This script assumes the following things:
|
||||
- networking works
|
||||
|
@ -26,7 +26,7 @@ export CFG_PART_PREFIX="$(prompt_value "Partition number prefix (eg. 'p' for NVM
|
|||
export CFG_BLOCK_PART="${CFG_BLOCK_DEVICE}${CFG_PART_PREFIX}"
|
||||
export CFG_PART_BOOT_SIZE="$(prompt_value "Boot partition size (in MB)" "256")"
|
||||
export CFG_PART_SWAP_SIZE="$(prompt_value "Swap partition size (in MB)" "4096")"
|
||||
export CFG_PART_ROOT_SIZE="$(prompt_value "Root partition size (in MB)" "")"
|
||||
export CFG_PART_ROOT_SIZE="$(prompt_value "Root partition size (in MB)" "16384")"
|
||||
export CFG_PART_HOME_SIZE="$(prompt_value "Home partition size (in %)" "100")%"
|
||||
export CFG_LLVM="$(prompt_accept "Use LLVM instead of GNU CC")"
|
||||
export CFG_TIMEZONE="$(prompt_value "System timezone" "America/Los_Angeles")"
|
||||
|
@ -35,6 +35,8 @@ export CFG_HOSTNAME="$(prompt_value "System hostname" "gentoo")"
|
|||
export CFG_NETWORK_INTERFACE="$(prompt_value "Network interface name" "enp0s3")"
|
||||
export CFG_KEYMAP="$(prompt_value "Keymap to use" "fi")"
|
||||
export CFG_ROOT_PASSWORD="$(prompt_value "Root user password" "")"
|
||||
export CFG_USER_USERNAME="$(prompt_value "Username for daily use" "gentoo")"
|
||||
export CFG_USER_PASSWORD="$(prompt_value "Password for your user" "")"
|
||||
|
||||
log_msg INFO "$(cat <<END
|
||||
Verify configuration:
|
||||
|
@ -52,6 +54,8 @@ Verify configuration:
|
|||
- CFG_NETWORK_INTERFACE: $CFG_NETWORK_INTERFACE
|
||||
- CFG_KEYMAP: $CFG_KEYMAP
|
||||
- CFG_ROOT_PASSWORD: $CFG_ROOT_PASSWORD
|
||||
- CFG_USER_USERNAME: $CFG_USER_USERNAME
|
||||
- CFG_USER_PASSWORD: $CFG_USER_PASSWORD
|
||||
END
|
||||
)"
|
||||
|
||||
|
@ -69,11 +73,7 @@ if [[ "$PROMPT_WIPEFS" == "y" ]]; then
|
|||
fi
|
||||
|
||||
# setup disklabel
|
||||
if [[ "${CFG_PART_UEFI}" == "y" ]]; then
|
||||
parted -a optimal $CFG_BLOCK_DEVICE mklabel gpt
|
||||
else
|
||||
parted -a optimal $CFG_BLOCK_DEVICE mklabel msdos
|
||||
fi
|
||||
|
||||
# setup partitions
|
||||
parted -s $CFG_BLOCK_DEVICE mkpart primary 0% $CFG_PART_BOOT_SIZE
|
||||
|
@ -101,7 +101,6 @@ cp funcs.sh /mnt/gentoo/
|
|||
(cd /mnt/gentoo ; bash stage3.sh)
|
||||
|
||||
# finalize installation
|
||||
umount -l /mnt/gentoo/dev{/shm,/pts,}
|
||||
umount -R /mnt/gentoo
|
||||
|
||||
log_msg INFO "All is done! You can execute 'reboot' now!"
|
||||
log_msg INFO "Automatic installation completed, look at README for steps"
|
||||
log_msg INFO "DO NOT IGNORE THE LAST STEP OR GENTOO WILL NOT BOOT!"
|
||||
|
|
|
@ -13,7 +13,6 @@ PYTHON_SINGLE_TARGET="python3_11"
|
|||
LUA_TARGETS="lua5-4"
|
||||
LUA_SINGLE_TARGET="lua5-4"
|
||||
|
||||
EMERGE_DEFAULT_OPTS="--jobs=16 --load-average=16 --keep-going --verbose --quiet-build --with-bdeps=y --complete-graph=y --deep --ask"
|
||||
FEATURES="candy fixlafiles unmerge-orphans noman nodoc noinfo notitles parallel-install parallel-fetch clean-logs"
|
||||
# NOTE: This stage was built with the bindist USE flag enabled
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
sys-kernel/installkernel grub dracut
|
||||
net-wireless/wpa_supplicant dbus
|
||||
sys-kernel/gentoo-kernel savedconfig
|
||||
media-video/pipewire sound-server pipewire-alsa ffmpeg dbus extra
|
||||
|
|
113
stage3.sh
113
stage3.sh
|
@ -105,6 +105,8 @@ USE="-compress-xz" emerge --ask n linux-firmware
|
|||
emerge --oneshot --ask n pciutils
|
||||
GPU_CODE=$(lspci | grep -i 'vga\|3d\|2d' | awk -F'[[]' '{print $1}' | awk '{print $NF}' | tr '[:upper:]' '[:lower:]')
|
||||
sed -i "/^nvidia\/\($GPU_CODE\)/!d" /etc/portage/savedconfig/sys-kernel/linux-firmware-*
|
||||
|
||||
# fix depen problems with freetype and harfbuzz
|
||||
USE="-harfbuzz" emerge --oneshot --ask n freetype
|
||||
emerge --oneshot --ask n freetype
|
||||
|
||||
|
@ -114,44 +116,37 @@ emerge --oneshot --ask n freetype
|
|||
|
||||
log_msg INFO "install kernel sources" >> /var/log/installer.log
|
||||
emerge --ask n sys-kernel/gentoo-sources
|
||||
|
||||
log_msg INFO "select kernel sources" >> /var/log/installer.log
|
||||
eselect kernel list
|
||||
eselect kernel set 1
|
||||
|
||||
log_msg INFO "install genkernel" >> /var/log/installer.log
|
||||
emerge --ask n sys-kernel/genkernel
|
||||
|
||||
log_msg INFO "set /boot/efi in fstab" >> /var/log/installer.log
|
||||
echo "${CFG_BLOCK_PART}1 /boot/efi vfat defaults 0 2" >> /etc/fstab
|
||||
|
||||
if [[ "${CFG_LLVM}" == "y" ]]; then
|
||||
log_msg INFO "compile kernel sources (llvm)" >> /var/log/installer.log
|
||||
LLVM=1 LLVM_IAS=1 genkernel all \
|
||||
--kernel-as=llvm-as \
|
||||
--kernel-ar=llvm-ar \
|
||||
--kernel-cc=clang \
|
||||
--kernel-ld=ld.lld \
|
||||
--kernel-nm=llvm-nm \
|
||||
--utils-as=llvm-as \
|
||||
--utils-ar=llvm-ar \
|
||||
--utils-cc=clang \
|
||||
--utils-cxx=clang++ \
|
||||
--utils-ld=ld.lld \
|
||||
--utils-nm=llvm-nm
|
||||
else
|
||||
log_msg INFO "compile kernel sources (gcc)" >> /var/log/installer.log
|
||||
genkernel all
|
||||
fi
|
||||
# testing if cd works, if curl screws up this is probably the main issue
|
||||
cd /usr/src/linux
|
||||
curl -L https://gist.githubusercontent.com/emrakyz/0ff8674792bd844fcab6afb2063ffa94/raw/e91e60ae2f74ccee8fcd7b7b93db942ba60277ce/.config -o .config
|
||||
MICROCODE_PATH=$(iucode_tool -S -l /lib/firmware/intel-ucode/* 2>&1 | grep 'microcode bundle' | awk -F': ' '{print $2}' | cut -d'/' -f4-)
|
||||
sed -i "s#CONFIG_EXTRA_FIRMWARE=.*#CONFIG_EXTRA_FIRMWARE=\"$MICROCODE_PATH\"#g" /usr/src/linux/.config
|
||||
THREAD_NUM=$(nproc)
|
||||
sed -i "s#CONFIG_NR_CPUS=.*#CONFIG_NR_CPUS=$THREAD_NUM#g" /usr/src/linux/.config
|
||||
make menuconfig
|
||||
MAKEMENUCONFIG_RUNNING="true"
|
||||
while [[ $MAKEMENUCONFIG_RUNNING == "true" ]]; do
|
||||
log_msg INFO "Waiting for user to end modifying kernel ..."
|
||||
MAKEMENUCONFIG_RUNNING=$(ps -aux | (grep -o '[m]ake') || true)
|
||||
sleep 5s
|
||||
done
|
||||
make -j$(nproc)
|
||||
emerge nvidia-drivers linux-firmware
|
||||
make modules_install
|
||||
|
||||
#
|
||||
# filesystem install
|
||||
#
|
||||
|
||||
#needed so motherboard can detect it
|
||||
mkdir -p /boot/EFI/BOOT
|
||||
cp /usr/src/linux/arch/x86/boot/bzImage /boot/EFI/BOOT/BOOTX64.EFI
|
||||
|
||||
log_msg INFO "set swap, / and cdrom in fstab" >> /var/log/installer.log
|
||||
mkdir -p /mnt/cdrom
|
||||
echo "${CFG_BLOCK_PART}"2 none swap sw 0 0 >> /etc/fstab
|
||||
echo "${CFG_BLOCK_PART}"3 / ext4 noatime 0 1 >> /etc/fstab
|
||||
echo "${CFG_BLOCK_PART}"3 / ext4 defaults,noatime 0 1 >> /etc/fstab
|
||||
echo "${CFG_BLOCK_PART}"4 / ext4 defaults,noatime 0 1" >> /etc/fstab
|
||||
echo /dev/cdrom /mnt/cdrom auto noauto,user 0 0 >> /etc/fstab
|
||||
|
||||
#
|
||||
|
@ -172,6 +167,8 @@ emerge --ask n net-wireless/iw net-wireless/wpa_supplicant
|
|||
|
||||
log_msg INFO "configure networking" >> /var/log/installer.log
|
||||
|
||||
# placeholder /etc/hosts file, replace later
|
||||
curl https://git.keyemail.dev/lurk/really-bad-gentoo-install/raw/branch/master/README.md >> /etc/hosts
|
||||
|
||||
log_msg INFO "configure hosts" >> /var/log/installer.log
|
||||
echo "127.0.0.1 ${CFG_HOSTNAME} localhost" >> /etc/hosts
|
||||
|
@ -203,19 +200,51 @@ log_msg INFO "install filesystem tools" >> /var/log/installer.log
|
|||
emerge --ask n sys-fs/e2fsprogs
|
||||
emerge --ask n sys-fs/dosfstools
|
||||
|
||||
log_msg INFO "set clock" >> /var/log/installer.log
|
||||
sed -i 's/clock=.*/clock=\"local\"/g' /etc/conf.d/hwclock
|
||||
|
||||
log_msg INFO "install doas (sudo replacement)" >> /var/log/installer.log
|
||||
emerge --ask n doas
|
||||
|
||||
echo "permit :wheel
|
||||
permit nopass keepenv :$CFG_USER_USERNAME
|
||||
permit nopass keepenv :root" > /etc/doas.conf
|
||||
|
||||
log_msg INFO "install git" >> /var/log/installer.log
|
||||
emerge --ask n app-eselect/eselect-repository dev-vcs/git
|
||||
|
||||
log_msg INFO "set up git ver of gentoo repo" >> /var/log/installer.log
|
||||
eselect repository remove gentoo
|
||||
rm -rf /var/db/repos/gentoo
|
||||
eselect repository add gentoo git https://github.com/gentoo-mirror/gentoo.git
|
||||
|
||||
log_msg INFO "install pipewire" >> /var/log/installer.log
|
||||
emerge --ask n pipewire
|
||||
emerge --ask n wireplumber
|
||||
|
||||
log_msg INFO "install efibootmgr" >> /var/log/installer.log
|
||||
emerge --ask n efibootmgr
|
||||
|
||||
# create user
|
||||
useradd -mG wheel,audio,video,usb,input,portage,pipewire $CFG_USER_USERNAME
|
||||
echo "$CFG_USER_USERNAME:$CFG_USER_PASSWORD" | chpasswd
|
||||
|
||||
# nvidia modules
|
||||
mkdir -p /etc/modules-load.d
|
||||
echo "nvidia
|
||||
nvidia_modeset
|
||||
nvidia_uvm
|
||||
nvidia_drm" > /etc/modules-load.d/video.conf
|
||||
echo "nvidia-drm
|
||||
options nvidia-drm modeset=1" > /etc/modules-load.d/nvidia-drm.conf
|
||||
|
||||
# clean up portage
|
||||
rm -rf /var/tmp/portage/*
|
||||
rm -rf /var/cache/distfiles/*
|
||||
rm -rf /var/cache/binpkgs/*
|
||||
|
||||
#
|
||||
# bootloader install
|
||||
# bootloader install should be done manually
|
||||
#
|
||||
|
||||
|
||||
log_msg INFO "install grub2 with efi" >> /var/log/installer.log
|
||||
echo "GRUB_PLATFORMS=\"efi-64\"" >> /etc/portage/make.conf
|
||||
emerge --ask n sys-boot/grub
|
||||
|
||||
log_msg INFO "install EFI bootloader" >> /var/log/installer.log
|
||||
grub-install --target=x86_64-efi --efi-directory=/boot/efi
|
||||
|
||||
log_msg INFO "configure bootloader" >> /var/log/installer.log
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
EOF
|
||||
|
|
Loading…
Reference in a new issue