fix(scripts): improve offline resilience and restore missing update scripts
All checks were successful
Check / eval-and-lint (push) Successful in 7m5s
All checks were successful
Check / eval-and-lint (push) Successful in 7m5s
This commit is contained in:
@@ -19,7 +19,10 @@ Guardrails (apply when adding anything):
|
|||||||
|
|
||||||
### Now (ready to pick up)
|
### Now (ready to pick up)
|
||||||
|
|
||||||
_(empty — all entries shipped or moved to Later)_
|
- **Ironclad: Offline Resilience.** Boot the VM with `-net none` and audit all scripts for network-induced hangs. Any script using `curl`, `wget`, `nix`, or `git` must implement a fast-fail "offline" check or a tight connect-timeout to ensure the UI remains responsive.
|
||||||
|
- **Ironclad: Multi-Monitor Integrity.** Verify Hyprland, Waybar, and Walker behavior on dual-screen setups. Ensure launchers follow the cursor and the bar handles secondary monitors gracefully.
|
||||||
|
- **Ironclad: Input Method (Fcitx5) Functional Pass.** Prove that non-ASCII input (Pinyin/Mozc) is functional in the live VM. Fix any Wayland-specific D-Bus or environment issues.
|
||||||
|
- **Ironclad: Overlap & Conflict Proofing.** Verify that manual Nix overrides in `home.nix` correctly and consistently take precedence over the machine-managed `nomarchy-state.nix`.
|
||||||
|
|
||||||
### Next (bigger lifts that build on Now)
|
### Next (bigger lifts that build on Now)
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`,
|
|||||||
| `nomarchy-swayosd-kbd-brightness` | `core/system/scripts` | core/system/scripts/nomarchy-brightness-keyboard | `kept` | |
|
| `nomarchy-swayosd-kbd-brightness` | `core/system/scripts` | core/system/scripts/nomarchy-brightness-keyboard | `kept` | |
|
||||||
| `nomarchy-sync` | `features/scripts/utils` | README.md,features/scripts/utils/nomarchy-backup, +1 more | `kept` | |
|
| `nomarchy-sync` | `features/scripts/utils` | README.md,features/scripts/utils/nomarchy-backup, +1 more | `kept` | |
|
||||||
| `nomarchy-sync-nix-state` | `features/scripts/utils` | features/scripts/utils/nomarchy-state-write | `kept` | |
|
| `nomarchy-sync-nix-state` | `features/scripts/utils` | features/scripts/utils/nomarchy-state-write | `kept` | |
|
||||||
| `nomarchy-sys-update` | `features/scripts/utils` | core/home/bash.nix,core/system/scripts/nomarchy-setup-dns, +5 more | `kept` | |
|
| `nomarchy-sys-update` | `features/scripts/utils` | core/home/bash.nix,core/system/scripts/nomarchy-setup-dns, +6 more | `kept` | |
|
||||||
| `nomarchy-system-logout` | `core/system/scripts` | features/scripts/utils/nomarchy-menu | `kept` | |
|
| `nomarchy-system-logout` | `core/system/scripts` | features/scripts/utils/nomarchy-menu | `kept` | |
|
||||||
| `nomarchy-system-reboot` | `core/system/scripts` | core/home/config/nomarchy-skill/SKILL.md,core/system/scripts/nomarchy-hibernation-setup, +2 more | `kept` | |
|
| `nomarchy-system-reboot` | `core/system/scripts` | core/home/config/nomarchy-skill/SKILL.md,core/system/scripts/nomarchy-hibernation-setup, +2 more | `kept` | |
|
||||||
| `nomarchy-system-shutdown` | `core/system/scripts` | core/home/config/nomarchy-skill/SKILL.md,core/home/config/nomarchy/extensions/menu.sh, +1 more | `kept` | |
|
| `nomarchy-system-shutdown` | `core/system/scripts` | core/home/config/nomarchy-skill/SKILL.md,core/home/config/nomarchy/extensions/menu.sh, +1 more | `kept` | |
|
||||||
|
|||||||
32
features/scripts/utils/nomarchy-update
Executable file
32
features/scripts/utils/nomarchy-update
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Nomarchy Full Update Script
|
||||||
|
# 1. Syncs the local repository (if applicable)
|
||||||
|
# 2. Performs a full system update (NixOS + Home Manager)
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Detect the repository location
|
||||||
|
if [ -f "/etc/nixos/flake.nix" ]; then
|
||||||
|
REPO_DIR="/etc/nixos"
|
||||||
|
elif [ -f "/etc/nomarchy/flake.nix" ]; then
|
||||||
|
REPO_DIR="/etc/nomarchy"
|
||||||
|
else
|
||||||
|
echo "Error: Nomarchy flake repository not found in /etc/nixos or /etc/nomarchy."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "--- Starting Nomarchy Full Update ---"
|
||||||
|
|
||||||
|
# 1. Sync repository if it's a git repo
|
||||||
|
if [ -d "$REPO_DIR/.git" ]; then
|
||||||
|
echo "Syncing repository from remote..."
|
||||||
|
if ! git -C "$REPO_DIR" pull --ff-only; then
|
||||||
|
echo "Warning: git pull failed. Proceeding with local configuration."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. System update
|
||||||
|
nomarchy-sys-update
|
||||||
|
|
||||||
|
echo "--- Nomarchy Full Update Complete ---"
|
||||||
@@ -16,18 +16,14 @@ if [ -z "$REPO_DIR" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We use a simple logic: Check for flake updates periodically.
|
# Fast-fail if offline to avoid expensive nix commands.
|
||||||
# Since this is run by Waybar, we should be careful with performance.
|
if ! ping -c 1 -W 2 1.1.1.1 >/dev/null 2>&1; then
|
||||||
|
exit 0
|
||||||
# For a quick check, we can see if there are newer versions available for nixpkgs
|
fi
|
||||||
# by checking nix flake metadata on the repo.
|
|
||||||
|
|
||||||
# Get current status
|
# Get current status
|
||||||
CURRENT_REV=$(nix flake metadata "$REPO_DIR" --json | jq -r '.lock.nodes.root.inputs.nixpkgs')
|
CURRENT_REV=$(nix flake metadata "$REPO_DIR" --json | jq -r '.lock.nodes.root.inputs.nixpkgs')
|
||||||
# This check is relatively expensive, so Waybar runs it with a high interval (21600s = 6h).
|
# This check is relatively expensive, so Waybar runs it with a high interval (21600s = 6h).
|
||||||
|
|
||||||
# Just return an icon if we are in a system that can be updated.
|
# Just return an icon if we are in a system that can be updated.
|
||||||
# In a real implementation, we could compare local flake.lock vs upstream if it's a git repo.
|
|
||||||
# For now, we'll return the update icon to show it's active.
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
18
features/scripts/utils/nomarchy-update-time
Executable file
18
features/scripts/utils/nomarchy-update-time
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Nomarchy Time Sync Script
|
||||||
|
# Force sync system time using systemd-timesyncd
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Syncing system time..."
|
||||||
|
if ! sudo systemctl restart systemd-timesyncd; then
|
||||||
|
echo "Error: Failed to restart systemd-timesyncd. Check internet connection."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait a moment for sync
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo "Current time: $(date)"
|
||||||
|
echo "Time sync complete."
|
||||||
@@ -13,9 +13,15 @@ fi
|
|||||||
|
|
||||||
# Use ix.io as the default pastebin
|
# Use ix.io as the default pastebin
|
||||||
if [[ -n $1 ]]; then
|
if [[ -n $1 ]]; then
|
||||||
url=$(curl -F "f:1=@$1" ix.io)
|
# --connect-timeout 5: fail fast if ix.io is unreachable
|
||||||
|
url=$(curl -s --connect-timeout 5 -F "f:1=@$1" ix.io || echo "OFFLINE")
|
||||||
else
|
else
|
||||||
url=$(curl -F "f:1=@-" ix.io)
|
url=$(curl -s --connect-timeout 5 -F "f:1=@-" ix.io || echo "OFFLINE")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$url" == "OFFLINE" ]]; then
|
||||||
|
echo "Error: Could not upload log. Check your internet connection."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Log uploaded to: $url"
|
echo "Log uploaded to: $url"
|
||||||
|
|||||||
Reference in New Issue
Block a user