forked from ahmad9059/HyprFlux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·135 lines (113 loc) · 6.43 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·135 lines (113 loc) · 6.43 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
# ============================================================
# install.sh — HyprFlux top-level entry point
# ============================================================
# Supports two modes:
# 1. Piped from curl: sh <(curl -fsSL https://hyprflux.dev/install)
# → Bootstraps git, clones the repo, re-execs from the clone.
# 2. Run locally: bash ~/HyprFlux/install.sh
# → Sources libs and runs directly.
# ============================================================
set -e
# ====== Configurable URLs (available in both bootstrap & main) ======
HYPRFLUX_REPO="${HYPRFLUX_REPO:-https://github.com/ahmad9059/HyprFlux.git}"
HYPRFLUX_DIR="${HYPRFLUX_DIR:-$HOME/HyprFlux}"
# ============================================================
# Bootstrap: detect curl-pipe mode and re-exec from local clone
# ============================================================
# When run via sh <(curl ...), BASH_SOURCE[0] is something like
# /dev/fd/63 — there's no real directory to resolve lib/ from.
# Fix: clone the repo first, then exec the real install.sh.
_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd 2>/dev/null || echo "")"
if [[ -z "$_script_dir" ]] || [[ "$_script_dir" == "/dev/fd" ]] || [[ "$_script_dir" == "/dev" ]] || [[ ! -f "$_script_dir/lib/common.sh" ]]; then
echo ""
echo " Bootstrapping HyprFlux (running from curl pipe)..."
echo ""
# Ensure git is available
if ! command -v git &>/dev/null; then
echo " Installing git..."
sudo pacman -Sy --noconfirm git
fi
# Clone or update the repo
if [[ -d "$HYPRFLUX_DIR/.git" ]]; then
echo " HyprFlux repo found at $HYPRFLUX_DIR, pulling latest..."
git -C "$HYPRFLUX_DIR" pull --ff-only 2>/dev/null || true
else
echo " Cloning HyprFlux to $HYPRFLUX_DIR..."
git clone --depth=1 "$HYPRFLUX_REPO" "$HYPRFLUX_DIR"
fi
# Re-exec the real install.sh from the cloned repo
echo " Launching installer from $HYPRFLUX_DIR/install.sh..."
echo ""
exec bash "$HYPRFLUX_DIR/install.sh"
fi
# ============================================================
# If we reach here, we're running from a real directory with libs
# ============================================================
SCRIPT_DIR="$_script_dir"
unset _script_dir
# ====== Source shared libraries ======
source "$SCRIPT_DIR/lib/common.sh"
source "$SCRIPT_DIR/lib/git.sh"
# ====== Logging ======
setup_logging "$HOME/hyprflux_log/install.log"
# ====== Banner ======
clear
echo -e "\n"
echo -e "${CYAN} ██╗ ██╗██╗ ██╗██████╗ ██████╗ ███████╗██╗ ██╗ ██╗██╗ ██╗${RESET}"
echo -e "${CYAN} ██║ ██║╚██╗ ██╔╝██╔══██╗██╔══██╗██╔════╝██║ ██║ ██║╚██╗██╔╝${RESET}"
echo -e "${CYAN} ███████║ ╚████╔╝ ██████╔╝██████╔╝█████╗ ██║ ██║ ██║ ╚███╔╝ ${RESET}"
echo -e "${CYAN} ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══██╗██╔══╝ ██║ ██║ ██║ ██╔██╗ ${RESET}"
echo -e "${CYAN} ██║ ██║ ██║ ██║ ██║ ██║██║ ███████╗╚██████╔╝██╔╝ ██╗${RESET}"
echo -e "${CYAN} ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝${RESET}"
echo -e "${RED} ✻────────────────────────────ahmad9059────────────────────────────✻${RESET}"
echo -e "${GREEN} Welcome to HyprFlux! lets begin Installation${RESET}"
echo -e "\n"
# ====== Sudo ======
setup_sudo
# ====== System update & prerequisites ======
log_info "Updating system and ensuring git & vim are installed..."
sudo pacman -Syu --noconfirm git vim
log_ok "System updated, git & vim are ready."
# ====== Configurable URLs ======
ARCH_HYPRLAND_REPO="${ARCH_HYPRLAND_REPO:-https://github.com/ahmad9059/Arch-Hyprland.git}"
ARCH_HYPRLAND_DIR="${ARCH_HYPRLAND_DIR:-$HOME/Arch-Hyprland}"
# ====== Step 1: Clone & run Arch-Hyprland ======
ensure_repo "$ARCH_HYPRLAND_REPO" "$ARCH_HYPRLAND_DIR" --depth=1
log_info "Applying HyprFlux automated installation patches..."
# Apply dialog bypass (removes whiptail prompts, pre-selects options)
chmod +x "$HYPRFLUX_DIR/scripts/bypass_dialogs.sh"
bash "$HYPRFLUX_DIR/scripts/bypass_dialogs.sh"
# Additional sed replacements for any remaining prompts
sed -i '/^[[:space:]]*read HYP$/c\HYP="n"' "$ARCH_HYPRLAND_DIR/install.sh"
log_info "Running Arch-Hyprland/install.sh (fully automated)..."
chmod +x "$ARCH_HYPRLAND_DIR/install.sh"
# IMPORTANT: Must cd into the directory because Arch-Hyprland's install.sh
# uses relative paths (e.g., install-scripts/) that only resolve from there.
(cd "$ARCH_HYPRLAND_DIR" && bash install.sh)
log_ok "Arch-Hyprland script completed!"
# ====== Step 2: HyprFlux banner ======
clear
echo -e "\n"
echo -e "${MAGENTA}┌┬┐┌─┐┌┬┐┌─┐┬┬ ┌─┐┌─┐┌─┐ ┬┌┐┌┌─┐┌┬┐┌─┐┬ ┬ ┌─┐┬─┐${RESET}"
echo -e "${MAGENTA} │││ │ │ ├┤ ││ ├┤ └─┐└─┐ ││││└─┐ │ ├─┤│ │ ├┤ ├┬┘${RESET}"
echo -e "${MAGENTA}─┴┘└─┘ ┴ └ ┴┴─┘└─┘└─┘└─┘ ┴┘└┘└─┘ ┴ ┴ ┴┴─┘┴─┘└─┘┴└─${RESET}"
echo -e "${CYAN}✻─────────────────────ahmad9059──────────────────────✻${RESET}"
echo -e "\n"
# ====== Step 3: Clone & run HyprFlux dotsSetup ======
ensure_repo "$HYPRFLUX_REPO" "$HYPRFLUX_DIR" --depth=1
log_info "Running HyprFlux dotsSetup.sh..."
chmod +x "$HYPRFLUX_DIR/dotsSetup.sh"
bash "$HYPRFLUX_DIR/dotsSetup.sh"
# ====== Step 4: Reboot prompt ======
# When HYPRFLUX_ISO_MODE=1, the ISO installer handles reboot — skip the prompt
if [[ -z "${HYPRFLUX_ISO_MODE:-}" ]]; then
if ask_yes_no "Do you want to reboot now?"; then
log_ok "Rebooting..."
sudo reboot
else
log_ok "You chose NOT to reboot. Please reboot later."
fi
else
log_ok "HyprFlux setup complete (ISO mode — reboot handled by installer)."
fi