Compare commits

..

11 Commits

Author SHA1 Message Date
c8456a0885 fix: writeFile aus ags/file statt raw GLib — erstellt verzeichnisse automatisch 2026-05-30 20:14:24 +02:00
add4260a9b fix: setup nicht in AGS 3.1, zurück zu onChanged + closure variablen 2026-05-30 20:12:29 +02:00
419eccf4d0 fix: homelab setup form liest entry werte direkt per setup-ref statt closure-variablen, saveConfig mit try/catch und rebuild() 2026-05-30 20:07:22 +02:00
ecb925f510 fix: homelab save erstellt parent dir via mkdir_with_parents, string statt TextEncoder für GLib.file_set_contents 2026-05-30 20:01:56 +02:00
1a06ffa0dc fix: hyprland config globbing error (source=~), dotfiles deploy stabilität (cp -aT, set -e fix), homelab AGS setup form 2026-05-30 19:56:57 +02:00
d367c4edd0 version/update system: version.sh, --update flag, UPDATE_MODULES, auto-detect existing install 2026-05-30 17:44:38 +02:00
dc7ef3cc51 homelab-control: fallback terminal öffnen wenn zenity fehlt — kitty + gum statt notification ohne reaktion 2026-05-29 19:45:23 +02:00
ab0870db04 homelab-control.sh: zenity als primärer setup-dialog (funktioniert aus rofi/ags-menüs), terminal-check vor gum/whiptail/read 2026-05-29 19:01:20 +02:00
8f8c3cac3d homelab-control.sh: setup wizard bei fehlendem config — kein löschen mehr, setup auch nach installation nutzbar 2026-05-29 18:48:48 +02:00
e2f8313034 homelab control center nur bei konfiguration: module-reihenfolge geändert, dotfiles räumen homelab-files bei fehlendem config weg 2026-05-29 18:46:22 +02:00
de88e5b603 ags: optional statt required — wird nur auf y/N hin installiert 2026-05-29 18:43:59 +02:00
10 changed files with 199 additions and 24 deletions

View File

@@ -15,14 +15,11 @@ if ! command -v ags >/dev/null 2>&1; then
fi
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
fi
if [[ -f "$HOMELAB_CONFIG" ]]; then
export HOMELAB_CONFIG
fi
cd "$HYPR_DIR"
ags quit --instance homelab-control >/dev/null 2>&1 || true
exec ags run "$HYPR_DIR/ags/homelab.tsx"

View File

