fix: 3 Arch-related script fixes (Waydroid, MyBash pkg mgr, GRUB auto-refresh) (#1294)
* Add 5 Arch system setup scripts: pacman config, pipewire, zram, snapper, maintenance * Fix shellcheck issues: remove local/bashisms, add snapper safety guard * fix: 3 Arch-related script fixes - #1067: Simplify waydroid kernel grep to avoid ERE syntax issues - #1255: Use package manager for starship/fzf/zoxide before curl fallback - #1220: Auto-run grub-mkconfig after GRUB theme installation Closes #1067, #1255, #1220 * refactor: move pipewire/zram scripts to system-setup root with cross-distro support * fix: bump ParallelDownloads to 20 in pacman config * fix: explicitly list known pkg managers in _install_pkg, note unsupported in fallback * fix: add pipewire-jack for Debian 13+, rename pipewire-pulse to pipewire-pulseaudio for Fedora --------- Co-authored-by: Pinak Dhabu <thepinak503@users.noreply.github.com>
This commit is contained in:
@@ -11,6 +11,11 @@ themeinstall(){
|
||||
git clone "https://github.com/ChrisTitusTech/Top-5-Bootloader-Themes"
|
||||
cd "Top-5-Bootloader-Themes"
|
||||
"$ESCALATION_TOOL" ./install.sh
|
||||
if command -v grub-mkconfig >/dev/null 2>&1; then
|
||||
"$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg
|
||||
elif command -v grub2-mkconfig >/dev/null 2>&1; then
|
||||
"$ESCALATION_TOOL" grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
fi
|
||||
}
|
||||
|
||||
checkEnv
|
||||
|
||||
@@ -54,29 +54,39 @@ installFont() {
|
||||
fi
|
||||
}
|
||||
|
||||
_install_pkg() {
|
||||
case "$PACKAGER" in
|
||||
pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$1" ;;
|
||||
apk) "$ESCALATION_TOOL" "$PACKAGER" add "$1" ;;
|
||||
xbps-install) "$ESCALATION_TOOL" "$PACKAGER" -Sy "$1" ;;
|
||||
dnf|apt-get|nala|zypper|eopkg) "$ESCALATION_TOOL" "$PACKAGER" install -y "$1" ;;
|
||||
*) printf "%b\n" "${YELLOW}Unsupported package manager, falling back to manual install...${RC}" && return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
installStarshipAndFzf() {
|
||||
if command_exists starship; then
|
||||
if ! command_exists starship; then
|
||||
printf "%b\n" "${YELLOW}Installing Starship...${RC}"
|
||||
_install_pkg starship 2>/dev/null || {
|
||||
printf "%b\n" "${YELLOW}Package manager install failed, using curl...${RC}"
|
||||
curl -sSL https://starship.rs/install.sh | "$ESCALATION_TOOL" sh || {
|
||||
printf "%b\n" "${RED}Failed to install starship!${RC}"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
else
|
||||
printf "%b\n" "${GREEN}Starship already installed${RC}"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$PACKAGER" = "eopkg" ]; then
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y starship || {
|
||||
printf "%b\n" "${RED}Failed to install starship with Solus!${RC}"
|
||||
exit 1
|
||||
if ! command_exists fzf; then
|
||||
printf "%b\n" "${YELLOW}Installing fzf...${RC}"
|
||||
_install_pkg fzf 2>/dev/null || {
|
||||
printf "%b\n" "${YELLOW}Package manager install failed, using git...${RC}"
|
||||
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
||||
"$ESCALATION_TOOL" ~/.fzf/install
|
||||
}
|
||||
else
|
||||
curl -sSL https://starship.rs/install.sh | "$ESCALATION_TOOL" sh || {
|
||||
printf "%b\n" "${RED}Failed to install starship!${RC}"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
if command_exists fzf; then
|
||||
printf "%b\n" "${GREEN}Fzf already installed${RC}"
|
||||
else
|
||||
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
||||
"$ESCALATION_TOOL" ~/.fzf/install
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -86,10 +96,14 @@ installZoxide() {
|
||||
return
|
||||
fi
|
||||
|
||||
if ! curl -sSL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh; then
|
||||
printf "%b\n" "${RED}Something went wrong during zoxide install!${RC}"
|
||||
exit 1
|
||||
fi
|
||||
printf "%b\n" "${YELLOW}Installing Zoxide...${RC}"
|
||||
_install_pkg zoxide 2>/dev/null || {
|
||||
printf "%b\n" "${YELLOW}Package manager install failed, using curl...${RC}"
|
||||
if ! curl -sSL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh; then
|
||||
printf "%b\n" "${RED}Something went wrong during zoxide install!${RC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
linkConfig() {
|
||||
|
||||
@@ -20,7 +20,7 @@ installWaydroid() {
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm dkms
|
||||
fi
|
||||
|
||||
installed_kernels=$("$PACKAGER" -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1)
|
||||
installed_kernels=$("$PACKAGER" -Q | grep '^linux' | grep -v '\-headers' | grep -v '\-firmware' | cut -d ' ' -f 1)
|
||||
for kernel in $installed_kernels; do
|
||||
header="${kernel}-headers"
|
||||
printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}"
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
|
||||
configurePacman() {
|
||||
conf="/etc/pacman.conf"
|
||||
|
||||
if [ ! -f "$conf" ]; then
|
||||
printf "%b\n" "${RED}${conf} not found.${RC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$ESCALATION_TOOL" sed -i 's/^#Color/Color/' "$conf"
|
||||
"$ESCALATION_TOOL" sed -i '/^Color/a ILoveCandy' "$conf"
|
||||
"$ESCALATION_TOOL" sed -i 's/^#VerbosePkgLists/VerbosePkgLists/' "$conf"
|
||||
"$ESCALATION_TOOL" sed -i 's/^#ParallelDownloads/ParallelDownloads/' "$conf"
|
||||
if ! grep -q "^ParallelDownloads" "$conf"; then
|
||||
printf "%b\n" "${YELLOW}Adding ParallelDownloads...${RC}"
|
||||
"$ESCALATION_TOOL" sed -i '/^#ParallelDownloads/a ParallelDownloads = 20' "$conf"
|
||||
fi
|
||||
"$ESCALATION_TOOL" sed -i "/\[multilib\]/,/Include/"'s/^#//' "$conf"
|
||||
|
||||
printf "%b\n" "${GREEN}pacman.conf configured: Color, ILoveCandy, VerbosePkgLists, ParallelDownloads=5, multilib enabled.${RC}"
|
||||
}
|
||||
|
||||
configureMakepkg() {
|
||||
conf="/etc/makepkg.conf"
|
||||
|
||||
cores=$(nproc)
|
||||
"$ESCALATION_TOOL" sed -i "s/^#MAKEFLAGS=\"-j[0-9]*\"/MAKEFLAGS=\"-j${cores}\"/" "$conf"
|
||||
"$ESCALATION_TOOL" sed -i "s/^MAKEFLAGS=\"-j[0-9]*\"/MAKEFLAGS=\"-j${cores}\"/" "$conf"
|
||||
if ! grep -q "^MAKEFLAGS" "$conf"; then
|
||||
printf "%b\n" "${YELLOW}Adding MAKEFLAGS...${RC}"
|
||||
printf "MAKEFLAGS=\"-j%s\"\n" "$cores" | "$ESCALATION_TOOL" tee -a "$conf" > /dev/null
|
||||
fi
|
||||
printf "%b\n" "${GREEN}MAKEFLAGS set to -j${cores} in makepkg.conf${RC}"
|
||||
}
|
||||
|
||||
checkEnv
|
||||
configurePacman
|
||||
configureMakepkg
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
|
||||
checkBtrfs() {
|
||||
if ! command_exists btrfs; then
|
||||
printf "%b\n" "${RED}btrfs-progs not installed. Install it first.${RC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! mount | grep -q "btrfs"; then
|
||||
printf "%b\n" "${RED}No Btrfs filesystem detected. Snapshots require Btrfs.${RC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
setupSnapper() {
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm snapper snap-pac grub-btrfs
|
||||
|
||||
if [ -f "/etc/snapper/configs/root" ]; then
|
||||
printf "%s\n" "${RED}Error: Existing Snapper 'root' configuration detected. Aborting.${RC}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if mountpoint -q "/.snapshots"; then
|
||||
printf "%s\n" "${RED}Error: /.snapshots is actively mounted. Aborting.${RC}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "/.snapshots" ]; then
|
||||
if "$ESCALATION_TOOL" rmdir "/.snapshots" 2>/dev/null; then
|
||||
printf "%s\n" "${GREEN}Removed empty /.snapshots directory.${RC}"
|
||||
else
|
||||
printf "%s\n" "${RED}Error: /.snapshots exists and is not empty or could not be removed. Aborting to avoid data loss.${RC}" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
"$ESCALATION_TOOL" snapper -c root create-config /
|
||||
|
||||
"$ESCALATION_TOOL" systemctl enable --now snapper-timeline.timer snapper-cleanup.timer 2>/dev/null || true
|
||||
"$ESCALATION_TOOL" systemctl enable --now grub-btrfsd 2>/dev/null || true
|
||||
|
||||
printf "%b\n" "${GREEN}Snapper configured with hourly snapshots.${RC}"
|
||||
printf "%b\n" "${GREEN}snap-pac installed (auto snapshots on pacman operations).${RC}"
|
||||
printf "%b\n" "${GREEN}grub-btrfs installed (boot into snapshots from GRUB menu).${RC}"
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkBtrfs
|
||||
setupSnapper
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
|
||||
setupPaccache() {
|
||||
if ! command_exists paccache; then
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm pacman-contrib
|
||||
fi
|
||||
|
||||
"$ESCALATION_TOOL" systemctl enable --now paccache.timer 2>/dev/null || true
|
||||
printf "%b\n" "${GREEN}paccache.timer enabled (weekly cache cleanup).${RC}"
|
||||
}
|
||||
|
||||
removeOrphans() {
|
||||
orphans=$(pacman -Qtdq 2>/dev/null || true)
|
||||
if [ -n "$orphans" ]; then
|
||||
printf "%b\n" "${YELLOW}Removing orphan packages...${RC}"
|
||||
printf "%s\n" "$orphans"
|
||||
printf "%s\n" "$orphans" | "$ESCALATION_TOOL" xargs "$PACKAGER" -Rns --noconfirm 2>/dev/null || true
|
||||
else
|
||||
printf "%b\n" "${GREEN}No orphan packages found.${RC}"
|
||||
fi
|
||||
}
|
||||
|
||||
cleanJournal() {
|
||||
"$ESCALATION_TOOL" journalctl --vacuum-time=30d 2>/dev/null || true
|
||||
printf "%b\n" "${GREEN}System journal trimmed to 30 days.${RC}"
|
||||
}
|
||||
|
||||
printf "%b\n" "${YELLOW}Arch System Maintenance${RC}"
|
||||
checkEnv
|
||||
setupPaccache
|
||||
removeOrphans
|
||||
cleanJournal
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
. ../common-script.sh
|
||||
|
||||
installPipewirePkgs() {
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm pipewire pipewire-pulse pipewire-alsa pipewire-jack wireplumber lib32-pipewire
|
||||
;;
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y pipewire pipewire-pulse wireplumber pipewire-jack pipewire-audio-client-libraries 2>/dev/null || \
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y pipewire pipewire-pulse wireplumber pipewire-jack
|
||||
;;
|
||||
|
||||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y pipewire pipewire-pulseaudio wireplumber pipewire-jack-audio-connection-kit
|
||||
;;
|
||||
|
||||
zypper)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install pipewire pipewire-pulse wireplumber pipewire-jack
|
||||
;;
|
||||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add pipewire pipewire-pulse wireplumber
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Sy pipewire pipewire-pulse wireplumber
|
||||
;;
|
||||
eopkg)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y pipewire wireplumber
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER. Install pipewire and wireplumber manually.${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
installPipewire() {
|
||||
installPipewirePkgs
|
||||
|
||||
if command_exists systemctl; then
|
||||
"$ESCALATION_TOOL" systemctl --user enable --now pipewire.service pipewire-pulse.service wireplumber.service 2>/dev/null || true
|
||||
printf "%b\n" "${GREEN}PipeWire services enabled.${RC}"
|
||||
fi
|
||||
|
||||
printf "%b\n" "${GREEN}PipeWire with WirePlumber installed. Reboot or relogin to apply.${RC}"
|
||||
}
|
||||
|
||||
checkEnv
|
||||
installPipewire
|
||||
@@ -97,6 +97,29 @@ description = "Yet Another Yogurt - An AUR Helper Written in Go. To know more ab
|
||||
script = "arch/yay-setup.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data.entries]]
|
||||
name = "Pacman Config"
|
||||
description = "Enables Color, ILoveCandy, ParallelDownloads, VerbosePkgLists, multilib in pacman.conf and sets MAKEFLAGS in makepkg.conf."
|
||||
script = "arch/pacman-config.sh"
|
||||
task_list = "PFM"
|
||||
|
||||
[[data.entries]]
|
||||
name = "Snapper Snapshots"
|
||||
description = "Sets up Snapper with hourly Btrfs snapshots, snap-pac hooks, and GRUB boot menu entries."
|
||||
script = "arch/snapshot-setup.sh"
|
||||
task_list = "I PFM SS"
|
||||
|
||||
[[data.entries.preconditions]]
|
||||
matches = true
|
||||
data = "command_exists"
|
||||
values = ["btrfs"]
|
||||
|
||||
[[data.entries]]
|
||||
name = "System Maintenance"
|
||||
description = "Enables paccache.timer, removes orphan packages, and cleans system journals."
|
||||
script = "arch/system-maintenance.sh"
|
||||
task_list = "PFM RP"
|
||||
|
||||
[[data]]
|
||||
name = "Debian"
|
||||
|
||||
@@ -262,3 +285,15 @@ name = "TTY Fonts"
|
||||
description = "This Script will set the default TTY font to Terminus size 32 Bold"
|
||||
script = "terminus-tty.sh"
|
||||
task_list = "I PFM"
|
||||
|
||||
[[data]]
|
||||
name = "PipeWire Audio"
|
||||
description = "Installs PipeWire with WirePlumber session manager for audio (replaces PulseAudio)."
|
||||
script = "pipewire-setup.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data]]
|
||||
name = "Zram Swap"
|
||||
description = "Configures compressed RAM swap via zram-generator with zstd algorithm."
|
||||
script = "zram-setup.sh"
|
||||
task_list = "PFM"
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
. ../common-script.sh
|
||||
|
||||
installZramPkg() {
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm zram-generator
|
||||
;;
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y systemd-zram-generator
|
||||
;;
|
||||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y zram-generator
|
||||
;;
|
||||
zypper)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install zram-generator
|
||||
;;
|
||||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add zram-generator
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Sy zram-generator
|
||||
;;
|
||||
eopkg)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y zram-generator
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER. Install zram-generator manually.${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
setupZram() {
|
||||
installZramPkg
|
||||
|
||||
conf="/etc/systemd/zram-generator.conf"
|
||||
"$ESCALATION_TOOL" tee "$conf" > /dev/null << 'EOF'
|
||||
[zram0]
|
||||
zram-size = ram / 2
|
||||
compression-algorithm = zstd
|
||||
swap-priority = 100
|
||||
EOF
|
||||
|
||||
"$ESCALATION_TOOL" systemctl daemon-reexec
|
||||
"$ESCALATION_TOOL" systemctl start systemd-zram-setup@zram0 2>/dev/null || true
|
||||
|
||||
sysctl_conf="/etc/sysctl.d/99-vm-zram-parameters.conf"
|
||||
"$ESCALATION_TOOL" tee "$sysctl_conf" > /dev/null << 'EOF'
|
||||
vm.swappiness = 10
|
||||
vm.vfs_cache_pressure = 50
|
||||
EOF
|
||||
|
||||
printf "%b\n" "${GREEN}zram configured: zstd compression, swappiness=10.${RC}"
|
||||
printf "%b\n" "${YELLOW}Reboot or run: sudo systemctl start systemd-zram-setup@zram0${RC}"
|
||||
}
|
||||
|
||||
checkEnv
|
||||
setupZram
|
||||
Reference in New Issue
Block a user