817 lines
28 KiB
Bash
817 lines
28 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
#########################################################################################
|
||
|
### Configuration Variables for Configuration and Files #################################
|
||
|
#########################################################################################
|
||
|
|
||
|
## Chaotic AUR Packages
|
||
|
declare -ra chaotic_pkgs=(
|
||
|
"pacseek"
|
||
|
"flatseal" "insync"
|
||
|
"input-leap" "libportal-gtk3" "libportal-gtk4" "libportal-qt5" "libportal-qt6"
|
||
|
"ttf-symbola" "ttf-ms-fonts"
|
||
|
"sublime-text-4" "vscodium-bin"
|
||
|
"softmaker-office-2024-bin"
|
||
|
"protonup-qt" "gamehub" "linux-steam-integration" "bottles" "heroic-games-launcher-bin"
|
||
|
"firefox-extension-bitwarden"
|
||
|
)
|
||
|
|
||
|
## Conditional Packages by Hostname
|
||
|
declare -ra loki_pkgs=(
|
||
|
"iio-sensor-proxy"
|
||
|
)
|
||
|
|
||
|
declare -ra test_pkgs=(
|
||
|
"ascii"
|
||
|
)
|
||
|
|
||
|
## Hypervisor Packages
|
||
|
declare -ra hypervisor_pkgs=(
|
||
|
"acpi"
|
||
|
"spice-vdagent"
|
||
|
"qemu-guest-agent"
|
||
|
"xf86-video-qxl"
|
||
|
)
|
||
|
|
||
|
## Standard Packages to install
|
||
|
declare -ra install_pkgs=(
|
||
|
"flatpak" "paru"
|
||
|
"htop" "btop" "ncdu" "lsd" "duf" "bat" "bat-extras" "tmux" "direnv" "starship" "pwgen" "yadm"
|
||
|
"zsh" "fish"
|
||
|
"lrzsz" "zssh"
|
||
|
"vim" "neovim" "neovim-qt" "lazygit" "tree-sitter-bash" "tree-sitter-cli" "luarocks" "lua51"
|
||
|
"wl-clipboard"
|
||
|
"yakuake" "ksshaskpass"
|
||
|
"thunderbird" "vivaldi" "vivaldi-ffmpeg-codecs"
|
||
|
"ttf-roboto-mono-nerd" "ttf-hack-nerd" "ttf-ubuntu-nerd" "ttf-ubuntu-mono-nerd"
|
||
|
"ttf-terminus-nerd" "ttf-sourcecodepro-nerd" "ttf-nerd-fonts-symbols"
|
||
|
"noto-fonts" "noto-fonts-emoji" "noto-fonts-extra" "ttf-noto-nerd"
|
||
|
"gnome-themes-extra" "gtk-engines" "gtk-engine-murrine" "adw-gtk-theme" "gtk-chtheme"
|
||
|
"plymouth" "plymouth-kcm" "breeze-plymouth"
|
||
|
"steam" "steam-native-runtime" "lutris" "vkd3d"
|
||
|
"wine" "wine-gecko" "wine-mono" "winetricks"
|
||
|
"lib32-sdl12-compat"
|
||
|
"bitwarden" "bitwarden-cli" "nextcloud-client"
|
||
|
"devtools" "pacman-contrib"
|
||
|
"crun" "podman" "distrobox"
|
||
|
"go" "php" "composer" "npm" "rubygems" "python-pip" "python-pipx" "python-pynvim" "rust"
|
||
|
"bash-language-server" "shellcheck"
|
||
|
)
|
||
|
|
||
|
## Kernel Parameters
|
||
|
declare -rA kernel_cmdline=(
|
||
|
["midgaard"]="amd_pstate=active amdgpu.ppfeaturemask=0xffffffff"
|
||
|
["all"]="mitigations=off"
|
||
|
)
|
||
|
|
||
|
## 1strun Script: /usr/local/sbin/1strun.sh
|
||
|
IFS='' read -r -d '' script_1strun <<"EOF"
|
||
|
#!/bin/bash
|
||
|
|
||
|
#umount /.snapshots && rmdir /.snapshots
|
||
|
#snapper --no-dbus create-config --template default /
|
||
|
#if [[ -d "/.snapshots" ]]; then
|
||
|
# echo "USER_COMMANDS: found .snapshots, removing"
|
||
|
# btrfs sub delete /.snapshots
|
||
|
#fi
|
||
|
#mkdir /.snapshots && mount /.snapshots
|
||
|
systemctl disable 1strun.service
|
||
|
rm -f /usr/local/sbin/1strun.sh /etc/systemd/system/1strun.service
|
||
|
systemctl daemon-reload
|
||
|
EOF
|
||
|
|
||
|
## 1strun Service: /etc/systemd/system/1strun.service
|
||
|
IFS='' read -r -d '' service_1strun <<"EOF"
|
||
|
[Unit]
|
||
|
Description=1st Run Script
|
||
|
|
||
|
[Service]
|
||
|
ExecStart=/usr/local/sbin/1strun.sh
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|
||
|
EOF
|
||
|
|
||
|
## sddm config: /etc/sddm.conf.d/10-wayland.conf
|
||
|
IFS='' read -r -d '' config_sddm_wayland <<"EOF"
|
||
|
[General]
|
||
|
DisplayServer=wayland
|
||
|
GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell
|
||
|
|
||
|
[Wayland]
|
||
|
CompositorCommand=kwin_wayland --drm --no-lockscreen --no-global-shortcuts --locale1 --inputmethod maliit-keyboard
|
||
|
EOF
|
||
|
|
||
|
## /etc/dracut.conf.d/plymouth.conf
|
||
|
IFS='' read -r -d '' config_dracut_plymouth <<"EOF"
|
||
|
add_dracutmodules+=" plymouth "
|
||
|
EOF
|
||
|
|
||
|
## /etc/dracut.conf.d/bluetooth.conf
|
||
|
IFS='' read -r -d '' config_dracut_bluetooth <<"EOF"
|
||
|
add_dracutmodules+=" bluetooth "
|
||
|
EOF
|
||
|
|
||
|
## /etc/dracut.conf.d/hibernate.conf
|
||
|
IFS='' read -r -d '' config_dracut_hibernate <<"EOF"
|
||
|
add_dracutmodules+=" resume "
|
||
|
EOF
|
||
|
|
||
|
## /etc/systemd/system/display-manager.service.d/plymouth.conf
|
||
|
IFS='' read -r -d '' config_plymouth_sddm <<"EOF"
|
||
|
[Unit]
|
||
|
Conflicts=plymouth-quit.service
|
||
|
After=plymouth-quit.service rc-local.service plymouth-start.service systemd-user-sessions.service
|
||
|
OnFailure=plymouth-quit.service
|
||
|
|
||
|
[Service]
|
||
|
ExecStartPost=-/usr/bin/sleep 30
|
||
|
ExecStartPost=-/usr/bin/plymouth quit --retain-splash
|
||
|
EOF
|
||
|
|
||
|
## /etc/udev/hwdb.d/10-keyboard.hwdb
|
||
|
IFS='' read -r -d '' config_midgaard_keyboard <<"EOF"
|
||
|
evdev:input:b0003v05AFp8277* # was tested on Kensington Slim Type USB (with old ABI)
|
||
|
KEYBOARD_KEY_38=leftmeta
|
||
|
KEYBOARD_KEY_db=leftalt
|
||
|
|
||
|
evdev:atkbd:dmi:* # built-in keyboard: match all AT keyboards for now
|
||
|
KEYBOARD_KEY_38=leftmeta
|
||
|
KEYBOARD_KEY_db=leftalt
|
||
|
EOF
|
||
|
|
||
|
## /etc/udev/hwdb.d/71-mouse.hwdb
|
||
|
IFS='' read -r -d '' config_midgaard_mouse <<"EOF"
|
||
|
mouse:usb:v046dpc547:name:Logitech USB Receiver:
|
||
|
MOUSE_DPI=1000@1000
|
||
|
EOF
|
||
|
|
||
|
## /etc/udev/hwdb.d/99-G915TKL.hwdb
|
||
|
IFS='' read -r -d '' config_midgaard_g915tkl <<"EOF"
|
||
|
# This file goes in /etc/udev/hwdb.d/
|
||
|
# Afterwards, run: systemd-hwdb update
|
||
|
|
||
|
# cat /sys/class/input/event4/device/modalias
|
||
|
# input:b0003v046DpC343e0111-e0,1,4,11,14,k74,75,77,7A,7B,7C,7D,7E,7F,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,ram4,l0,1,2,3,4,sfw
|
||
|
#
|
||
|
evdev:input:b0003v046DpC343*
|
||
|
KEYBOARD_KEY_700e2=leftmeta
|
||
|
KEYBOARD_KEY_700e3=leftalt
|
||
|
#KEYBOARD_KEY_38=leftmeta
|
||
|
#KEYBOARD_KEY_db=leftalt
|
||
|
|
||
|
evdev:input:b0003v046DpC547*
|
||
|
KEYBOARD_KEY_700e2=leftmeta
|
||
|
KEYBOARD_KEY_700e3=leftalt
|
||
|
#KEYBOARD_KEY_38=leftmeta
|
||
|
#KEYBOARD_KEY_db=leftalt
|
||
|
EOF
|
||
|
|
||
|
## /etc/udev/hwdb.d/10-lenovokeyboard.hwdb
|
||
|
IFS='' read -r -d '' config_loki_keyboard <<"EOF"
|
||
|
# Input device ID: bus 0x11 vendor 0x1 product 0x1 version 0xab83
|
||
|
#
|
||
|
#evdev:input:b0011v0001p0001*
|
||
|
# KEYBOARD_KEY_70038=125
|
||
|
# KEYBOARD_KEY_70075=56
|
||
|
#
|
||
|
# This file goes in /etc/udev/hwdb.d/
|
||
|
# Afterwards, run: systemd-hwdb update
|
||
|
|
||
|
evdev:atkbd:dmi:bvnLENOVO:*
|
||
|
KEYBOARD_KEY_38=leftmeta
|
||
|
KEYBOARD_KEY_db=leftalt
|
||
|
EOF
|
||
|
|
||
|
## /var/lib/sddm/.config/kwinoutputconfig.json
|
||
|
IFS='' read -r -d '' config_loki_sddmoutput <<"EOF"
|
||
|
[
|
||
|
{
|
||
|
"data": [
|
||
|
{
|
||
|
"autoRotation": "InTabletMode",
|
||
|
"brightness": 1,
|
||
|
"colorProfileSource": "sRGB",
|
||
|
"connectorName": "eDP-1",
|
||
|
"edidHash": "3e5ee1a686128c7d1f475a01fe8cf600",
|
||
|
"edidIdentifier": "CMN 5122 0 52 2018 0",
|
||
|
"highDynamicRange": false,
|
||
|
"iccProfilePath": "",
|
||
|
"mode": {
|
||
|
"height": 1080,
|
||
|
"refreshRate": 60008,
|
||
|
"width": 1920
|
||
|
},
|
||
|
"overscan": 0,
|
||
|
"rgbRange": "Automatic",
|
||
|
"scale": 1.25,
|
||
|
"sdrBrightness": 200,
|
||
|
"sdrGamutWideness": 0,
|
||
|
"transform": "Normal",
|
||
|
"vrrPolicy": "Automatic",
|
||
|
"wideColorGamut": false
|
||
|
},
|
||
|
{
|
||
|
"autoRotation": "InTabletMode",
|
||
|
"brightness": 1,
|
||
|
"colorProfileSource": "sRGB",
|
||
|
"connectorName": "DP-2",
|
||
|
"edidHash": "d5860185c4e0676def22dacc95ceda77",
|
||
|
"edidIdentifier": "VSC 56878 16843009 25 2019 0",
|
||
|
"highDynamicRange": false,
|
||
|
"iccProfilePath": "",
|
||
|
"mode": {
|
||
|
"height": 1080,
|
||
|
"refreshRate": 60000,
|
||
|
"width": 1920
|
||
|
},
|
||
|
"overscan": 0,
|
||
|
"rgbRange": "Automatic",
|
||
|
"scale": 1,
|
||
|
"sdrBrightness": 200,
|
||
|
"sdrGamutWideness": 0,
|
||
|
"transform": "Normal",
|
||
|
"vrrPolicy": "Automatic",
|
||
|
"wideColorGamut": false
|
||
|
}
|
||
|
],
|
||
|
"name": "outputs"
|
||
|
},
|
||
|
{
|
||
|
"data": [
|
||
|
{
|
||
|
"lidClosed": false,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"enabled": true,
|
||
|
"outputIndex": 0,
|
||
|
"position": {
|
||
|
"x": 221,
|
||
|
"y": 1080
|
||
|
},
|
||
|
"priority": 0
|
||
|
},
|
||
|
{
|
||
|
"enabled": true,
|
||
|
"outputIndex": 1,
|
||
|
"position": {
|
||
|
"x": 0,
|
||
|
"y": 0
|
||
|
},
|
||
|
"priority": 1
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"name": "setups"
|
||
|
}
|
||
|
]
|
||
|
EOF
|
||
|
|
||
|
## /var/lib/sddm/.config/kwinoutputconfig.json
|
||
|
IFS='' read -r -d '' config_samba <<"EOF"
|
||
|
[global]
|
||
|
workgroup = HOME
|
||
|
dns proxy = no
|
||
|
log file = /var/log/samba/%m.log
|
||
|
max log size = 1000
|
||
|
client min protocol = SMB2
|
||
|
server min protocol = SMB2
|
||
|
server role = standalone server
|
||
|
passdb backend = tdbsam
|
||
|
obey pam restrictions = yes
|
||
|
unix password sync = yes
|
||
|
passwd program = /usr/bin/passwd %u
|
||
|
passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
|
||
|
pam password change = yes
|
||
|
map to guest = Bad Password
|
||
|
usershare allow guests = yes
|
||
|
name resolve order = lmhosts bcast host wins
|
||
|
security = user
|
||
|
guest account = nobody
|
||
|
usershare path = /var/lib/samba/usershares
|
||
|
usershare max shares = 100
|
||
|
usershare owner only = yes
|
||
|
force create mode = 0070
|
||
|
force directory mode = 0070
|
||
|
|
||
|
[homes]
|
||
|
comment = Home Directories
|
||
|
browseable = no
|
||
|
read only = yes
|
||
|
create mask = 0700
|
||
|
directory mask = 0700
|
||
|
valid users = %S
|
||
|
|
||
|
[printers]
|
||
|
comment = All Printers
|
||
|
browseable = no
|
||
|
path = /var/spool/samba
|
||
|
printable = yes
|
||
|
guest ok = no
|
||
|
read only = yes
|
||
|
create mask = 0700
|
||
|
|
||
|
[print$]
|
||
|
comment = Printer Drivers
|
||
|
path = /var/lib/samba/printers
|
||
|
browseable = yes
|
||
|
read only = yes
|
||
|
guest ok = no
|
||
|
EOF
|
||
|
|
||
|
## /etc/systemd/zram-generator.conf
|
||
|
IFS='' read -r -d '' config_midgaard_zram <<"EOF"
|
||
|
# This config file enables a /dev/zram0 device with the default settings:
|
||
|
# — size — 4GB
|
||
|
# — compression — most likely lzo-rle
|
||
|
#
|
||
|
# To disable, uninstall zram-generator-defaults or create empty
|
||
|
# /etc/systemd/zram-generator.conf file.
|
||
|
[zram0]
|
||
|
zram-size = 4096
|
||
|
EOF
|
||
|
|
||
|
## /etc/systemd/zram-generator.conf
|
||
|
IFS='' read -r -d '' config_loki_zram <<"EOF"
|
||
|
# This config file enables a /dev/zram0 device with the default settings:
|
||
|
# — size — 2GB
|
||
|
# — compression — most likely lzo-rle
|
||
|
#
|
||
|
# To disable, uninstall zram-generator-defaults or create empty
|
||
|
# /etc/systemd/zram-generator.conf file.
|
||
|
[zram0]
|
||
|
zram-size = 2048
|
||
|
EOF
|
||
|
|
||
|
## /etc/systemd/system/hibernate-preparation.service
|
||
|
IFS='' read -r -d '' service_hibernate_preparation <<"EOF"
|
||
|
[Unit]
|
||
|
Description=Enable swap file and disable zram before hibernate
|
||
|
Before=systemd-hibernate.service
|
||
|
|
||
|
[Service]
|
||
|
User=root
|
||
|
Type=oneshot
|
||
|
ExecStart=/bin/bash -c "/usr/sbin/swapon /swap/hibernate.swp && /usr/sbin/swapoff /dev/zram0"
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=systemd-hibernate.service
|
||
|
EOF
|
||
|
|
||
|
## /etc/systemd/system/hibernate-resume.service
|
||
|
IFS='' read -r -d '' service_hibernate_resume <<"EOF"
|
||
|
[Unit]
|
||
|
Description=Disable swap after resuming from hibernation
|
||
|
After=hibernate.target
|
||
|
|
||
|
[Service]
|
||
|
User=root
|
||
|
Type=oneshot
|
||
|
ExecStart=/usr/sbin/swapoff /swap/hibernate.swp
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=hibernate.target
|
||
|
EOF
|
||
|
|
||
|
## /etc/systemd/system/systemd-logind.service.d/override.conf
|
||
|
IFS='' read -r -d '' override_logind <<"EOF"
|
||
|
[Service]
|
||
|
Environment=SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK=1
|
||
|
EOF
|
||
|
|
||
|
## /etc/systemd/system/systemd-hibernate.service.d/override.conf
|
||
|
IFS='' read -r -d '' override_hibernate <<"EOF"
|
||
|
[Service]
|
||
|
Environment=SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK=1
|
||
|
EOF
|
||
|
|
||
|
|
||
|
#########################################################################################
|
||
|
### PREP Installation ###################################################################
|
||
|
#########################################################################################
|
||
|
|
||
|
_IsoConfig() {
|
||
|
local -r install_mode="$1"
|
||
|
if [[ "$install_mode" = "online" ]]; then
|
||
|
touch /tmp/installmode-online
|
||
|
fi
|
||
|
|
||
|
sed -i /etc/calamares/modules/partition.conf -E \
|
||
|
-e 's|^defaultFileSystemType:.*|defaultFileSystemType: "btrfs"|' \
|
||
|
-e 's|^(availableFileSystemTypes:.*)"ext4","btrfs"|\1"btrfs","ext4"|' \
|
||
|
-e 's|^luksGeneration:.*|luksGeneration: luks2|'
|
||
|
sed -i /etc/calamares/modules/partition.conf -E \
|
||
|
-e '/^efi:$/,/^$/ { r /dev/stdin' -e';d};' <<EOF
|
||
|
efi:
|
||
|
mountPoint: "/boot/efi"
|
||
|
recommendedSize: 200MiB
|
||
|
minimumSize: 100MiB
|
||
|
size: 100%
|
||
|
EOF
|
||
|
sed -i /etc/calamares/modules/partition.conf -E \
|
||
|
-e '/^partitionLayout:$/,/^$/ { r /dev/stdin' -e';d};' <<EOF
|
||
|
partitionLayout:
|
||
|
- name: "eos-boot"
|
||
|
filesystem: "ext4"
|
||
|
noEncrypt: true
|
||
|
mountPoint: "/boot"
|
||
|
size: 2GiB
|
||
|
minSize: 1GiB
|
||
|
- name: "eos-root"
|
||
|
filesystem: "unknown"
|
||
|
mountPoint: "/"
|
||
|
size: 100%
|
||
|
EOF
|
||
|
sed -i /etc/calamares/modules/packagechooserq.conf -E \
|
||
|
-e 's|packageChoice:.*|packageChoice: grub|'
|
||
|
printf "\ndefault: KDE-Desktop\n" >> /etc/calamares/modules/packagechooser.conf
|
||
|
#sed -i \
|
||
|
# -e 's/defaultFileSystemType:.*/defaultFileSystemType: "btrfs"/g' \
|
||
|
# -e 's/filesystem: "unknown"/filesystem: "btrfs"/g' \
|
||
|
# /etc/calamares/modules/partition.conf
|
||
|
#sed -i -e 's/filesystem: "unknown"/filesystem: "btrfs"/g'
|
||
|
#sed -i -e '/^btrfsSubvolumes:$/,/^$/ { r /dev/stdin' -e';d};' /etc/calamares/modules/mount.conf <<EOF
|
||
|
sed -i /etc/calamares/modules/mount.conf -E \
|
||
|
-e '/^btrfsSubvolumes:$/,/^$/ { r /dev/stdin' -e';d};' <<EOF
|
||
|
btrfsSubvolumes:
|
||
|
- mountPoint: /
|
||
|
subvolume: /@
|
||
|
- mountPoint: /home
|
||
|
subvolume: /@home
|
||
|
- mountPoint: /var/cache
|
||
|
subvolume: /@cache
|
||
|
- mountPoint: /var/log
|
||
|
subvolume: /@log
|
||
|
- mountPoint: /srv
|
||
|
subvolume: /@srv
|
||
|
- mountPoint: /opt
|
||
|
subvolume: /@opt
|
||
|
- mountPoint: /usr/local
|
||
|
subvolume: /@usrlocal
|
||
|
- mountPoint: /var/lib/crash
|
||
|
subvolume: /@crash
|
||
|
- mountPoint: /var/lib/containers
|
||
|
subvolume: /@containers
|
||
|
- mountPoint: /var/lib/libvirt/images
|
||
|
subvolume: /@libvirt
|
||
|
- mountPoint: /var/lib/machines
|
||
|
subvolume: /@machines
|
||
|
- mountPoint: /var/lib/portables
|
||
|
subvolume: /@portables
|
||
|
- mountPoint: /var/spool
|
||
|
subvolume: /@spool
|
||
|
- mountPoint: /var/tmp
|
||
|
subvolume: /@tmp
|
||
|
- mountPoint: /var/www
|
||
|
subvolume: /@www
|
||
|
- mountPoint: /root
|
||
|
subvolume: /@root
|
||
|
- mountPoint: /swap
|
||
|
subvolume: @swap
|
||
|
- mountPoint: /.snapshots
|
||
|
subvolume: /.snapshots
|
||
|
|
||
|
EOF
|
||
|
sed -i -e '/^.*- filesystem: btrfs$/,/\]$/ { r /dev/stdin' -e';d};' /etc/calamares/modules/mount.conf <<EOF
|
||
|
- filesystem: btrfs
|
||
|
options: [ noatime, space_cache=v2, compress=zstd:1, ssd, discard=async ]
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
|
||
|
#########################################################################################
|
||
|
### POST Installation ###################################################################
|
||
|
#########################################################################################
|
||
|
|
||
|
trim() {
|
||
|
local var="$*"
|
||
|
# remove leading whitespace characters
|
||
|
var="${var#"${var%%[![:space:]]*}"}"
|
||
|
# remove trailing whitespace characters
|
||
|
var="${var%"${var##*[![:space:]]}"}"
|
||
|
printf '%s' "$var"
|
||
|
}
|
||
|
|
||
|
_checkPkg() {
|
||
|
local check="$1"
|
||
|
|
||
|
pacman -Ss "$check" &>/dev/null
|
||
|
return $?
|
||
|
}
|
||
|
|
||
|
_getPackages() {
|
||
|
local pkg
|
||
|
local pkgs
|
||
|
local -ra checks=("$@")
|
||
|
|
||
|
for pkg in "${checks[@]}"; do
|
||
|
if _checkPkg "$pkg"; then
|
||
|
pkgs+=" $pkg"
|
||
|
fi
|
||
|
done
|
||
|
trim "$pkgs"
|
||
|
}
|
||
|
|
||
|
_PostInstallCommands() {
|
||
|
local -r username="$1"
|
||
|
local packages
|
||
|
local hostname
|
||
|
local rootUUID
|
||
|
local resumeOffset
|
||
|
|
||
|
hostname=$(< /etc/hostname)
|
||
|
|
||
|
pacman -Sy
|
||
|
|
||
|
#echo "USER_COMMANDS: Installing desired packages"
|
||
|
#pacman -S --noconfirm --needed flatpak htop btop ncdu pwgen paru zsh fish tmux yadm\
|
||
|
# vim neovim neovim-qt thunderbird \
|
||
|
# ttf-roboto-mono-nerd ttf-hack-nerd ttf-ubuntu-nerd ttf-ubuntu-mono-nerd ttf-terminus-nerd \
|
||
|
# ttf-sourcecodepro-nerd ttf-nerd-fonts-symbols noto-fonts noto-fonts-emoji noto-fonts-extra \
|
||
|
# ttf-noto-nerd \
|
||
|
# steam steam-native-runtime lutris vkd3d wine wine-gecko wine-mono winetricks lib32-sdl12-compat \
|
||
|
# bitwarden bitwarden-cli nextcloud-client yakuake \
|
||
|
# devtools
|
||
|
|
||
|
#vscode-css-languageserver vscode-html-language-server vscode-json-language-server vscode-markdown-language-server
|
||
|
|
||
|
### 3rd-Party Repository Configuration ##############################################
|
||
|
echo "USER_COMMANDS: Installing Chaotic-AUR and AURTO Repositories"
|
||
|
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
|
||
|
pacman-key --lsign-key 3056513887B78AEB
|
||
|
pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
|
||
|
#echo -e "\n[aur]\nSigLevel = PackageOptional DatabaseOptional\nServer = file:///var/lib/repo/aur" >> /etc/pacman.conf
|
||
|
#echo -e "\n[aurto]\nSigLevel = Never\nServer = http://abs.home.ld/" >> /etc/pacman.conf
|
||
|
|
||
|
### Host-Specific Packager Configuration: midgaard ##################################
|
||
|
if [[ "$hostname" == "midgaard" ]]; then
|
||
|
mkdir -p /var/lib/repo/aur
|
||
|
chown "${username}": /var/lib/repo/aur
|
||
|
sed -i /etc/pacman.conf \
|
||
|
-e "/#CacheDir/a CacheDir = /var/lib/repo/aur" \
|
||
|
-e '$a\\n[aur]\nSigLevel = PackageOptional DatabaseOptional\nServer = file:///var/lib/repo/aur'
|
||
|
sed -i /etc/paru.conf \
|
||
|
-e 's|#LocalRepo|LocalRepo|' \
|
||
|
-e 's|#Chroot|Chroot|'
|
||
|
|
||
|
sudo -u "$username" paru -Ld
|
||
|
### Host-Specific Packager Configuration: loki ######################################
|
||
|
else
|
||
|
sed -i /etc/pacman.conf \
|
||
|
-e '$a\\n[aur]\nSigLevel = PackageOptional DatabaseOptional\nServer = http://midgaard.home.ld/aur'
|
||
|
fi
|
||
|
|
||
|
echo -e "\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf
|
||
|
|
||
|
pacman -Sy
|
||
|
|
||
|
### Chaotic-AUR Packages ############################################################
|
||
|
echo "USER_COMMANDS: Installing Chaotic-AUR Packages"
|
||
|
packages="$(_getPackages "${chaotic_pkgs[@]}")"
|
||
|
if [[ -n "$packages" ]]; then
|
||
|
pacman -S --noconfirm --needed "$packages"
|
||
|
fi
|
||
|
|
||
|
### AurTO Packages ##################################################################
|
||
|
# autro dependent packages:
|
||
|
#pacman -S --noconfirm --needed tmuxinator sublime-merge
|
||
|
|
||
|
### Custom Host Packages ############################################################
|
||
|
echo "USER_COMMANDS: Installing Packages for $hostname"
|
||
|
packages=""
|
||
|
case "$hostname" in
|
||
|
loki) packages="$(_getPackages "${loki_pkgs[@]}")";;
|
||
|
mideavour) packages="$(_getPackages "${test_pkgs[@]}")";;
|
||
|
esac
|
||
|
if [[ -n "$packages" ]]; then
|
||
|
pacman -S --noconfirm --needed "$packages"
|
||
|
fi
|
||
|
|
||
|
### Hypervisor Tuning ###############################################################
|
||
|
if dmesg | grep "Hypervisor detected"; then
|
||
|
packages=""
|
||
|
if dmesg | grep "Hypervisor detected: KVM"; then
|
||
|
echo "USER_COMMANDS: Installing virtual machine guest tools for KVM"
|
||
|
#pacman -S --noconfirm --needed spice-vdagent qemu-guest-agent xf86-video-qxl
|
||
|
packages="$(_getPackages "${hypervisor_pkgs[@]}")"
|
||
|
fi
|
||
|
if [[ -n "$packages" ]]; then
|
||
|
pacman -S --noconfirm --needed "$packages"
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
### Grub Tuning #####################################################################
|
||
|
echo "USER_COMMANDS: Adding Grub Boot Parameters"
|
||
|
sed -i /etc/default/grub -E \
|
||
|
-e "s|(GRUB_CMDLINE_LINUX_DEFAULT=)'(.*)'|\1'quiet splash \2 ${kernel_cmdline["$hostname"]} ${kernel_cmdline["all"]}'|"
|
||
|
if [[ -f "/boot/grub/grub.cfg" ]]; then
|
||
|
grub-mkconfig -o /boot/grub/grub.cfg
|
||
|
fi
|
||
|
|
||
|
### Fstab Fixes #####################################################################
|
||
|
echo "USER_COMMANDS: Moving /boot/efi mount after /boot"
|
||
|
sed -i /etc/fstab \
|
||
|
-e "/^UUID=.*efi /{h;d;};/^UUID.*boot .*/G"
|
||
|
|
||
|
### BtrFS Snapshots #################################################################
|
||
|
echo "USER_COMMANDS: Installing snapper support"
|
||
|
#umount /.snapshots && rmdir /.snapshots
|
||
|
mkdir -p /boot/grub
|
||
|
#pacman -S --noconfirm --needed snapper-support btrfsmaintenance btrfs-assistant btrbk snapper-rollback
|
||
|
pacman -S --noconfirm --needed snapper grub-btrfs snap-pac
|
||
|
|
||
|
echo "USER_COMMANDS: Creating snapper config"
|
||
|
umount /.snapshots && rmdir /.snapshots
|
||
|
snapper --no-dbus create-config --template default /
|
||
|
if [[ -d "/.snapshots" ]]; then
|
||
|
echo "USER_COMMANDS: found .snapshots, removing"
|
||
|
btrfs sub delete /.snapshots
|
||
|
fi
|
||
|
mkdir /.snapshots && mount /.snapshots
|
||
|
|
||
|
echo "USER_COMMANDS: Tuning snapper config"
|
||
|
snapper --no-dbus -c root set-config \
|
||
|
ALLOW_USERS="$username" \
|
||
|
SYNC_ACL="yes" \
|
||
|
NUMBER_MIN_AGE="3600" \
|
||
|
NUMBER_LIMIT="20" \
|
||
|
TIMELINE_CREATE="no" \
|
||
|
TIMELINE_MIN_AGE="3600" \
|
||
|
TIMELINE_LIMIT_HOURLY="0" \
|
||
|
TIMELINE_LIMIT_DAILY="7" \
|
||
|
TIMELINE_LIMIT_WEEKLY="2" \
|
||
|
TIMELINE_LIMIT_MONTHLY="1" \
|
||
|
TIMELINE_LIMIT_YEARLY="0" \
|
||
|
EMPTY_PRE_POST_MIN_AGE="1800"
|
||
|
|
||
|
#if [[ -d "/.snapshots" ]]; then
|
||
|
# echo "USER_COMMANDS: found .snapshots, removing"
|
||
|
# btrfs sub delete /.snapshots
|
||
|
#fi
|
||
|
#mkdir /.snapshots && mount /.snapshots
|
||
|
|
||
|
### Enabling Flathub for Flatpak ####################################################
|
||
|
echo "USER_COMMANDS: Adding Flathub to Flatpak"
|
||
|
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||
|
|
||
|
### Configuring SDDM and Plymouth ###################################################
|
||
|
echo "USER_COMMANDS: Setting up sddm for Wayland"
|
||
|
if [[ -d "/etc/sddm.conf.d" ]]; then
|
||
|
cat <<< "$config_sddm_wayland" > /etc/sddm.conf.d/10-wayland.conf
|
||
|
fi
|
||
|
|
||
|
mkdir -p /etc/dracut.conf.d /etc/systemd/display-manager.service.d
|
||
|
cat <<< "$config_dracut_plymouth" > /etc/dracut.conf.d/plymouth.conf
|
||
|
#cat <<< "$config_plymouth_sddm" > /etc/systemd/system/display-manager.service.d/plymouth.conf
|
||
|
|
||
|
if [[ -d "/swap" ]]; then
|
||
|
chattr +C /swap
|
||
|
fi
|
||
|
|
||
|
### Host-Specific Customizations: midgaard ##########################################
|
||
|
if [[ "$hostname" == "midgaard" ]]; then
|
||
|
echo "USER_COMMANDS: Applying customizations to $hostname"
|
||
|
cat <<< "$config_midgaard_keyboard" > /etc/udev/hwdb.d/10-keyboard.hwdb
|
||
|
cat <<< "$config_midgaard_mouse" > /etc/udev/hwdb.d/71-mouse.hwdb
|
||
|
cat <<< "$config_midgaard_g915tkl" > /etc/udev/hwdb.d/99-G915TKL.hwdb
|
||
|
systemd-hwdb update
|
||
|
|
||
|
cat <<< "$config_midgaard_zram" > /etc/systemd/zram-generator.conf
|
||
|
|
||
|
### Host-Specific Customizations: loki ##############################################
|
||
|
elif [[ "$hostname" == "loki" ]]; then
|
||
|
echo "USER_COMMANDS: Applying customizations to $hostname"
|
||
|
cat <<< "$config_loki_keyboard" > /etc/udev/hwdb.d/10-lenovokeyboard.hwdb
|
||
|
systemd-hwdb update
|
||
|
|
||
|
cat <<< "$config_dracut_bluetooth" > /etc/dracut.conf.d/bluetooth.conf
|
||
|
cat <<< "$config_loki_zram" > /etc/systemd/zram-generator.conf
|
||
|
|
||
|
if [[ -d "/swap" ]]; then
|
||
|
echo "USER_COMMANDS: Enabling swap file for $hostname"
|
||
|
btrfs filesystem mkswapfile --size 10g --uuid clear /swap/hibernate.swp
|
||
|
fi
|
||
|
|
||
|
if [[ -f "/usr/share/maliit/keyboard2/devices/default.json" ]]; then
|
||
|
echo "USER_COMMANDS: Applying Maliit Configuration for loki"
|
||
|
sed -i /usr/share/maliit/keyboard2/devices/default.json -E \
|
||
|
-e 's|("keyboardHeightPortrait":) 0\.[0-9]*([,]?.*)|\1 0.15\2|' \
|
||
|
-e 's|("keyboardHeightLandscape":) 0\.[0-9]*([,]?.*)|\1 0.25\2|'
|
||
|
sed -i /usr/share/maliit/keyboard2/devices/tablet.json -E \
|
||
|
-e 's|("keyboardHeightPortrait":) 0\.[0-9]*([,]?.*)|\1 0.15\2|' \
|
||
|
-e 's|("keyboardHeightLandscape":) 0\.[0-9]*([,]?.*)|\1 0.25\2|'
|
||
|
fi
|
||
|
|
||
|
if [[ -d "/var/lib/sddm" ]]; then
|
||
|
echo "USER_COMMANDS: Applying SDDM Screen Configuration for loki"
|
||
|
if [[ ! -d "/var/lib/sddm/.config" ]]; then
|
||
|
mkdir -p "/var/lib/sddm/.config"
|
||
|
chown sddm:sddm "/var/lib/sddm/.config"
|
||
|
fi
|
||
|
cat <<< "$config_loki_sddmoutput" > /var/lib/sddm/.config/kwinoutputconfig.json
|
||
|
chown sddm:sddm /var/lib/sddm/.config/kwinoutputconfig.json
|
||
|
fi
|
||
|
elif [[ "$hostname" == "mideavour" ]]; then
|
||
|
echo "USER_COMMANDS: Applying customizations to $hostname"
|
||
|
|
||
|
if [[ -d "/swap" ]]; then
|
||
|
echo "USER_COMMANDS: Enabling swap file for $hostname"
|
||
|
btrfs filesystem mkswapfile --size 4g --uuid clear /swap/hibernate.swp
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
if [[ -f "/swap/hibernate.swp" ]]; then
|
||
|
echo "USER_COMMANDS: Enabling Hibernation Support"
|
||
|
rootUUID=$(findmnt -no UUID -T /swap/hibernate.swp)
|
||
|
resumeOffset=$(btrfs inspect-internal map-swapfile -r /swap/hibernate.swp)
|
||
|
|
||
|
cat <<< "$config_dracut_hibernate" > /etc/dracut.conf.d/hibernate.conf
|
||
|
|
||
|
sed -i /etc/default/grub -E \
|
||
|
-e "s|(GRUB_CMDLINE_LINUX_DEFAULT=)'(.*) (mitigations=.*')|\1'\2 resume=UUID=$rootUUID resume_offset=$resumeOffset \3|"
|
||
|
if [[ -f "/boot/grub/grub.cfg" ]]; then
|
||
|
grub-mkconfig -o /boot/grub/grub.cfg
|
||
|
fi
|
||
|
|
||
|
cat <<< "$service_hibernate_preparation" > /etc/systemd/system/hibernate-preparation.service
|
||
|
cat <<< "$service_hibernate_resume" > /etc/systemd/system/hibernate-resume.service
|
||
|
|
||
|
mkdir -p /etc/systemd/system/systemd-logind.service.d \
|
||
|
/etc/systemd/system/systemd-hibernate.service.d
|
||
|
cat <<< "$override_logind" > /etc/systemd/system/systemd-logind.service.d/override.conf
|
||
|
cat <<< "$override_hibernate" > /etc/systemd/system/systemd-hibernate.service.d/override.conf
|
||
|
|
||
|
systemctl enable hibernate-preparation.service hibernate-resume.service
|
||
|
fi
|
||
|
|
||
|
### Enable Samba Usershares #########################################################
|
||
|
echo "USER_COMMANDS: Configuring Samba with usershares"
|
||
|
mkdir -p /var/lib/samba/usershares
|
||
|
groupadd -r sambashare
|
||
|
chown root:sambashare /var/lib/samba/usershares
|
||
|
chmod 1770 /var/lib/samba/usershares
|
||
|
gpasswd sambashare -a "$username"
|
||
|
cat <<< "$config_samba" > /etc/samba/smb.conf
|
||
|
|
||
|
### BtrFS Snapshots #################################################################
|
||
|
echo "USER_COMMANDS: Setting up snapper-create startup unit"
|
||
|
if [[ ! -d "/usr/local/sbin" ]]; then
|
||
|
echo "USER_COMMANDS: Creating /usr/local/sbin"
|
||
|
mkdir -p /usr/local/sbin
|
||
|
fi
|
||
|
|
||
|
### EOS-YAD Configs #################################################################
|
||
|
echo "USER_COMMANDS: Configuring EOS YAD Settings"
|
||
|
sed -i /etc/eos-script-lib-yad.conf \
|
||
|
-e 's/^# EOS_YAD_TERMINAL="terminator"$/EOS_YAD_TERMINAL="konsole"/' \
|
||
|
-e 's/^EOS_AUR_HELPER="yay"$/EOS_AUR_HELPER="paru"/'
|
||
|
|
||
|
### Services Enable #################################################################
|
||
|
echo "USER_COMMANDS: Enabling services (sshd)"
|
||
|
systemctl daemon-reload
|
||
|
systemctl enable sshd.service
|
||
|
|
||
|
### 1st Run Script (Deprecated) #####################################################
|
||
|
#echo "USER_COMMANDS: Generating 1strun Script and Service (1strun)"
|
||
|
#cat <<< "$script_1strun" > /usr/local/sbin/1strun.sh
|
||
|
#chmod a+x /usr/local/sbin/1strun.sh
|
||
|
#cat <<< "$service_1strun" > /etc/systemd/system/1strun.service
|
||
|
#
|
||
|
#echo "USER_COMMANDS: Enabling services (1strun)"
|
||
|
#systemctl enable 1strun.service
|
||
|
}
|
||
|
|
||
|
|
||
|
#########################################################################################
|
||
|
### SETUP Links and Package List ########################################################
|
||
|
#########################################################################################
|
||
|
|
||
|
_SetupScript() {
|
||
|
local pkg
|
||
|
local first_pkg=true
|
||
|
|
||
|
echo "Deploying Installation Hooks"
|
||
|
pushd "$HOME" &>/dev/null || exit 1
|
||
|
rm -f user-commands-before.bash
|
||
|
ln -s user_commands.bash user-commands-before.bash
|
||
|
for pkg in "${install_pkgs[@]}"; do
|
||
|
if $first_pkg; then
|
||
|
echo "$pkg" > "$HOME"/user_pkglist.txt
|
||
|
first_pkg=false
|
||
|
else
|
||
|
echo "$pkg" >> "$HOME"/user_pkglist.txt
|
||
|
fi
|
||
|
done
|
||
|
popd &>/dev/null || exit 1
|
||
|
}
|
||
|
|
||
|
#########################################################################################
|
||
|
|
||
|
case "$1" in
|
||
|
--iso-conf* | community) ;; # no more supported here
|
||
|
setup) _SetupScript ;;
|
||
|
online | offline) _IsoConfig $2 ;;
|
||
|
*) _PostInstallCommands "$1" ;;
|
||
|
esac
|