Files
ansible-arch/bootstrap.sh
Tuan-Dat Tran 222062c1a4 init
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
2026-03-22 22:51:32 +01:00

46 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
echo "=== Arch Linux Hyprland Setup Bootstrap ==="
echo ""
# Check if running as root
if [ "$EUID" -eq 0 ]; then
echo "Error: Do not run as root. Run as a normal user."
exit 1
fi
# Step 1: Setup sudo access for package installation
echo "[1/4] Setting up sudo access..."
if ! sudo -n true 2>/dev/null; then
echo "$USER ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/local > /dev/null
echo "NOPASSWD sudo configured."
else
echo "Sudo access available."
fi
# Step 2: Install base requirements (git, ansible)
echo "[2/4] Installing base requirements (git, ansible)..."
sudo pacman -Sy --noconfirm git ansible
# Step 3: Clone or update the repo
echo "[3/4] Setting up archsetup..."
if [ -d "$HOME/archsetup/.git" ]; then
echo "Updating archsetup..."
cd "$HOME/archsetup"
git pull
else
echo "Cloning archsetup..."
git clone https://github.com/YOUR_USERNAME/archsetup.git "$HOME/archsetup"
fi
# Step 4: Run the playbook
echo "[4/4] Running Ansible playbook..."
cd "$HOME/archsetup"
ansible-playbook site.yml
echo ""
echo "=== Setup complete! ==="
echo "Logout and login again for shell changes to take effect."
echo "Restart Hyprland (Super + Shift + Q) to apply new configuration."