-
Notifications
You must be signed in to change notification settings - Fork 410
fix: 3 Arch-related script fixes (Waydroid, MyBash pkg mgr, GRUB auto-refresh) #1294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thepinak503
wants to merge
7
commits into
ChrisTitusTech:main
Choose a base branch
from
thepinak503:arch-three-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b264b84
Add 5 Arch system setup scripts: pacman config, pipewire, zram, snapp…
thepinak503 deb36cf
Fix shellcheck issues: remove local/bashisms, add snapper safety guard
thepinak503 630bfef
fix: 3 Arch-related script fixes
thepinak503 07490ba
refactor: move pipewire/zram scripts to system-setup root with cross-…
thepinak503 022e9be
fix: bump ParallelDownloads to 20 in pacman config
thepinak503 54ff34c
fix: explicitly list known pkg managers in _install_pkg, note unsuppo…
thepinak503 0881152
fix: add pipewire-jack for Debian 13+, rename pipewire-pulse to pipew…
thepinak503 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/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-audio-client-libraries 2>/dev/null || \ | ||
| "$ESCALATION_TOOL" "$PACKAGER" install -y pipewire pipewire-pulse wireplumber | ||
| ;; | ||
| dnf) | ||
| "$ESCALATION_TOOL" "$PACKAGER" install -y pipewire pipewire-pulse wireplumber pipewire-jack-audio-connection-kit | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pipewire-pulse should be pipewire-pulseaudio |
||
| ;; | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debian (at least 13) has pipewire-jack as well