From 584d11f7c57736e52d228c1e5071887c029327e9 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Sat, 21 Jan 2023 18:39:31 +0530 Subject: [PATCH] changes made in this commit: - in root's crontab: add: pacman --files --refresh - copy and enable pratham's services: hdd-standby-on-*.service import-*.service - echo hostname in /etc/hostname alongside setting via hostnamectl - remove installation of cargo components (handled by pacman) - add a section to setup virsh pools and networks as I need - import zpools - use doas instead of sudo - enable a few zfs-related services - fix use of "/dev/null" --- install-archlinux.sh | 6 +++--- scripts/chroot-setup.sh | 13 ++++++++---- scripts/doas-pratham.sh | 3 +++ scripts/pratham-setup.sh | 45 +++++++++++++++++++++++++++++++++------- 4 files changed, 52 insertions(+), 15 deletions(-) diff --git a/install-archlinux.sh b/install-archlinux.sh index 2fead48..15346c4 100755 --- a/install-archlinux.sh +++ b/install-archlinux.sh @@ -8,7 +8,7 @@ ################################################################################ # check for internet connectivity -ping -c 1 google.com >/dev/null 2>&1 +ping -c 1 google.com > /dev/null if [[ ! $? -eq 0 ]]; then echo "No internet access :(" exit 1 @@ -36,7 +36,7 @@ MIRRORLIST_FILE="/etc/pacman.d/mirrorlist" cp mirrorlist $MIRRORLIST_FILE # check if reflector is already running -pgrep reflector >/dev/null +pgrep reflector > /dev/null if [[ $? -eq 0 ]]; then IS_REFLECTOR_RUNNING=y else @@ -54,7 +54,7 @@ if [[ ! -f "$MIRRORLIST_FILE" && $IS_REFLECTOR_RUNNING == "n" ]]; then --sort rate \ --fastest 10 \ --protocol https \ - --save /etc/pacman.d/mirrorlist >/dev/null 2>&1 & + --save /etc/pacman.d/mirrorlist > /dev/null fi diff --git a/scripts/chroot-setup.sh b/scripts/chroot-setup.sh index 733f51e..463497b 100644 --- a/scripts/chroot-setup.sh +++ b/scripts/chroot-setup.sh @@ -6,14 +6,15 @@ ################################################################################ ROOT_CRONTAB="# remove cache every 2 hours and update local db -0 */2 * * * paccache -r >/dev/null 2>&1 -0 * * * * pacman --sync --refresh >/dev/null 2>&1 +0 */2 * * * paccache -r > /dev/null +0 * * * * pacman --sync --refresh > /dev/null +0 * * * * pacman --files --refresh > /dev/null # update the on-disk database every 6 hours -0 */6 * * * updatedb >/dev/null 2>&1 +0 */6 * * * updatedb > /dev/null # zfs scrub -0 0 1,15 * * /usr/bin/zpool scrub +0 0 1,15 * * /usr/bin/zpool scrub > /dev/null " ################################################################################ @@ -201,6 +202,10 @@ systemctl enable sddm.service systemctl enable libvirtd.service systemctl enable NetworkManager.service systemctl enable sshd.service +systemctl enable hdd-standby-on-boot.service +systemctl enable hdd-standby-on-resume.service +systemctl enable import-flameboi-st.service +systemctl enable import-heathen-disk.service # update bootloader bootctl update diff --git a/scripts/doas-pratham.sh b/scripts/doas-pratham.sh index 9dc44f0..031cbf4 100755 --- a/scripts/doas-pratham.sh +++ b/scripts/doas-pratham.sh @@ -17,10 +17,13 @@ rsync \ --itemize-changes --checksum --perms \ --exclude=".git" --exclude=".gitignore" --exclude="README.md" --exclude="run_me.sh" \ ../dotfiles/ ~/ + +cp -v _OTHER/flameboi/etc/systemd/system/*.service /etc/systemd/system/ popd rm -rf dotfiles popd + ################################################################################ # NEOVIM PLUGINS ################################################################################ diff --git a/scripts/pratham-setup.sh b/scripts/pratham-setup.sh index 4bdc3aa..bd5ac57 100755 --- a/scripts/pratham-setup.sh +++ b/scripts/pratham-setup.sh @@ -8,7 +8,7 @@ export EDITOR=/usr/bin/nvim # setup sudo access for pratham -/usr/bin/sudo -l -U pratham >/dev/null 2>&1 +/usr/bin/sudo -l -U pratham > /dev/null if [[ $? -ne 0 ]]; then doas visudo fi @@ -17,6 +17,7 @@ fi WHAT_IS_MY_HOSTNAME=$(cat /etc/hostname) if [[ $WHAT_IS_MY_HOSTNAME != "flameboi" ]]; then hostnamectl set-hostname flameboi + echo "flameboi" | doas tee /etc/hostname WHAT_IS_MY_HOSTNAME=whoopsie fi @@ -119,9 +120,8 @@ doas pacman --sync --refresh --refresh --sysupgrade # rust-lang rustup default stable -rustup component add rust-src rust-analyzer -rustup component add rust-analysis -cargo install cargo-outdated cargo-tree +rustup update stable +rustup component add rust-src rust-analyzer rust-analysis # get dotfiles @@ -147,6 +147,34 @@ gsettings set org.gnome.desktop.interface color-scheme prefer-dark flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak install --user flathub com.brave.Browser com.discordapp.Discord com.github.tchx84.Flatseal io.gitlab.librewolf-community org.raspberrypi.rpi-imager +################################################################################ +# VIRSH POOLS + NETWORK +################################################################################ + +LIBVIRTD_RESTART=no + +gropus | grep "libvirt" || doas adduser pratham libvirt +gropus | grep "kvm" || doas adduser pratham kvm + +# network +doas virsh net-info default | grep "Autostart" | grep "no" && doas virsh net-autostart default + +# storage pool +doas virsh pool-dumpxml default | grep "/flameboi_st/vm-store" > /dev/null +if [[ $? -ne 0 ]]; then + doas virsh pool-destroy default + doas virsh pool-undefine default + doas virsh pool-define-as --name default --type dir --target /flameboi_st/vm-store + doas virsh pool-autostart default + doas virsh pool-start default + LIBVIRTD_RESTART=yes +fi + +# restart libvirtd if necessary +if [[ "$LIBVIRTD_RESTART" == "yes" ]]; then + doas systemctl restart libvirtd +fi + ################################################################################ # AUR/PARU @@ -195,9 +223,10 @@ echo -e "\n\nThe setup appears to have completed (as far as I can tell). Please if ! command -v zpool > /dev/null; then lsmod | grep zfs if [[ $? -ne 0 ]]; then - echo "ZFS Kernel module is not loaded. Please run the \`sudo modprobe zfs\` command and reboot." + echo "ZFS Kernel module is not loaded. Please run the \`doas modprobe zfs\` command and reboot." fi - sudo systemctl enable --now zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs.target zfs-zed.service - sudo zpool set cachefile=/etc/zfs/zpool.cache heathen_disk + doas systemctl enable zfs-import-cache.service zfs-import-scan.service zfs-import.service zfs-load-key.service zfs-mount.service zfs-volume-wait.service zfs-zed.service + doas zpool import 16601987433518749526 + doas zpool import 12327394492612946617 + doas zpool set cachefile=/etc/zfs/zpool.cache heathen_disk fi -echo -e "\n\nDotfiles have been copied, but some files are yet to be copied. Your manual intervention is necessary. Please copy the contents of the \"_OTHER\" directory manually."