forked from basecamp/omarchy
-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathinstall.sh
More file actions
74 lines (60 loc) · 2.15 KB
/
install.sh
File metadata and controls
74 lines (60 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
#set -eEo pipefail
# Terminal control codes
export ANSI_HIDE_CURSOR="\033[?25l"
export ANSI_SHOW_CURSOR="\033[?25h"
export ANSI_CLEAR_SCREEN="\033[2J\033[H"
# Show cursor on exit (cleanup trap to prevent ghosting)
trap 'printf "$ANSI_SHOW_CURSOR"; sudo -k; kill ${SUDO_KEEPALIVE_PID:-} 2>/dev/null' EXIT INT TERM
# Hide cursor during installation for cleaner display
printf "$ANSI_HIDE_CURSOR"
# Validate sudo access and refresh timestamp at the start
echo "🔐 Omarchy Mac Installation requires administrator access..."
if ! sudo -v; then
printf "$ANSI_SHOW_CURSOR"
echo "❌ Error: sudo access required. Please run with proper permissions."
exit 1
fi
# Keep sudo alive throughout installation to prevent password re-prompts
keep_sudo_alive() {
while true; do
sudo -v
sleep 50
done
}
keep_sudo_alive &
SUDO_KEEPALIVE_PID=$!
# Clear any lingering password prompts from display (fixes ghosting)
printf "$ANSI_CLEAR_SCREEN"
# Define Omarchy locations
export OMARCHY_PATH="$HOME/.local/share/omarchy"
export OMARCHY_INSTALL="$OMARCHY_PATH/install"
export OMARCHY_INSTALL_LOG_FILE="/var/log/omarchy-install.log"
export OMARCHY_BIN="$OMARCHY_PATH/bin"
export PATH="$OMARCHY_PATH/bin:$PATH"
# Set default compilation flags (do not suppress warnings or disable FORTIFY_SOURCE)
export CFLAGS=""
export CXXFLAGS=""
export CPPFLAGS=""
export LDFLAGS=""
export MAKEFLAGS="-s"
# Guardrail: install.sh must run from a cloned repo
if [[ ! -d "$OMARCHY_INSTALL" ]]; then
echo "❌ Error: $OMARCHY_INSTALL not found."
echo "This installer must be run from a cloned Omarchy repo in $OMARCHY_PATH."
echo "Recommended:"
echo " wget -qO- https://malik-na.github.io/omarchy-mac/boot.sh | bash"
exit 1
fi
# Set locale first for proper TUI display
source "$OMARCHY_INSTALL/preflight/locale.sh"
# Install
source "$OMARCHY_INSTALL/helpers/all.sh"
source "$OMARCHY_INSTALL/preflight/all.sh"
source "$OMARCHY_INSTALL/packaging/all.sh"
source "$OMARCHY_INSTALL/config/all.sh"
source "$OMARCHY_INSTALL/login/all.sh"
source "$OMARCHY_INSTALL/post-install/all.sh"
# Show cursor at completion
printf "$ANSI_SHOW_CURSOR"