Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ The Makefile's `full-install` target runs 7 sequential scripts for a complete se
Installs essential packages based on your OS:
- **Common packages**: tmux, neovim, git, fish, curl, bat, go, eza, ripgrep, lazygit
- **macOS**: Uses Homebrew (installs it first if missing)
- **Arch Linux**: Uses pacman and installs the yay AUR helper
- **Arch Linux**: Uses pacman, installs the yay AUR helper, and installs `cronie` (cron daemon) for the hourly pacman sync job set up in `07-last-touches.sh`
- **Debian/Ubuntu**: Uses apt (`go` → `golang`, skips lazygit)
- **Alpine**: Uses apk
- **Fedora/RHEL/CentOS**: Uses dnf (skips curl and lazygit)
Expand Down Expand Up @@ -152,6 +152,10 @@ Completes the setup:
- Changes the default shell to Fish
- Creates `~/bin` for personal scripts
- On Gentoo, installs the appropriate kernel-upgrade helper (OpenRC or systemd)
- On Arch, enables the cron daemon and installs an hourly `sudo pacman -Syy`
cron job for the current user; if that user isn't root, grants them
passwordless sudo (`/etc/sudoers.d/99-<user>-nopasswd`) so the unattended
job can actually run

## Manual Setup

Expand Down
4 changes: 4 additions & 0 deletions install-scripts/01-install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ if [ -f /etc/arch-release ]; then

# install packages
sudo pacman -S --noconfirm "${PACKAGES[@]}"

# cronie provides the cron daemon + crontab, needed for the hourly
# pacman sync job set up in 07-last-touches.sh
sudo pacman -S --noconfirm cronie
fi

# if debian or ubuntu install
Expand Down
30 changes: 29 additions & 1 deletion install-scripts/07-last-touches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,32 @@ if [ -f /etc/gentoo-release ]; then

sudo cp scripts/gentoo-kernel-upgrade-$init_system /usr/bin/gentoo-kernel-upgrade

fi
fi

# Arch specific: keep the local package database fresh via an hourly cron job
if [ -f /etc/arch-release ]; then
user="$(id -un)"

# enable & start the cron daemon (cronie was installed in 01-install-packages.sh).
# Skip if systemd isn't actually running, e.g. inside a container build.
if [ -d /run/systemd/system ]; then
sudo systemctl enable --now cronie.service
fi

# cron runs the job non-interactively, so the invoking user needs
# passwordless sudo for it to be able to run pacman unattended
if [ "$EUID" -ne 0 ]; then
sudoers_file="/etc/sudoers.d/99-$user-nopasswd"
sudoers_tmp="$(mktemp)"
echo "$user ALL=(ALL) NOPASSWD: ALL" > "$sudoers_tmp"
sudo visudo -cf "$sudoers_tmp"
sudo install -m 440 "$sudoers_tmp" "$sudoers_file"
rm -f "$sudoers_tmp"
fi

# install/refresh the hourly job, replacing any previous copy of it
cron_cmd="sudo pacman -Syy"
cron_line="0 * * * * $cron_cmd"
existing_cron="$(crontab -l 2>/dev/null | grep -vF "$cron_cmd" || true)"
printf '%s\n%s\n' "$existing_cron" "$cron_line" | crontab -
fi
Loading