Compare commits
20 Commits
3761dc707d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c8456a0885 | |||
| add4260a9b | |||
| 419eccf4d0 | |||
| ecb925f510 | |||
| 1a06ffa0dc | |||
| d367c4edd0 | |||
| dc7ef3cc51 | |||
| ab0870db04 | |||
| 8f8c3cac3d | |||
| e2f8313034 | |||
| de88e5b603 | |||
| f39f886c9f | |||
| 05a07ff006 | |||
| 3b96713771 | |||
| f840693320 | |||
| 3abf4920df | |||
| 416487260c | |||
| ad46515b5a | |||
| 041a8c33ea | |||
| d6e94f5050 |
@@ -15,14 +15,11 @@ if ! command -v ags >/dev/null 2>&1; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v sshpass >/dev/null 2>&1; then
|
if ! command -v sshpass >/dev/null 2>&1; then
|
||||||
notify "sshpass ist nicht installiert."
|
notify "sshpass wird benötigt. Bitte installieren: sudo pacman -S sshpass"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$HOMELAB_CONFIG" ]]; then
|
export HOMELAB_CONFIG
|
||||||
export HOMELAB_CONFIG
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$HYPR_DIR"
|
cd "$HYPR_DIR"
|
||||||
ags quit --instance homelab-control >/dev/null 2>&1 || true
|
ags quit --instance homelab-control >/dev/null 2>&1 || true
|
||||||
exec ags run "$HYPR_DIR/ags/homelab.tsx"
|
exec ags run "$HYPR_DIR/ags/homelab.tsx"
|
||||||
|
|||||||
@@ -2,16 +2,32 @@ import app from "ags/gtk4/app";
|
|||||||
import { Astal, Gtk } from "ags/gtk4";
|
import { Astal, Gtk } from "ags/gtk4";
|
||||||
import { execAsync } from "ags/process";
|
import { execAsync } from "ags/process";
|
||||||
import css from "./homelab.css";
|
import css from "./homelab.css";
|
||||||
|
import { writeFile } from "ags/file";
|
||||||
import GLib from "gi://GLib";
|
import GLib from "gi://GLib";
|
||||||
|
|
||||||
|
let hasConfig = false;
|
||||||
|
const CONFIG_PATH = GLib.getenv("HOMELAB_CONFIG") || `${GLib.getenv("HOME")}/.config/homelab/config.yaml`;
|
||||||
|
|
||||||
|
function saveConfig(host: string, user: string, port: string) {
|
||||||
|
const yaml = `# Homelab Configuration\ngenerated_by: Omeron\n\nserver:\n address: "${host}"\n username: "${user}"\n port: ${port}\n\ncontrol_center:\n refresh_interval: 5\n theme: "dark"\n\nfeatures:\n docker: true\n services: true\n storage: true\n network: true\n monitoring: true\n`;
|
||||||
|
try {
|
||||||
|
writeFile(CONFIG_PATH, yaml);
|
||||||
|
} catch (e) {
|
||||||
|
print(`[homelab] save error: ${e}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hasConfig = true;
|
||||||
|
rebuild();
|
||||||
|
}
|
||||||
|
|
||||||
function loadConfig() {
|
function loadConfig() {
|
||||||
const configPath = GLib.getenv("HOMELAB_CONFIG") || `${GLib.getenv("HOME")}/.config/homelab/config.yaml`;
|
|
||||||
const defaults = { host: "10.0.0.15", user: "root", port: 22 };
|
const defaults = { host: "10.0.0.15", user: "root", port: 22 };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [ok, contents] = GLib.file_get_contents(configPath);
|
const [ok, contents] = GLib.file_get_contents(CONFIG_PATH);
|
||||||
if (!ok || !contents) return defaults;
|
if (!ok || !contents) return defaults;
|
||||||
|
|
||||||
|
hasConfig = true;
|
||||||
const text = new TextDecoder().decode(contents);
|
const text = new TextDecoder().decode(contents);
|
||||||
const lines = text.split("\n");
|
const lines = text.split("\n");
|
||||||
let host = defaults.host;
|
let host = defaults.host;
|
||||||
@@ -1113,6 +1129,51 @@ function startRefreshTimer() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SetupView() {
|
||||||
|
let host = "";
|
||||||
|
let user = "root";
|
||||||
|
let port = "22";
|
||||||
|
|
||||||
|
function doSave() {
|
||||||
|
if (!host) return;
|
||||||
|
saveConfig(host, user || "root", port || "22");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<box class="login-panel" orientation={Gtk.Orientation.VERTICAL} spacing={14}>
|
||||||
|
<box orientation={Gtk.Orientation.VERTICAL} spacing={4}>
|
||||||
|
<label class="title" xalign={0} label="Homelab Control Center" />
|
||||||
|
<label class="subtitle" xalign={0} label="Ersteinrichtung — Serververbindung konfigurieren" />
|
||||||
|
</box>
|
||||||
|
<entry
|
||||||
|
onChanged={self => { host = self.text || self.get_text(); }}
|
||||||
|
onActivate={doSave}
|
||||||
|
placeholderText="Server-Adresse (IP oder Domain)"
|
||||||
|
hexpand
|
||||||
|
/>
|
||||||
|
<entry
|
||||||
|
onChanged={self => { user = self.text || self.get_text(); }}
|
||||||
|
onActivate={doSave}
|
||||||
|
placeholderText="SSH-Benutzer"
|
||||||
|
text="root"
|
||||||
|
hexpand
|
||||||
|
/>
|
||||||
|
<entry
|
||||||
|
onChanged={self => { port = self.text || self.get_text(); }}
|
||||||
|
onActivate={doSave}
|
||||||
|
placeholderText="SSH-Port"
|
||||||
|
text="22"
|
||||||
|
hexpand
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
class="button primary"
|
||||||
|
label="Speichern"
|
||||||
|
onClicked={doSave}
|
||||||
|
/>
|
||||||
|
</box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function HomelabWindow() {
|
function HomelabWindow() {
|
||||||
return (
|
return (
|
||||||
<window
|
<window
|
||||||
@@ -1132,7 +1193,7 @@ function HomelabWindow() {
|
|||||||
return false;
|
return false;
|
||||||
}} />
|
}} />
|
||||||
<box marginTop={WINDOW_MARGIN_TOP}>
|
<box marginTop={WINDOW_MARGIN_TOP}>
|
||||||
{authed ? <DashboardView /> : <LoginView />}
|
{!hasConfig ? <SetupView /> : (authed ? <DashboardView /> : <LoginView />)}
|
||||||
</box>
|
</box>
|
||||||
</window>
|
</window>
|
||||||
);
|
);
|
||||||
@@ -1143,7 +1204,7 @@ function rebuild() {
|
|||||||
if (!win) {
|
if (!win) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
win.set_child(<box marginTop={WINDOW_MARGIN_TOP}>{authed ? <DashboardView /> : <LoginView />}</box> as Gtk.Widget);
|
win.set_child(<box marginTop={WINDOW_MARGIN_TOP}>{!hasConfig ? <SetupView /> : (authed ? <DashboardView /> : <LoginView />)}</box> as Gtk.Widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.start({
|
app.start({
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ $menu = wofi
|
|||||||
# Autostart necessary processes (like notifications daemons, status bars, etc.)
|
# Autostart necessary processes (like notifications daemons, status bars, etc.)
|
||||||
# Or execute your favorite apps at launch like this:
|
# Or execute your favorite apps at launch like this:
|
||||||
|
|
||||||
exec-once = sh -c 'if command -v awww-daemon >/dev/null 2>&1; then awww-daemon && awww img /home/pascal/Bilder/Wallpaper/forest.jpg; elif command -v swww-daemon >/dev/null 2>&1; then swww-daemon; else hyprpaper; fi'
|
exec-once = sh -c 'if command -v awww-daemon >/dev/null 2>&1; then awww-daemon & awww img /home/pascal/Bilder/Wallpaper/forest.jpg; elif command -v swww-daemon >/dev/null 2>&1; then swww-daemon & hyprctl hyprpaper wallpaper "eDP-1,/home/pascal/Bilder/Wallpaper/forest.jpg"; else hyprpaper; fi'
|
||||||
exec-once = waybar
|
exec-once = waybar
|
||||||
exec-once = swaync
|
exec-once = swaync
|
||||||
exec-once = env WIDGET_PANEL_START_HIDDEN=1 ~/.config/hypr/Scripts/widget-panel.sh
|
exec-once = env WIDGET_PANEL_START_HIDDEN=1 ~/.config/hypr/Scripts/widget-panel.sh
|
||||||
@@ -80,7 +80,7 @@ general {
|
|||||||
layout = dwindle
|
layout = dwindle
|
||||||
}
|
}
|
||||||
|
|
||||||
source = ~/.config/hypr/current-theme.conf
|
source = /home/pascal/.config/hypr/current-theme.conf
|
||||||
|
|
||||||
# https://wiki.hypr.land/Configuring/Variables/#decoration
|
# https://wiki.hypr.land/Configuring/Variables/#decoration
|
||||||
decoration {
|
decoration {
|
||||||
|
|||||||
154
install.sh
154
install.sh
@@ -9,26 +9,41 @@ export OMERON_PROJECT_DIR="$OMERON_ROOT"
|
|||||||
|
|
||||||
source "$OMERON_ROOT/lib/log.sh"
|
source "$OMERON_ROOT/lib/log.sh"
|
||||||
source "$OMERON_ROOT/lib/tui.sh"
|
source "$OMERON_ROOT/lib/tui.sh"
|
||||||
|
source "$OMERON_ROOT/lib/tui-fs.sh"
|
||||||
source "$OMERON_ROOT/lib/utils.sh"
|
source "$OMERON_ROOT/lib/utils.sh"
|
||||||
source "$OMERON_ROOT/lib/config.sh"
|
source "$OMERON_ROOT/lib/config.sh"
|
||||||
source "$OMERON_ROOT/lib/modules.sh"
|
source "$OMERON_ROOT/lib/modules.sh"
|
||||||
|
source "$OMERON_ROOT/lib/version.sh"
|
||||||
|
|
||||||
OMERON_FRESH_INSTALL="${OMERON_FRESH_INSTALL:-0}"
|
OMERON_FRESH_INSTALL="${OMERON_FRESH_INSTALL:-0}"
|
||||||
export OMERON_FRESH_INSTALL
|
export OMERON_FRESH_INSTALL
|
||||||
|
OMERON_UPDATE_MODE="${OMERON_UPDATE_MODE:-0}"
|
||||||
|
export OMERON_UPDATE_MODE
|
||||||
|
|
||||||
DEFAULT_MODULES=(
|
DEFAULT_MODULES=(
|
||||||
"core/preflight"
|
"core/preflight"
|
||||||
"core/packages"
|
"core/packages"
|
||||||
"core/ags"
|
"core/ags"
|
||||||
|
"homelab/setup"
|
||||||
"core/dotfiles"
|
"core/dotfiles"
|
||||||
"core/services"
|
"core/services"
|
||||||
"homelab/setup"
|
|
||||||
"optional/install"
|
"optional/install"
|
||||||
"post/apply-theme"
|
"post/apply-theme"
|
||||||
"core/sddm"
|
"core/sddm"
|
||||||
)
|
)
|
||||||
|
|
||||||
FRESH_MODULES=(
|
FRESH_MODULES=(
|
||||||
|
"core/packages"
|
||||||
|
"core/ags"
|
||||||
|
"homelab/setup"
|
||||||
|
"core/dotfiles"
|
||||||
|
"core/services"
|
||||||
|
"optional/install"
|
||||||
|
"post/apply-theme"
|
||||||
|
"core/sddm"
|
||||||
|
)
|
||||||
|
|
||||||
|
UPDATE_MODULES=(
|
||||||
"core/packages"
|
"core/packages"
|
||||||
"core/ags"
|
"core/ags"
|
||||||
"core/dotfiles"
|
"core/dotfiles"
|
||||||
@@ -51,6 +66,7 @@ Usage: ./install.sh [OPTIONS]
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
--fresh Full system setup (Hyprland + GPU drivers + all deps)
|
--fresh Full system setup (Hyprland + GPU drivers + all deps)
|
||||||
|
--update Update existing installation (skip preflight + GPU setup)
|
||||||
--modules m1,m2 Run only specific modules (comma-separated)
|
--modules m1,m2 Run only specific modules (comma-separated)
|
||||||
--skip m1,m2 Skip specific modules (comma-separated)
|
--skip m1,m2 Skip specific modules (comma-separated)
|
||||||
--skip-packages Skip package installation
|
--skip-packages Skip package installation
|
||||||
@@ -61,6 +77,7 @@ Options:
|
|||||||
Examples:
|
Examples:
|
||||||
./install.sh Interactive (detects fresh install automatically)
|
./install.sh Interactive (detects fresh install automatically)
|
||||||
./install.sh --fresh Force full setup on a running system
|
./install.sh --fresh Force full setup on a running system
|
||||||
|
./install.sh --update Update existing installation
|
||||||
./install.sh --modules core/dotfiles,post/apply-theme
|
./install.sh --modules core/dotfiles,post/apply-theme
|
||||||
./install.sh --skip core/packages
|
./install.sh --skip core/packages
|
||||||
EOF
|
EOF
|
||||||
@@ -84,7 +101,8 @@ list_modules() {
|
|||||||
parse_args() {
|
parse_args() {
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--fresh) OMERON_FRESH_INSTALL=1; shift ;;
|
--fresh) OMERON_FRESH_INSTALL=1; OMERON_UPDATE_MODE=0; shift ;;
|
||||||
|
--update) OMERON_UPDATE_MODE=1; OMERON_FRESH_INSTALL=0; shift ;;
|
||||||
--modules) IFS=',' read -ra RUN_MODULES <<< "$2"; shift 2 ;;
|
--modules) IFS=',' read -ra RUN_MODULES <<< "$2"; shift 2 ;;
|
||||||
--skip) IFS=',' read -ra SKIP_MODULES <<< "$2"; shift 2 ;;
|
--skip) IFS=',' read -ra SKIP_MODULES <<< "$2"; shift 2 ;;
|
||||||
--skip-packages) SKIP_MODULES+=("core/packages"); shift ;;
|
--skip-packages) SKIP_MODULES+=("core/packages"); shift ;;
|
||||||
@@ -100,27 +118,23 @@ detect_environment() {
|
|||||||
tui_detect
|
tui_detect
|
||||||
|
|
||||||
if ((!OMERON_HAS_GUM)) && have pacman; then
|
if ((!OMERON_HAS_GUM)) && have pacman; then
|
||||||
printf '\033[1;36m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m\n'
|
tui_fs_show_msg "Installing gum for interactive TUI..."
|
||||||
printf '\033[1;36m O M E R O N — Modular System Setup Framework\033[0m\n'
|
tui_install_gum 2>/dev/null || true
|
||||||
printf '\033[1;36m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m\n'
|
tui_detect
|
||||||
printf '\n'
|
if ((OMERON_HAS_GUM)); then
|
||||||
printf ' \033[1;33mgum is not installed.\033[0m Installing it enables the full TUI experience.\n'
|
tui_fs_show_ok "gum installed"
|
||||||
printf '\n'
|
else
|
||||||
|
tui_fs_show_msg "using terminal prompts"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if tui_install_gum; then
|
if ((OMERON_UPDATE_MODE)); then
|
||||||
printf ' \033[1;32m✓ gum installed!\033[0m\n'
|
tui_fs_show_ok "Update mode — existing installation detected"
|
||||||
else
|
return
|
||||||
if ((OMERON_HAS_WHIPTAIL)); then
|
|
||||||
printf ' \033[1;33musing whiptail as fallback\033[0m\n'
|
|
||||||
else
|
|
||||||
printf ' \033[1;33musing basic text mode (install gum for UI: pacman -S gum)\033[0m\n'
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
printf '\n'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ((!OMERON_FRESH_INSTALL)) && ((${#RUN_MODULES[@]} == 0)); then
|
if ((!OMERON_FRESH_INSTALL)) && ((${#RUN_MODULES[@]} == 0)); then
|
||||||
log_info "Checking for fresh install..."
|
tui_fs_show_msg "Checking for fresh install..."
|
||||||
if is_fresh_install; then
|
if is_fresh_install; then
|
||||||
OMERON_FRESH_INSTALL=1
|
OMERON_FRESH_INSTALL=1
|
||||||
export OMERON_FRESH_INSTALL
|
export OMERON_FRESH_INSTALL
|
||||||
@@ -130,9 +144,12 @@ detect_environment() {
|
|||||||
if ((OMERON_FRESH_INSTALL)); then
|
if ((OMERON_FRESH_INSTALL)); then
|
||||||
if ((!OMERON_HAS_GUM)) && have pacman; then
|
if ((!OMERON_HAS_GUM)) && have pacman; then
|
||||||
tui_install_gum 2>/dev/null || true
|
tui_install_gum 2>/dev/null || true
|
||||||
|
tui_detect
|
||||||
fi
|
fi
|
||||||
if ! have paru && ! have yay; then
|
if ! have paru && ! have yay; then
|
||||||
|
tui_fs_show_msg "Installing AUR helper..."
|
||||||
install_aur_helper
|
install_aur_helper
|
||||||
|
tui_fs_show_ok "AUR helper ready"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -147,7 +164,9 @@ collect_modules() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local modules=()
|
local modules=()
|
||||||
if ((OMERON_FRESH_INSTALL)); then
|
if ((OMERON_UPDATE_MODE)); then
|
||||||
|
modules=("${UPDATE_MODULES[@]}")
|
||||||
|
elif ((OMERON_FRESH_INSTALL)); then
|
||||||
modules=("${FRESH_MODULES[@]}")
|
modules=("${FRESH_MODULES[@]}")
|
||||||
else
|
else
|
||||||
modules=("${DEFAULT_MODULES[@]}")
|
modules=("${DEFAULT_MODULES[@]}")
|
||||||
@@ -173,18 +192,21 @@ collect_all_interactive() {
|
|||||||
exec 1>&2
|
exec 1>&2
|
||||||
|
|
||||||
local modules=()
|
local modules=()
|
||||||
if ((OMERON_FRESH_INSTALL)); then
|
if ((OMERON_UPDATE_MODE)); then
|
||||||
|
modules=("${UPDATE_MODULES[@]}")
|
||||||
|
elif ((OMERON_FRESH_INSTALL)); then
|
||||||
modules=("${FRESH_MODULES[@]}")
|
modules=("${FRESH_MODULES[@]}")
|
||||||
else
|
else
|
||||||
modules=("${DEFAULT_MODULES[@]}")
|
modules=("${DEFAULT_MODULES[@]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local module_order=()
|
local module_order=()
|
||||||
|
local idx=1
|
||||||
|
local total=${#modules[@]}
|
||||||
|
|
||||||
for mod in "${modules[@]}"; do
|
for mod in "${modules[@]}"; do
|
||||||
local module_file="$OMERON_MODULE_DIR/$mod.sh"
|
local module_file="$OMERON_MODULE_DIR/$mod.sh"
|
||||||
[[ -f "$module_file" ]] || continue
|
[[ -f "$module_file" ]] || continue
|
||||||
|
|
||||||
source "$module_file" 2>/dev/null || continue
|
source "$module_file" 2>/dev/null || continue
|
||||||
|
|
||||||
local description=""
|
local description=""
|
||||||
@@ -192,32 +214,35 @@ collect_all_interactive() {
|
|||||||
description="$(module_description)"
|
description="$(module_description)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local required=0
|
||||||
if declare -F "module_required" >/dev/null 2>&1; then
|
if declare -F "module_required" >/dev/null 2>&1; then
|
||||||
if module_required; then
|
if module_required; then
|
||||||
module_order+=("$module_file")
|
required=1
|
||||||
continue
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf ' '
|
if ((required)); then
|
||||||
if tui_confirm "${description:-$mod}"; then
|
tui_fs_select_module "$idx" "$total" "$mod" "$description" 1
|
||||||
|
module_order+=("$module_file")
|
||||||
|
((idx++))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if tui_fs_select_module "$idx" "$total" "$mod" "$description" 0; then
|
||||||
module_order+=("$module_file")
|
module_order+=("$module_file")
|
||||||
fi
|
fi
|
||||||
|
((idx++))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if ! tui_fs_confirm_start "${#module_order[@]}"; then
|
||||||
|
exec 3>&-
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
printf '%s\n' "${module_order[@]}" >&3
|
printf '%s\n' "${module_order[@]}" >&3
|
||||||
exec 3>&-
|
exec 3>&-
|
||||||
}
|
}
|
||||||
|
|
||||||
show_banner() {
|
|
||||||
tui_header "O M E R O N — Modular System Setup"
|
|
||||||
printf '\n'
|
|
||||||
if ((OMERON_FRESH_INSTALL)); then
|
|
||||||
tui_info "Fresh install: Hyprland + GPU drivers + all dependencies"
|
|
||||||
printf '\n'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
OMERON_LOG_FILE="${OMERON_LOG_FILE:-$HOME/.local/share/omeron/install-$(date +%Y%m%d-%H%M%S).log}"
|
OMERON_LOG_FILE="${OMERON_LOG_FILE:-$HOME/.local/share/omeron/install-$(date +%Y%m%d-%H%M%S).log}"
|
||||||
export OMERON_LOG_FILE
|
export OMERON_LOG_FILE
|
||||||
@@ -229,30 +254,43 @@ main() {
|
|||||||
log_info "Log file: $OMERON_LOG_FILE"
|
log_info "Log file: $OMERON_LOG_FILE"
|
||||||
log_info "Project: $OMERON_ROOT"
|
log_info "Project: $OMERON_ROOT"
|
||||||
|
|
||||||
detect_environment
|
sudo_init
|
||||||
|
trap 'sudo_cleanup; tui_fs_exit' EXIT
|
||||||
|
|
||||||
show_banner
|
tui_fs_init
|
||||||
|
|
||||||
tui_separator
|
if ((!OMERON_FRESH_INSTALL)) && ((!OMERON_UPDATE_MODE)) && ((${#RUN_MODULES[@]} == 0)); then
|
||||||
printf '\n'
|
if version_read; then
|
||||||
if ! tui_confirm "Continue with installation"; then
|
if tui_fs_ask_update "${OMERON_INSTALL_DATE:-unknown}"; then
|
||||||
tui_info "Installation cancelled."
|
OMERON_UPDATE_MODE=1
|
||||||
exit 0
|
export OMERON_UPDATE_MODE
|
||||||
|
tui_fs_show_ok "Update mode activated"
|
||||||
fi
|
fi
|
||||||
printf '\n'
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
detect_environment
|
||||||
|
|
||||||
local modules_to_run=()
|
local modules_to_run=()
|
||||||
if ((${#RUN_MODULES[@]})); then
|
if ((${#RUN_MODULES[@]})); then
|
||||||
mapfile -t modules_to_run < <(collect_modules)
|
mapfile -t modules_to_run < <(collect_modules)
|
||||||
else
|
else
|
||||||
mapfile -t modules_to_run < <(collect_all_interactive)
|
local collected
|
||||||
|
collected="$(collect_all_interactive)" || {
|
||||||
|
tui_fs_exit
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
mapfile -t modules_to_run <<< "$collected"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ((${#modules_to_run[@]} == 0)); then
|
if ((${#modules_to_run[@]} == 0)); then
|
||||||
tui_warn "No modules selected. Nothing to do."
|
tui_fs_show_msg "No modules selected. Nothing to do."
|
||||||
|
tui_fs_exit
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
tui_fs_start_execution
|
||||||
|
|
||||||
local total=${#modules_to_run[@]}
|
local total=${#modules_to_run[@]}
|
||||||
local idx=1
|
local idx=1
|
||||||
|
|
||||||
@@ -261,6 +299,8 @@ main() {
|
|||||||
if source "$module_path" 2>/dev/null && declare -F "module_description" >/dev/null 2>&1; then
|
if source "$module_path" 2>/dev/null && declare -F "module_description" >/dev/null 2>&1; then
|
||||||
description="$(module_description)"
|
description="$(module_description)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
tui_fs_set_step "$idx" "$total" "${description:-$(basename "$module_path" .sh)}"
|
||||||
printf '\n'
|
printf '\n'
|
||||||
log_step "$idx" "$total" "${description:-$(basename "$module_path" .sh)}"
|
log_step "$idx" "$total" "${description:-$(basename "$module_path" .sh)}"
|
||||||
|
|
||||||
@@ -269,15 +309,24 @@ main() {
|
|||||||
if declare -F "module_required" >/dev/null 2>&1; then
|
if declare -F "module_required" >/dev/null 2>&1; then
|
||||||
source "$module_path"
|
source "$module_path"
|
||||||
if module_required 2>/dev/null; then
|
if module_required 2>/dev/null; then
|
||||||
|
tui_fs_exit
|
||||||
tui_error "Required module failed. Aborting."
|
tui_error "Required module failed. Aborting."
|
||||||
exit $rc
|
exit $rc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
tui_warn "Module completed with warnings"
|
tui_fs_show_msg "Module completed with warnings"
|
||||||
}
|
}
|
||||||
((idx++))
|
((idx++))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
tui_fs_exit
|
||||||
|
|
||||||
|
if ((OMERON_UPDATE_MODE)); then
|
||||||
|
version_update
|
||||||
|
else
|
||||||
|
version_write
|
||||||
|
fi
|
||||||
|
|
||||||
printf '\n'
|
printf '\n'
|
||||||
tui_header "O M E R O N — Done"
|
tui_header "O M E R O N — Done"
|
||||||
tui_success "Installation Complete!"
|
tui_success "Installation Complete!"
|
||||||
@@ -285,17 +334,24 @@ main() {
|
|||||||
tui_info "Log: ${OMERON_LOG_FILE}"
|
tui_info "Log: ${OMERON_LOG_FILE}"
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|
||||||
if ((OMERON_FRESH_INSTALL)); then
|
if ((OMERON_UPDATE_MODE)); then
|
||||||
|
tui_bold "Update complete!"
|
||||||
|
tui_list \
|
||||||
|
"Reload config: hyprctl reload" \
|
||||||
|
"Re-run updater: ./install.sh --update"
|
||||||
|
elif ((OMERON_FRESH_INSTALL)); then
|
||||||
tui_bold "Your system is ready for Hyprland!"
|
tui_bold "Your system is ready for Hyprland!"
|
||||||
tui_list \
|
tui_list \
|
||||||
"Start Hyprland: Hyprland" \
|
"Start Hyprland: Hyprland" \
|
||||||
"Or enable SDDM: sudo systemctl enable --now sddm" \
|
"Or enable SDDM: sudo systemctl enable --now sddm" \
|
||||||
"Reload config: hyprctl reload"
|
"Reload config: hyprctl reload" \
|
||||||
|
"Update later: ./install.sh --update"
|
||||||
else
|
else
|
||||||
tui_bold "What next?"
|
tui_bold "What next?"
|
||||||
tui_list \
|
tui_list \
|
||||||
"Reload config: hyprctl reload" \
|
"Reload config: hyprctl reload" \
|
||||||
"Re-run installer: ./install.sh"
|
"Re-run installer: ./install.sh" \
|
||||||
|
"Update later: ./install.sh --update"
|
||||||
fi
|
fi
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|
||||||
|
|||||||
211
lib/tui-fs.sh
Normal file
211
lib/tui-fs.sh
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
TUI_FS_ACTIVE=0
|
||||||
|
TUI_FS_ROWS=0
|
||||||
|
TUI_FS_COLS=0
|
||||||
|
TUI_FS_CURRENT=0
|
||||||
|
TUI_FS_TOTAL=0
|
||||||
|
TUI_FS_LABEL=""
|
||||||
|
TUI_FS_SAVED_STTY=""
|
||||||
|
|
||||||
|
tui_fs_init() {
|
||||||
|
TUI_FS_SAVED_STTY=$(stty -g 2>/dev/null || true)
|
||||||
|
TUI_FS_ROWS=$(tput lines 2>/dev/null || echo 24)
|
||||||
|
TUI_FS_COLS=$(tput cols 2>/dev/null || echo 80)
|
||||||
|
|
||||||
|
tput smcup 2>/dev/null || true
|
||||||
|
tput civis 2>/dev/null || true
|
||||||
|
tput clear 2>/dev/null || true
|
||||||
|
|
||||||
|
TUI_FS_ACTIVE=1
|
||||||
|
_tui_fs_draw_selection_banner
|
||||||
|
}
|
||||||
|
|
||||||
|
tui_fs_exit() {
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && return
|
||||||
|
TUI_FS_ACTIVE=0
|
||||||
|
tput cnorm 2>/dev/null || true
|
||||||
|
tput rmcup 2>/dev/null || true
|
||||||
|
[[ -n "$TUI_FS_SAVED_STTY" ]] && stty "$TUI_FS_SAVED_STTY" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
_tui_fs_hline() {
|
||||||
|
local len=$1
|
||||||
|
local i
|
||||||
|
for ((i=0; i<len; i++)); do printf '─'; done
|
||||||
|
}
|
||||||
|
|
||||||
|
_tui_fs_title() {
|
||||||
|
local cols=$TUI_FS_COLS
|
||||||
|
local c=$((cols - 4))
|
||||||
|
((c < 30)) && c=30
|
||||||
|
printf '\033[1;36m╭%s╮\033[0m\n' "$(_tui_fs_hline "$c")"
|
||||||
|
printf '\033[1;36m│\033[0m \033[1;37m◆ Omeron\033[0m — \033[2mModular System Setup\033[0m \033[1;36m│\033[0m\n'
|
||||||
|
printf '\033[1;36m╰%s╯\033[0m\n' "$(_tui_fs_hline "$c")"
|
||||||
|
printf '\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
_tui_fs_draw_selection_banner() {
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && return
|
||||||
|
tput clear 2>/dev/null || true
|
||||||
|
_tui_fs_title
|
||||||
|
}
|
||||||
|
|
||||||
|
tui_fs_show_msg() {
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && { printf '%s\n' "$*"; return; }
|
||||||
|
printf ' \033[1;34m▶\033[0m %s\n' "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
tui_fs_show_ok() {
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && { printf '%s\n' "$*"; return; }
|
||||||
|
printf ' \033[1;32m✓\033[0m %s\n' "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
tui_fs_start_execution() {
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && return
|
||||||
|
TUI_FS_CURRENT=0
|
||||||
|
TUI_FS_TOTAL=0
|
||||||
|
TUI_FS_LABEL=""
|
||||||
|
}
|
||||||
|
|
||||||
|
tui_fs_set_step() {
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && return
|
||||||
|
TUI_FS_CURRENT=$1
|
||||||
|
TUI_FS_TOTAL=$2
|
||||||
|
TUI_FS_LABEL="${3:-}"
|
||||||
|
_tui_fs_draw_exec_header
|
||||||
|
}
|
||||||
|
|
||||||
|
_tui_fs_draw_exec_header() {
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && return
|
||||||
|
tput cup 0 0 2>/dev/null || true
|
||||||
|
tput clear 2>/dev/null || true
|
||||||
|
|
||||||
|
local cols=$TUI_FS_COLS
|
||||||
|
local c=$((cols - 4))
|
||||||
|
((c < 30)) && c=30
|
||||||
|
local hline
|
||||||
|
hline="$(_tui_fs_hline "$c")"
|
||||||
|
|
||||||
|
printf '\033[1;36m╭%s╮\033[0m\n' "$hline"
|
||||||
|
local title="◆ Omeron"
|
||||||
|
if [[ -n "$TUI_FS_LABEL" ]]; then
|
||||||
|
title+=" — ${TUI_FS_LABEL}"
|
||||||
|
fi
|
||||||
|
printf '\033[1;36m│\033[0m \033[1;37m%-*s\033[0m \033[1;36m│\033[0m\n' "$c" "$title"
|
||||||
|
|
||||||
|
local progress=0
|
||||||
|
if ((TUI_FS_TOTAL > 0)); then
|
||||||
|
progress=$(( TUI_FS_CURRENT * 100 / TUI_FS_TOTAL ))
|
||||||
|
((progress > 100)) && progress=100
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bar_width=$((c - 24))
|
||||||
|
((bar_width < 10)) && bar_width=10
|
||||||
|
local filled=$(( progress * bar_width / 100 ))
|
||||||
|
local bar=""
|
||||||
|
local i
|
||||||
|
for ((i=0; i<filled && i<bar_width; i++)); do bar+='▓'; done
|
||||||
|
for ((i=filled; i<bar_width; i++)); do bar+='░'; done
|
||||||
|
|
||||||
|
local counter="[$TUI_FS_CURRENT/$TUI_FS_TOTAL]"
|
||||||
|
printf '\033[1;36m│\033[0m %s %s \033[1;33m%3d%%\033[0m \033[1;36m│\033[0m\n' "$counter" "$bar" "$progress"
|
||||||
|
printf '\033[1;36m╰%s╯\033[0m\n' "$hline"
|
||||||
|
printf '\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
tui_fs_select_module() {
|
||||||
|
local idx="$1"
|
||||||
|
local total="$2"
|
||||||
|
local label="$3"
|
||||||
|
local description="${4:-$label}"
|
||||||
|
local required="${5:-0}"
|
||||||
|
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && {
|
||||||
|
if ((required)); then return 0; fi
|
||||||
|
printf ' '
|
||||||
|
tui_confirm "$description" && return 0 || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
tput cup 4 0 2>/dev/null || true
|
||||||
|
tput ed 2>/dev/null || true
|
||||||
|
|
||||||
|
printf ' \033[1;36m┌─\033[0m \033[1;37mModule %d/%d\033[0m\n' "$idx" "$total"
|
||||||
|
printf ' \033[1;36m│\033[0m\n'
|
||||||
|
printf ' \033[1;36m│\033[0m \033[1;37m%s\033[0m\n' "$description"
|
||||||
|
printf ' \033[1;36m│\033[0m \033[2m%s\033[0m\n' "$label"
|
||||||
|
printf ' \033[1;36m└─\033[0m\n'
|
||||||
|
printf '\n'
|
||||||
|
|
||||||
|
if ((required)); then
|
||||||
|
printf ' \033[1;33m▶\033[0m required module\n'
|
||||||
|
printf '\n'
|
||||||
|
printf ' Press any key to continue... '
|
||||||
|
read -n 1 -s -r
|
||||||
|
printf '\n'
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ((OMERON_HAS_GUM)); then
|
||||||
|
gum confirm "Include this module?"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf ' \033[1;36m?\033[0m Include this module? \033[1m[Y/n]\033[0m '
|
||||||
|
read -r response
|
||||||
|
response="${response:-Y}"
|
||||||
|
[[ "$response" =~ ^[yY](es)?$ ]]
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
tui_fs_confirm_start() {
|
||||||
|
local count="$1"
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && return 0
|
||||||
|
|
||||||
|
tput cup 4 0 2>/dev/null || true
|
||||||
|
tput ed 2>/dev/null || true
|
||||||
|
|
||||||
|
printf ' \033[1;36m┌─\033[0m \033[1;37mSelection Complete\033[0m\n'
|
||||||
|
printf ' \033[1;36m│\033[0m\n'
|
||||||
|
printf ' \033[1;36m│\033[0m \033[1;37m%d\033[0m module(s) selected\n' "$count"
|
||||||
|
printf ' \033[1;36m└─\033[0m\n'
|
||||||
|
printf '\n'
|
||||||
|
|
||||||
|
if ((OMERON_HAS_GUM)); then
|
||||||
|
gum confirm "Start installation?"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf ' \033[1;36m?\033[0m Start installation? \033[1m[Y/n]\033[0m '
|
||||||
|
read -r response
|
||||||
|
response="${response:-Y}"
|
||||||
|
[[ "$response" =~ ^[yY](es)?$ ]]
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
tui_fs_ask_update() {
|
||||||
|
local date="$1"
|
||||||
|
[[ "$TUI_FS_ACTIVE" -eq 0 ]] && return 1
|
||||||
|
|
||||||
|
tput cup 4 0 2>/dev/null || true
|
||||||
|
tput ed 2>/dev/null || true
|
||||||
|
|
||||||
|
printf ' \033[1;36m┌─\033[0m \033[1;37mExisting Installation Found\033[0m\n'
|
||||||
|
printf ' \033[1;36m│\033[0m\n'
|
||||||
|
printf ' \033[1;36m│\033[0m Installed: \033[1;37m%s\033[0m\n' "$date"
|
||||||
|
printf ' \033[1;36m│\033[0m Update applies new dotfiles, packages and config\n'
|
||||||
|
printf ' \033[1;36m│\033[0m without re-running GPU/fresh-install setup.\n'
|
||||||
|
printf ' \033[1;36m└─\033[0m\n'
|
||||||
|
printf '\n'
|
||||||
|
printf ' \033[1;36m?\033[0m Update existing installation? \033[1m[Y/n]\033[0m '
|
||||||
|
|
||||||
|
if ((OMERON_HAS_GUM)); then
|
||||||
|
gum confirm "Update existing installation?"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -r response
|
||||||
|
response="${response:-Y}"
|
||||||
|
[[ "$response" =~ ^[yY](es)?$ ]]
|
||||||
|
return $?
|
||||||
|
}
|
||||||
165
lib/utils.sh
165
lib/utils.sh
@@ -32,9 +32,39 @@ is_root() {
|
|||||||
[[ "$EUID" -eq 0 ]]
|
[[ "$EUID" -eq 0 ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OMERON_SUDO_PID=""
|
||||||
|
|
||||||
|
OMERON_SUDO_PID=""
|
||||||
|
|
||||||
|
sudo_init() {
|
||||||
|
if is_root; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
tui_info "Sudo access needed — enter your password once"
|
||||||
|
sudo -v || {
|
||||||
|
tui_error "Sudo authentication failed"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
(
|
||||||
|
while true; do
|
||||||
|
sleep 240
|
||||||
|
sudo -v 2>/dev/null || break
|
||||||
|
done
|
||||||
|
) &
|
||||||
|
OMERON_SUDO_PID=$!
|
||||||
|
}
|
||||||
|
|
||||||
|
sudo_cleanup() {
|
||||||
|
[[ -n "$OMERON_SUDO_PID" ]] && kill "$OMERON_SUDO_PID" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
sudo_run() {
|
sudo_run() {
|
||||||
if is_root; then
|
if is_root; then
|
||||||
"$@"
|
"$@"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ -n "${OMERON_SUDO_PID:-}" ]] && kill -0 "$OMERON_SUDO_PID" 2>/dev/null; then
|
||||||
|
sudo -n "$@"
|
||||||
else
|
else
|
||||||
sudo "$@"
|
sudo "$@"
|
||||||
fi
|
fi
|
||||||
@@ -70,9 +100,9 @@ copy_path() {
|
|||||||
local target="$2"
|
local target="$2"
|
||||||
|
|
||||||
backup_file "$target"
|
backup_file "$target"
|
||||||
rm -rf "$target"
|
rm -rf "$target" 2>/dev/null || true
|
||||||
mkdir -p "$(dirname "$target")"
|
mkdir -p "$(dirname "$target")"
|
||||||
cp -a "$source" "$target"
|
cp -aT "$source" "$target"
|
||||||
log_info "Copied $source -> $target"
|
log_info "Copied $source -> $target"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,38 +157,6 @@ install_pacman() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_aur() {
|
|
||||||
local packages=("$@")
|
|
||||||
local aur_helper=""
|
|
||||||
|
|
||||||
if have paru; then
|
|
||||||
aur_helper="paru"
|
|
||||||
elif have yay; then
|
|
||||||
aur_helper="yay"
|
|
||||||
else
|
|
||||||
log_error "No AUR helper found (install paru or yay)"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local pkg
|
|
||||||
local rc=0
|
|
||||||
|
|
||||||
for pkg in "${packages[@]}"; do
|
|
||||||
if is_package_installed "$pkg"; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
tui_info "Installing $pkg from AUR..."
|
|
||||||
if "$aur_helper" -S --needed --noconfirm "$pkg"; then
|
|
||||||
tui_success "$pkg installed"
|
|
||||||
else
|
|
||||||
tui_warn "$pkg could not be installed"
|
|
||||||
rc=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return $rc
|
|
||||||
}
|
|
||||||
|
|
||||||
replace_home_paths() {
|
replace_home_paths() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local original_home="${2:-/home/pascal}"
|
local original_home="${2:-/home/pascal}"
|
||||||
@@ -270,6 +268,28 @@ system_summary() {
|
|||||||
SUMMARY
|
SUMMARY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_aur_package() {
|
||||||
|
local pkgname="$1"
|
||||||
|
local build_dir
|
||||||
|
build_dir="$(mktemp -d)"
|
||||||
|
|
||||||
|
tui_info "Cloning $pkgname from AUR directly..."
|
||||||
|
if ! git clone "https://aur.archlinux.org/$pkgname.git" "$build_dir/$pkgname" 2>/dev/null; then
|
||||||
|
rm -rf "$build_dir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tui_info "Building $pkgname..."
|
||||||
|
if (cd "$build_dir/$pkgname" && makepkg -si --needed --noconfirm); then
|
||||||
|
rm -rf "$build_dir"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local rc=$?
|
||||||
|
rm -rf "$build_dir"
|
||||||
|
return $rc
|
||||||
|
}
|
||||||
|
|
||||||
install_aur_helper() {
|
install_aur_helper() {
|
||||||
if have paru || have yay; then
|
if have paru || have yay; then
|
||||||
return 0
|
return 0
|
||||||
@@ -277,9 +297,7 @@ install_aur_helper() {
|
|||||||
|
|
||||||
if is_root; then
|
if is_root; then
|
||||||
tui_warn "Running as root — makepkg refuses to run as root."
|
tui_warn "Running as root — makepkg refuses to run as root."
|
||||||
tui_info "Switch to a normal user with sudo access and re-run, or install paru manually:"
|
tui_info "Switch to a normal user with sudo access and re-run."
|
||||||
tui_info " pacman -S --needed git && git clone https://aur.archlinux.org/paru-bin.git"
|
|
||||||
tui_info " cd paru-bin && makepkg -si"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -289,35 +307,66 @@ install_aur_helper() {
|
|||||||
local build_dir
|
local build_dir
|
||||||
build_dir="$(mktemp -d)"
|
build_dir="$(mktemp -d)"
|
||||||
|
|
||||||
tui_info "Downloading paru-bin from AUR..."
|
tui_info "Installing yay-bin (statically linked, works on any libalpm)..."
|
||||||
if ! git clone https://aur.archlinux.org/paru-bin.git "$build_dir/paru-bin"; then
|
if git clone https://aur.archlinux.org/yay-bin.git "$build_dir/yay-bin" &&
|
||||||
tui_error "Failed to download paru-bin. Check network connectivity."
|
(cd "$build_dir/yay-bin" && makepkg -si --needed --noconfirm); then
|
||||||
rm -rf "$build_dir"
|
tui_success "yay installed"
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
tui_info "Building paru-bin with makepkg..."
|
|
||||||
if (cd "$build_dir/paru-bin" && makepkg -si --needed --noconfirm); then
|
|
||||||
tui_success "paru installed successfully"
|
|
||||||
rm -rf "$build_dir"
|
rm -rf "$build_dir"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local rc=$?
|
rm -rf "$build_dir"
|
||||||
tui_warn "makepkg failed (exit $rc). Trying yay-bin..."
|
mkdir -p "$build_dir"
|
||||||
rm -rf "$build_dir/paru-bin"
|
|
||||||
|
|
||||||
if git clone https://aur.archlinux.org/yay-bin.git "$build_dir/yay-bin"; then
|
tui_info "yay-bin failed. Trying paru-bin..."
|
||||||
if (cd "$build_dir/yay-bin" && makepkg -si --needed --noconfirm); then
|
if git clone https://aur.archlinux.org/paru-bin.git "$build_dir/paru-bin" &&
|
||||||
tui_success "yay installed successfully"
|
(cd "$build_dir/paru-bin" && makepkg -si --needed --noconfirm) &&
|
||||||
|
paru --version >/dev/null 2>&1; then
|
||||||
|
tui_success "paru works"
|
||||||
rm -rf "$build_dir"
|
rm -rf "$build_dir"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
tui_warn "Could not install AUR helper. Install manually:"
|
|
||||||
tui_info " cd /tmp && git clone https://aur.archlinux.org/paru-bin.git"
|
|
||||||
tui_info " cd paru-bin && makepkg -si"
|
|
||||||
rm -rf "$build_dir"
|
rm -rf "$build_dir"
|
||||||
return 1
|
tui_warn "No working AUR helper. Using direct git clone + makepkg for AUR packages."
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
install_aur() {
|
||||||
|
local packages=("$@")
|
||||||
|
local pkg
|
||||||
|
local rc=0
|
||||||
|
|
||||||
|
for pkg in "${packages[@]}"; do
|
||||||
|
if is_package_installed "$pkg"; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if have yay; then
|
||||||
|
tui_info "Installing $pkg from AUR (via yay)..."
|
||||||
|
if yay -S --needed --noconfirm "$pkg"; then
|
||||||
|
tui_success "$pkg installed"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
tui_warn "yay failed for $pkg. Trying direct AUR install..."
|
||||||
|
elif have paru && paru --version >/dev/null 2>&1; then
|
||||||
|
tui_info "Installing $pkg from AUR (via paru)..."
|
||||||
|
if paru -S --needed --noconfirm "$pkg"; then
|
||||||
|
tui_success "$pkg installed"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
tui_warn "paru failed for $pkg. Trying direct AUR install..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if install_aur_package "$pkg"; then
|
||||||
|
tui_success "$pkg installed"
|
||||||
|
else
|
||||||
|
tui_warn "$pkg could not be installed. Try manually:"
|
||||||
|
tui_info " cd /tmp && git clone https://aur.archlinux.org/$pkg.git"
|
||||||
|
tui_info " cd $pkg && makepkg -si"
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return $rc
|
||||||
}
|
}
|
||||||
|
|||||||
39
lib/version.sh
Normal file
39
lib/version.sh
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
OMERON_VERSION_DIR="${OMERON_VERSION_DIR:-$HOME/.local/share/omeron}"
|
||||||
|
OMERON_VERSION_FILE="$OMERON_VERSION_DIR/version"
|
||||||
|
|
||||||
|
version_read() {
|
||||||
|
if [[ -f "$OMERON_VERSION_FILE" ]]; then
|
||||||
|
source "$OMERON_VERSION_FILE"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
version_write() {
|
||||||
|
mkdir -p "$OMERON_VERSION_DIR"
|
||||||
|
cat > "$OMERON_VERSION_FILE" <<VERSION
|
||||||
|
# Omeron Version File
|
||||||
|
OMERON_VERSION=1
|
||||||
|
OMERON_INSTALL_DATE="$(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
OMERON_LAST_UPDATE="$(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
version_update() {
|
||||||
|
mkdir -p "$OMERON_VERSION_DIR"
|
||||||
|
if [[ -f "$OMERON_VERSION_FILE" ]]; then
|
||||||
|
local tmp
|
||||||
|
tmp="$(mktemp)"
|
||||||
|
while IFS= read -r line; do
|
||||||
|
case "$line" in
|
||||||
|
OMERON_LAST_UPDATE=*) printf 'OMERON_LAST_UPDATE="%s"\n' "$(date '+%Y-%m-%d %H:%M:%S')" ;;
|
||||||
|
*) printf '%s\n' "$line" ;;
|
||||||
|
esac
|
||||||
|
done < "$OMERON_VERSION_FILE" > "$tmp"
|
||||||
|
mv "$tmp" "$OMERON_VERSION_FILE"
|
||||||
|
else
|
||||||
|
version_write
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
AGS_LOG_DIR="/tmp/omeron-ags-logs"
|
|
||||||
|
|
||||||
module_description() {
|
module_description() {
|
||||||
printf "AGS (Aylur's Gtk Shell) - Widget system for Hyprland\n"
|
printf "AGS (Aylur's Gtk Shell) - Widget system for Hyprland\n"
|
||||||
}
|
}
|
||||||
@@ -11,30 +9,6 @@ module_should_skip() {
|
|||||||
command -v ags >/dev/null 2>&1
|
command -v ags >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
_ags_build_deps() {
|
|
||||||
local deps=("libastal-io-git" "libastal-git" "libastal-4-git")
|
|
||||||
local all_ok=0
|
|
||||||
|
|
||||||
mkdir -p "$AGS_LOG_DIR"
|
|
||||||
|
|
||||||
for dep in "${deps[@]}"; do
|
|
||||||
if is_package_installed "$dep"; then
|
|
||||||
tui_success "$dep already installed"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
tui_info "Building $dep from AUR (dependency for AGS)..."
|
|
||||||
local log="$AGS_LOG_DIR/$dep.log"
|
|
||||||
if paru -S --needed --noconfirm "$dep" > "$log" 2>&1; then
|
|
||||||
tui_success "$dep built and installed"
|
|
||||||
else
|
|
||||||
tui_warn "$dep build failed — see $log"
|
|
||||||
all_ok=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return $all_ok
|
|
||||||
}
|
|
||||||
|
|
||||||
module_main() {
|
module_main() {
|
||||||
log_section "AGS Installation"
|
log_section "AGS Installation"
|
||||||
|
|
||||||
@@ -43,8 +17,8 @@ module_main() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! have paru; then
|
if ! have git; then
|
||||||
tui_warn "paru not available. Install ags manually: paru -S aylurs-gtk-shell-git"
|
tui_warn "git not available. Install ags manually after installing git."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -54,27 +28,19 @@ module_main() {
|
|||||||
printf '\n'
|
printf '\n'
|
||||||
|
|
||||||
if ! tui_confirm "Install AGS now?"; then
|
if ! tui_confirm "Install AGS now?"; then
|
||||||
tui_info "AGS installation skipped. Run later: paru -S aylurs-gtk-shell-git"
|
tui_info "AGS installation skipped."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! _ags_build_deps; then
|
local deps=("libastal-io-git" "libastal-git" "libastal-4-git")
|
||||||
|
if ! install_aur "${deps[@]}"; then
|
||||||
tui_warn "Some AGS dependencies failed to build."
|
tui_warn "Some AGS dependencies failed to build."
|
||||||
tui_info "Check logs in $AGS_LOG_DIR/ for details."
|
|
||||||
if ! tui_confirm "Try to install AGS anyway?"; then
|
if ! tui_confirm "Try to install AGS anyway?"; then
|
||||||
tui_info "AGS installation aborted. Fix deps manually, then run: paru -S aylurs-gtk-shell-git"
|
tui_info "AGS installation aborted."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tui_info "Building aylurs-gtk-shell-git from AUR..."
|
tui_info "Building aylurs-gtk-shell-git from AUR..."
|
||||||
mkdir -p "$AGS_LOG_DIR"
|
install_aur "aylurs-gtk-shell-git"
|
||||||
local log="$AGS_LOG_DIR/aylurs-gtk-shell-git.log"
|
|
||||||
if paru -S --needed --noconfirm aylurs-gtk-shell-git > "$log" 2>&1; then
|
|
||||||
tui_success "AGS installed"
|
|
||||||
else
|
|
||||||
tui_warn "AGS build failed — see $log"
|
|
||||||
tui_info "Check the last 30 lines: tail -30 $log"
|
|
||||||
tui_info "Try manually: paru -S aylurs-gtk-shell-git"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ with open('$OMERON_PROJECT_DIR/config/omeron.yaml') as f:
|
|||||||
data = yaml.safe_load(f)
|
data = yaml.safe_load(f)
|
||||||
items = data.get('dotfiles', {}).get('items', [])
|
items = data.get('dotfiles', {}).get('items', [])
|
||||||
print(' '.join(items))
|
print(' '.join(items))
|
||||||
" 2>/dev/null)"
|
" 2>/dev/null)" || true
|
||||||
|
|
||||||
if [[ -n "$raw_items" ]]; then
|
if [[ -n "$raw_items" ]]; then
|
||||||
read -ra config_items <<< "$raw_items"
|
read -ra config_items <<< "$raw_items"
|
||||||
@@ -44,8 +44,10 @@ print(' '.join(items))
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
backup_dir="$(backup_file "$HOME/.config/hypr" "$HOME/.dotfiles-backup/$(date +%Y%m%d-%H%M%S)")"
|
local backup_timestamp
|
||||||
backup_dir="$(dirname "$backup_dir" 2>/dev/null || printf '%s' "$HOME/.dotfiles-backup/$(date +%Y%m%d-%H%M%S)")"
|
backup_timestamp="$(date +%Y%m%d-%H%M%S)"
|
||||||
|
backup_file "$HOME/.config/hypr" "$HOME/.dotfiles-backup/$backup_timestamp" >/dev/null
|
||||||
|
backup_dir="$HOME/.dotfiles-backup/$backup_timestamp"
|
||||||
|
|
||||||
for item in "${config_items[@]}"; do
|
for item in "${config_items[@]}"; do
|
||||||
local source="$dotfiles_dir/$item"
|
local source="$dotfiles_dir/$item"
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ module_main() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ((OMERON_FRESH_INSTALL)); then
|
if ((OMERON_FRESH_INSTALL || OMERON_UPDATE_MODE)); then
|
||||||
tui_info "Running system update first..."
|
tui_info "Running system update first..."
|
||||||
sudo_run pacman -Syu --noconfirm 2>&1 | tail -3 || true
|
sudo_run pacman -Syu --noconfirm 2>&1 | tail -3 || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ with open('$OMERON_PROJECT_DIR/config/omeron.yaml') as f:
|
|||||||
data = yaml.safe_load(f)
|
data = yaml.safe_load(f)
|
||||||
svcs = data.get('services', [])
|
svcs = data.get('services', [])
|
||||||
print(' '.join(svcs))
|
print(' '.join(svcs))
|
||||||
" 2>/dev/null)"
|
" 2>/dev/null)" || true
|
||||||
|
|
||||||
if [[ -n "$raw_services" ]]; then
|
if [[ -n "$raw_services" ]]; then
|
||||||
read -ra services <<< "$raw_services"
|
read -ra services <<< "$raw_services"
|
||||||
|
|||||||
Reference in New Issue
Block a user