@@ -2,16 +2,32 @@ import app from "ags/gtk4/app";
import { Astal, Gtk } from "ags/gtk4";
import { execAsync } from "ags/process";
import css from "./homelab.css";
import { writeFile } from "ags/file";
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() {
const configPath = GLib.getenv("HOMELAB_CONFIG") || `${GLib.getenv("HOME")}/.config/homelab/config.yaml`;
const defaults = { host: "10.0.0.15", user: "root", port: 22 };
try {
const [ok, contents] = GLib.file_get_contents(configPath);
const [ok, contents] = GLib.file_get_contents(CONFIG_PATH);
if (!ok || !contents) return defaults;
hasConfig = true;
const text = new TextDecoder().decode(contents);
const lines = text.split("\n");
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() {
return (
<window
@@ -1132,7 +1193,7 @@ function HomelabWindow() {
return false;
}} />
<box marginTop={WINDOW_MARGIN_TOP}>
{authed ? <DashboardView /> : <LoginView />}
{!hasConfig ? <SetupView /> : (authed ? <DashboardView /> : <LoginView />)}
</box>
</window>
);
@@ -1143,7 +1204,7 @@ function rebuild() {
if (!win) {
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({

View File

@@ -80,7 +80,7 @@ general {
layout = dwindle
}
source = ~/.config/hypr/current-theme.conf
source = /home/pascal/.config/hypr/current-theme.conf
# https://wiki.hypr.land/Configuring/Variables/#decoration
decoration {

View File

@@ -13,23 +13,37 @@ source "$OMERON_ROOT/lib/tui-fs.sh"
source "$OMERON_ROOT/lib/utils.sh"
source "$OMERON_ROOT/lib/config.sh"
source "$OMERON_ROOT/lib/modules.sh"
source "$OMERON_ROOT/lib/version.sh"
OMERON_FRESH_INSTALL="${OMERON_FRESH_INSTALL:-0}"
export OMERON_FRESH_INSTALL
OMERON_UPDATE_MODE="${OMERON_UPDATE_MODE:-0}"
export OMERON_UPDATE_MODE
DEFAULT_MODULES=(
"core/preflight"
"core/packages"
"core/ags"
"homelab/setup"
"core/dotfiles"
"core/services"
"homelab/setup"
"optional/install"
"post/apply-theme"
"core/sddm"
)
FRESH_MODULES=(
"core/packages"
"core/ags"
"homelab/setup"
"core/dotfiles"
"core/services"
"optional/install"
"post/apply-theme"
"core/sddm"
)
UPDATE_MODULES=(
"core/packages"
"core/ags"
"core/dotfiles"
@@ -52,6 +66,7 @@ Usage: ./install.sh [OPTIONS]
Options:
--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)
--skip m1,m2 Skip specific modules (comma-separated)
--skip-packages Skip package installation
@@ -62,6 +77,7 @@ Options:
Examples:
./install.sh Interactive (detects fresh install automatically)
./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 --skip core/packages
EOF
@@ -85,7 +101,8 @@ list_modules() {
parse_args() {
while [[ $# -gt 0 ]]; do
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 ;;
--skip) IFS=',' read -ra SKIP_MODULES <<< "$2"; shift 2 ;;
--skip-packages) SKIP_MODULES+=("core/packages"); shift ;;
@@ -111,6 +128,11 @@ detect_environment() {
fi
fi
if ((OMERON_UPDATE_MODE)); then
tui_fs_show_ok "Update mode — existing installation detected"
return
fi
if ((!OMERON_FRESH_INSTALL)) && ((${#RUN_MODULES[@]} == 0)); then
tui_fs_show_msg "Checking for fresh install..."
if is_fresh_install; then
@@ -142,7 +164,9 @@ collect_modules() {
fi
local modules=()
if ((OMERON_FRESH_INSTALL)); then
if ((OMERON_UPDATE_MODE)); then
modules=("${UPDATE_MODULES[@]}")
elif ((OMERON_FRESH_INSTALL)); then
modules=("${FRESH_MODULES[@]}")
else
modules=("${DEFAULT_MODULES[@]}")
@@ -168,7 +192,9 @@ collect_all_interactive() {
exec 1>&2
local modules=()
if ((OMERON_FRESH_INSTALL)); then
if ((OMERON_UPDATE_MODE)); then
modules=("${UPDATE_MODULES[@]}")
elif ((OMERON_FRESH_INSTALL)); then
modules=("${FRESH_MODULES[@]}")
else
modules=("${DEFAULT_MODULES[@]}")
@@ -233,6 +259,16 @@ main() {
tui_fs_init
if ((!OMERON_FRESH_INSTALL)) && ((!OMERON_UPDATE_MODE)) && ((${#RUN_MODULES[@]} == 0)); then
if version_read; then
if tui_fs_ask_update "${OMERON_INSTALL_DATE:-unknown}"; then
OMERON_UPDATE_MODE=1
export OMERON_UPDATE_MODE
tui_fs_show_ok "Update mode activated"
fi
fi
fi
detect_environment
local modules_to_run=()
@@ -285,6 +321,12 @@ main() {
tui_fs_exit
if ((OMERON_UPDATE_MODE)); then
version_update
else
version_write
fi
printf '\n'
tui_header "O M E R O N — Done"
tui_success "Installation Complete!"
@@ -292,17 +334,24 @@ main() {
tui_info "Log: ${OMERON_LOG_FILE}"
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_list \
"Start Hyprland: Hyprland" \
"Or enable SDDM: sudo systemctl enable --now sddm" \
"Reload config: hyprctl reload"
"Reload config: hyprctl reload" \
"Update later: ./install.sh --update"
else
tui_bold "What next?"
tui_list \
"Reload config: hyprctl reload" \
"Re-run installer: ./install.sh"
"Re-run installer: ./install.sh" \
"Update later: ./install.sh --update"
fi
printf '\n'

View File

@@ -182,3 +182,30 @@ tui_fs_confirm_start() {
[[ "$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 $?
}

View File

@@ -100,9 +100,9 @@ copy_path() {
local target="$2"
backup_file "$target"
rm -rf "$target"
rm -rf "$target" 2>/dev/null || true
mkdir -p "$(dirname "$target")"
cp -a "$source" "$target"
cp -aT "$source" "$target"
log_info "Copied $source -> $target"
}

39
lib/version.sh Normal file
View 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
}

View File

@@ -28,7 +28,7 @@ with open('$OMERON_PROJECT_DIR/config/omeron.yaml') as f:
data = yaml.safe_load(f)
items = data.get('dotfiles', {}).get('items', [])
print(' '.join(items))
" 2>/dev/null)"
" 2>/dev/null)" || true
if [[ -n "$raw_items" ]]; then
read -ra config_items <<< "$raw_items"
@@ -44,8 +44,10 @@ print(' '.join(items))
return 0
fi
backup_dir="$(backup_file "$HOME/.config/hypr" "$HOME/.dotfiles-backup/$(date +%Y%m%d-%H%M%S)")"
backup_dir="$(dirname "$backup_dir" 2>/dev/null || printf '%s' "$HOME/.dotfiles-backup/$(date +%Y%m%d-%H%M%S)")"
local backup_timestamp
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
local source="$dotfiles_dir/$item"

View File

@@ -83,7 +83,7 @@ module_main() {
return 0
fi
if ((OMERON_FRESH_INSTALL)); then
if ((OMERON_FRESH_INSTALL || OMERON_UPDATE_MODE)); then
tui_info "Running system update first..."
sudo_run pacman -Syu --noconfirm 2>&1 | tail -3 || true
fi

View File

@@ -27,7 +27,7 @@ with open('$OMERON_PROJECT_DIR/config/omeron.yaml') as f:
data = yaml.safe_load(f)
svcs = data.get('services', [])
print(' '.join(svcs))
" 2>/dev/null)"
" 2>/dev/null)" || true
if [[ -n "$raw_services" ]]; then
read -ra services <<< "$raw_services"