all.sh RawHistoryFolder
1#!/bin/bash
2# ArchUp First Boot - Post-boot tasks that require running system
3
4LOG_FILE="/var/log/archup-first-boot.log"
5
6# --- DNS readiness gate ---
7wait_for_dns() {
8 local host="archlinux.org"
9 local timeout=120
10 local elapsed=0
11 while [ "$elapsed" -le "$timeout" ]; do
12 if getent ahosts "$host" >/dev/null 2>&1; then
13 echo "[first-boot] DNS ready after ${elapsed}s" | tee -a "$LOG_FILE"
14 return 0
15 fi
16 sleep 2
17 elapsed=$((elapsed + 2))
18 done
19 echo "[first-boot] FATAL: DNS not ready after ${timeout}s — aborting" | tee -a "$LOG_FILE"
20 return 1
21}
22
23wait_for_dns || exit 1
24
25# Display ArchUp logo
26if [ -f /usr/local/share/archup/logo.txt ]; then
27 cat /usr/local/share/archup/logo.txt
28 echo ""
29fi
30
31echo "=== ArchUp First Boot Setup - $(date) ===" >> "$LOG_FILE"
32
33# Run snapper configuration
34if [ -f /usr/local/share/archup/post-boot/snapper.sh ]; then
35 echo "Configuring snapper..." >> "$LOG_FILE"
36 if bash /usr/local/share/archup/post-boot/snapper.sh >> "$LOG_FILE" 2>&1; then
37 echo "Snapper configured successfully" >> "$LOG_FILE"
38 else
39 echo "Snapper configuration failed (non-critical)" >> "$LOG_FILE"
40 fi
41fi
42
43# Configure firewalld
44if [ -f /usr/local/share/archup/post-boot/firewalld.sh ]; then
45 echo "Configuring firewall..." >> "$LOG_FILE"
46 if bash /usr/local/share/archup/post-boot/firewalld.sh >> "$LOG_FILE" 2>&1; then
47 echo "Firewall configured successfully" >> "$LOG_FILE"
48 else
49 echo "Firewall configuration failed (non-critical)" >> "$LOG_FILE"
50 fi
51fi
52
53# Run SSH key generation
54if [ -f /usr/local/share/archup/post-boot/ssh-keygen.sh ]; then
55 echo "Generating SSH keys..." >> "$LOG_FILE"
56 if bash /usr/local/share/archup/post-boot/ssh-keygen.sh >> "$LOG_FILE" 2>&1; then
57 echo "[OK] SSH keys generated successfully" >> "$LOG_FILE"
58 else
59 echo "[KO] SSH key generation failed (non-critical)" >> "$LOG_FILE"
60 fi
61fi
62
63# Install ble.sh (Bash Line Editor)
64if [ -f /usr/local/share/archup/post-boot/blesh.sh ]; then
65 echo "Installing ble.sh (Bash Line Editor)..." >> "$LOG_FILE"
66 if bash /usr/local/share/archup/post-boot/blesh.sh >> "$LOG_FILE" 2>&1; then
67 echo "[OK] ble.sh installed successfully" >> "$LOG_FILE"
68 else
69 echo "[KO] ble.sh installation failed (non-critical)" >> "$LOG_FILE"
70 fi
71fi
72
73# Install modern CLI toolkit
74if [ -f /usr/local/share/archup/post-boot/cli-tools.sh ]; then
75 echo "Installing modern CLI toolkit..." >> "$LOG_FILE"
76 if bash /usr/local/share/archup/post-boot/cli-tools.sh >> "$LOG_FILE" 2>&1; then
77 echo "[OK] CLI tools installed" >> "$LOG_FILE"
78 else
79 echo "[KO] CLI tools installation failed (non-critical)" >> "$LOG_FILE"
80 fi
81fi
82
83echo "=== First Boot Setup Complete ===" >> "$LOG_FILE"
84
85# Disable this service after first run
86systemctl disable archup-first-boot.service >> "$LOG_FILE" 2>&1