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/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..9019cb7 100755 --- a/refresh-hypr-tags.sh +++ b/refresh-hypr-tags.sh @@ -60,6 +60,7 @@ 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 +79,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 +110,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..51301a5 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,6 +219,8 @@ 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 if [[ $FORCE_UPDATE -eq 1 ]]; then # Force override regardless of current value (matches FORCE=1 behavior in refresh-hypr-tags.sh) @@ -229,6 +233,27 @@ fetch_latest_tags() { 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 +504,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