From 8d2d0587ba08843c8956614e84e221693b24b111 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Fri, 2 Jan 2026 20:51:28 -0500 Subject: [PATCH] Fixed update-hyprland refresh-hypr-tags --force-override It now assumes --fetch-latest Small formatting fixes Now shows version to upgrade too and pause to allow review On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: CHANGELOGS.md modified: Debian-Hyprland-Install-Upgrade.es.md modified: Debian-Hyprland-Install-Upgrade.md modified: dry-run-build.sh modified: refresh-hypr-tags.sh modified: update-hyprland.sh --- CHANGELOGS.md | 2 + Debian-Hyprland-Install-Upgrade.es.md | 2 +- Debian-Hyprland-Install-Upgrade.md | 2 +- dry-run-build.sh | 9 +++- refresh-hypr-tags.sh | 24 +++++++++- update-hyprland.sh | 63 ++++++++++++++++++++++++--- 6 files changed, 90 insertions(+), 12 deletions(-) diff --git a/CHANGELOGS.md b/CHANGELOGS.md index e24600e..d0313e1 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -9,6 +9,8 @@ - This is only for debian testing+ versions - `update-hyprland.sh` added `-/--help` - documentation for updating hyprland +- Added: version update to `refresh-tags` and `update-hyprland` script +- Fixed: `--force-update` implies `--fetch-latest` ## 10 December 2025 diff --git a/Debian-Hyprland-Install-Upgrade.es.md b/Debian-Hyprland-Install-Upgrade.es.md index 50577c2..339966b 100644 --- a/Debian-Hyprland-Install-Upgrade.es.md +++ b/Debian-Hyprland-Install-Upgrade.es.md @@ -44,7 +44,7 @@ chmod +x ./update-hyprland.sh Flags clave: - --fetch-latest: obtiene las últimas etiquetas desde GitHub -- --force-update: sobrescribe valores fijados en hypr-tags.env (equivalente a FORCE=1) +- --force-update: sobrescribe valores fijados en hypr-tags.env (equivalente a FORCE=1). Implica --fetch-latest. - --dry-run / --install: solo compilar o compilar+instalar - --only / --skip: limitar qué módulos se ejecutan diff --git a/Debian-Hyprland-Install-Upgrade.md b/Debian-Hyprland-Install-Upgrade.md index 5cf20c9..0c10853 100644 --- a/Debian-Hyprland-Install-Upgrade.md +++ b/Debian-Hyprland-Install-Upgrade.md @@ -44,7 +44,7 @@ chmod +x ./update-hyprland.sh Key flags: - --fetch-latest: pull latest release tags from GitHub -- --force-update: override pinned values in hypr-tags.env (equivalent to FORCE=1) +- --force-update: override pinned values in hypr-tags.env (equivalent to FORCE=1). Implies --fetch-latest. - --dry-run / --install: compile-only or compile+install - --only / --skip: limit which modules run diff --git a/dry-run-build.sh b/dry-run-build.sh index 988202d..2930d1b 100755 --- a/dry-run-build.sh +++ b/dry-run-build.sh @@ -134,11 +134,16 @@ done # Summary { - echo "\nSummary (dry-run):" + printf "\nSummary (dry-run):\n" for mod in "${MODULES[@]}"; do printf "%-24s %s\n" "$mod" "${RESULTS[$mod]:-SKIPPED}" done - echo "\nLogs: individual module logs are under Install-Logs/. This summary: $SUMMARY_LOG" + # Show current tag values to make changes visible during dry-runs + if [[ -f "$REPO_ROOT/hypr-tags.env" ]]; then + printf "\nCurrent versions (from %s):\n" "$REPO_ROOT/hypr-tags.env" + grep -E '^[A-Z0-9_]+=' "$REPO_ROOT/hypr-tags.env" | sort + fi + printf "\nLogs: individual module logs are under Install-Logs/. This summary: %s\n" "$SUMMARY_LOG" } | tee -a "$SUMMARY_LOG" # Exit non-zero if any FAIL occurred diff --git a/refresh-hypr-tags.sh b/refresh-hypr-tags.sh index e669de2..a95f71b 100755 --- a/refresh-hypr-tags.sh +++ b/refresh-hypr-tags.sh @@ -56,10 +56,14 @@ declare -A cur while IFS='=' read -r k v; do [[ -z "${k:-}" || "$k" =~ ^# ]] && continue cur[$k]="$v" + # keep original snapshot for diff + orig_${k}="$v" + export orig_${k} 2>/dev/null || true done < "$TAGS_FILE" # Fetch latest, but only update keys set to 'auto' or 'latest' unless forced FORCE=${FORCE:-0} +changes=() for key in "${!repos[@]}"; do repo="${repos[$key]}" url="https://api.github.com/repos/$repo/releases/latest" @@ -78,12 +82,30 @@ for key in "${!repos[@]}"; do existing="${cur[$key]:-}" if [[ $FORCE -eq 1 ]] || [[ "$existing" =~ ^(auto|latest)$ ]] || [[ -z "$existing" ]]; then cur[$key]="$tag" + if [[ "$existing" != "$tag" ]]; then + changes+=("$key: $existing -> $tag") + fi echo "[OK] $key := $tag" | tee -a "$SUMMARY_LOG" else echo "[SKIP] $key pinned ($existing), not overriding" | tee -a "$SUMMARY_LOG" fi done +# Show change summary and prompt before writing (interactive only) +if [[ -t 0 && ${#changes[@]} -gt 0 ]]; then + printf "\nPlanned tag updates (refresh-hypr-tags.sh):\n" | tee -a "$SUMMARY_LOG" + printf "%s\n" "${changes[@]}" | tee -a "$SUMMARY_LOG" + printf "\nProceed with writing updated tags to %s? [Y/n]: " "$TAGS_FILE" + read -r ans || true + ans=${ans:-Y} + case "$ans" in + [nN]|[nN][oO]) + echo "[INFO] User aborted tag update; leaving $TAGS_FILE unchanged." | tee -a "$SUMMARY_LOG" + exit 0 + ;; + esac +fi + # Write back { for k in "${!cur[@]}"; do @@ -91,4 +113,4 @@ done done | sort } > "$TAGS_FILE" -echo "[OK] Refreshed tags written to $TAGS_FILE" | tee -a "$SUMMARY_LOG" \ No newline at end of file +echo "[OK] Refreshed tags written to $TAGS_FILE" | tee -a "$SUMMARY_LOG" diff --git a/update-hyprland.sh b/update-hyprland.sh index c742510..e6a32e5 100755 --- a/update-hyprland.sh +++ b/update-hyprland.sh @@ -160,6 +160,8 @@ set_tags_from_args() { fetch_latest_tags() { ensure_tags_file backup_tags + CHANGES_FILE="$LOG_DIR/update-delta-$TS.log" + : >"$CHANGES_FILE" # Require curl; jq is preferred. Fallback to grep/sed if jq is missing. if ! command -v curl >/dev/null 2>&1; then @@ -217,18 +219,53 @@ fetch_latest_tags() { map[$k]="$v" done <"$TAGS_FILE" + # Build a list of changes (old -> new) according to override rules + changes=() for k in "${!tags[@]}"; do + old="${existing[$k]:-}" + new="${tags[$k]}" if [[ $FORCE_UPDATE -eq 1 ]]; then - # Force override regardless of current value (matches FORCE=1 behavior in refresh-hypr-tags.sh) - map[$k]="${tags[$k]}" + if [[ -n "$new" && "$old" != "$new" ]]; then + changes+=("$k: $old -> $new") + map[$k]="$new" + else + # still ensure map has at least old value + [[ -n "${map[$k]:-}" ]] || map[$k]="$old" + fi else - # Only override if pinned value is 'auto' or 'latest' (or unset) - if [[ "${existing[$k]:-}" =~ ^(auto|latest)$ ]] || [[ -z "${existing[$k]:-}" ]]; then - map[$k]="${tags[$k]}" + if [[ "$old" =~ ^(auto|latest)$ ]] || [[ -z "$old" ]]; then + if [[ -n "$new" && "$old" != "$new" ]]; then + changes+=("$k: $old -> $new") + map[$k]="$new" + fi + else + # pinned: keep old + map[$k]="$old" fi fi done + # Interactive confirmation before writing, if we have a TTY + if [[ -t 0 && ${#changes[@]} -gt 0 ]]; then + printf "\nPlanned tag updates (update-hyprland.sh):\n" | tee -a "$SUMMARY_LOG" + printf "%s\n" "${changes[@]}" | tee -a "$SUMMARY_LOG" | tee -a "$CHANGES_FILE" + printf "\nProceed with writing updated tags to %s? [Y/n]: " "$TAGS_FILE" + read -r ans || true + ans=${ans:-Y} + case "$ans" in + [nN]|[nN][oO]) + echo "[INFO] User aborted tag update; leaving $TAGS_FILE unchanged." | tee -a "$SUMMARY_LOG" + # restore original copy + latest_bak=$(ls -1t "$TAGS_FILE".bak-* 2>/dev/null | head -n1 || true) + [[ -n "$latest_bak" ]] && cp "$latest_bak" "$TAGS_FILE" + return 0 + ;; + esac + else + # non-interactive: still record changes + printf "%s\n" "${changes[@]}" >>"$CHANGES_FILE" || true + fi + { for k in "${!map[@]}"; do echo "$k=${map[$k]}" @@ -479,11 +516,21 @@ run_stack() { done { - echo "\nSummary:" + printf "\nSummary:\n" for mod in "${modules[@]}"; do printf "%-24s %s\n" "$mod" "${results[$mod]:-SKIPPED}" done - echo "\nLogs under: $LOG_DIR. This run: $SUMMARY_LOG" + # Show updated versions (final tag values) + if [[ -f "$TAGS_FILE" ]]; then + printf "\nUpdated versions (from %s):\n" "$TAGS_FILE" + grep -E '^[A-Z0-9_]+=' "$TAGS_FILE" | sort + fi + # Include change list if present + if [[ -f "$LOG_DIR/update-delta-$TS.log" ]]; then + printf "\nChanges applied this run:\n" + cat "$LOG_DIR/update-delta-$TS.log" + fi + printf "\nLogs under: %s. This run: %s\n" "$LOG_DIR" "$SUMMARY_LOG" } | tee -a "$SUMMARY_LOG" # Non-zero on any FAILs @@ -519,6 +566,8 @@ while [[ $# -gt 0 ]]; do ;; --force-update) FORCE_UPDATE=1 + # --force-update implies --fetch-latest so tags actually refresh + FETCH_LATEST=1 shift ;; --restore)