mirror of
https://github.com/JaKooLit/Debian-Hyprland.git
synced 2026-02-05 09:40:14 +01:00
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
This commit is contained in:
parent
7afba04e3a
commit
8d2d0587ba
@ -9,6 +9,8 @@
|
|||||||
- This is only for debian testing+ versions
|
- This is only for debian testing+ versions
|
||||||
- `update-hyprland.sh` added `-/--help`
|
- `update-hyprland.sh` added `-/--help`
|
||||||
- documentation for updating hyprland
|
- documentation for updating hyprland
|
||||||
|
- Added: version update to `refresh-tags` and `update-hyprland` script
|
||||||
|
- Fixed: `--force-update` implies `--fetch-latest`
|
||||||
|
|
||||||
## 10 December 2025
|
## 10 December 2025
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ chmod +x ./update-hyprland.sh
|
|||||||
|
|
||||||
Flags clave:
|
Flags clave:
|
||||||
- --fetch-latest: obtiene las últimas etiquetas desde GitHub
|
- --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
|
- --dry-run / --install: solo compilar o compilar+instalar
|
||||||
- --only / --skip: limitar qué módulos se ejecutan
|
- --only / --skip: limitar qué módulos se ejecutan
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ chmod +x ./update-hyprland.sh
|
|||||||
|
|
||||||
Key flags:
|
Key flags:
|
||||||
- --fetch-latest: pull latest release tags from GitHub
|
- --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
|
- --dry-run / --install: compile-only or compile+install
|
||||||
- --only / --skip: limit which modules run
|
- --only / --skip: limit which modules run
|
||||||
|
|
||||||
|
|||||||
@ -134,11 +134,16 @@ done
|
|||||||
|
|
||||||
# Summary
|
# Summary
|
||||||
{
|
{
|
||||||
echo "\nSummary (dry-run):"
|
printf "\nSummary (dry-run):\n"
|
||||||
for mod in "${MODULES[@]}"; do
|
for mod in "${MODULES[@]}"; do
|
||||||
printf "%-24s %s\n" "$mod" "${RESULTS[$mod]:-SKIPPED}"
|
printf "%-24s %s\n" "$mod" "${RESULTS[$mod]:-SKIPPED}"
|
||||||
done
|
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"
|
} | tee -a "$SUMMARY_LOG"
|
||||||
|
|
||||||
# Exit non-zero if any FAIL occurred
|
# Exit non-zero if any FAIL occurred
|
||||||
|
|||||||
@ -56,10 +56,14 @@ declare -A cur
|
|||||||
while IFS='=' read -r k v; do
|
while IFS='=' read -r k v; do
|
||||||
[[ -z "${k:-}" || "$k" =~ ^# ]] && continue
|
[[ -z "${k:-}" || "$k" =~ ^# ]] && continue
|
||||||
cur[$k]="$v"
|
cur[$k]="$v"
|
||||||
|
# keep original snapshot for diff
|
||||||
|
orig_${k}="$v"
|
||||||
|
export orig_${k} 2>/dev/null || true
|
||||||
done < "$TAGS_FILE"
|
done < "$TAGS_FILE"
|
||||||
|
|
||||||
# Fetch latest, but only update keys set to 'auto' or 'latest' unless forced
|
# Fetch latest, but only update keys set to 'auto' or 'latest' unless forced
|
||||||
FORCE=${FORCE:-0}
|
FORCE=${FORCE:-0}
|
||||||
|
changes=()
|
||||||
for key in "${!repos[@]}"; do
|
for key in "${!repos[@]}"; do
|
||||||
repo="${repos[$key]}"
|
repo="${repos[$key]}"
|
||||||
url="https://api.github.com/repos/$repo/releases/latest"
|
url="https://api.github.com/repos/$repo/releases/latest"
|
||||||
@ -78,12 +82,30 @@ for key in "${!repos[@]}"; do
|
|||||||
existing="${cur[$key]:-}"
|
existing="${cur[$key]:-}"
|
||||||
if [[ $FORCE -eq 1 ]] || [[ "$existing" =~ ^(auto|latest)$ ]] || [[ -z "$existing" ]]; then
|
if [[ $FORCE -eq 1 ]] || [[ "$existing" =~ ^(auto|latest)$ ]] || [[ -z "$existing" ]]; then
|
||||||
cur[$key]="$tag"
|
cur[$key]="$tag"
|
||||||
|
if [[ "$existing" != "$tag" ]]; then
|
||||||
|
changes+=("$key: $existing -> $tag")
|
||||||
|
fi
|
||||||
echo "[OK] $key := $tag" | tee -a "$SUMMARY_LOG"
|
echo "[OK] $key := $tag" | tee -a "$SUMMARY_LOG"
|
||||||
else
|
else
|
||||||
echo "[SKIP] $key pinned ($existing), not overriding" | tee -a "$SUMMARY_LOG"
|
echo "[SKIP] $key pinned ($existing), not overriding" | tee -a "$SUMMARY_LOG"
|
||||||
fi
|
fi
|
||||||
done
|
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
|
# Write back
|
||||||
{
|
{
|
||||||
for k in "${!cur[@]}"; do
|
for k in "${!cur[@]}"; do
|
||||||
|
|||||||
@ -160,6 +160,8 @@ set_tags_from_args() {
|
|||||||
fetch_latest_tags() {
|
fetch_latest_tags() {
|
||||||
ensure_tags_file
|
ensure_tags_file
|
||||||
backup_tags
|
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.
|
# Require curl; jq is preferred. Fallback to grep/sed if jq is missing.
|
||||||
if ! command -v curl >/dev/null 2>&1; then
|
if ! command -v curl >/dev/null 2>&1; then
|
||||||
@ -217,18 +219,53 @@ fetch_latest_tags() {
|
|||||||
map[$k]="$v"
|
map[$k]="$v"
|
||||||
done <"$TAGS_FILE"
|
done <"$TAGS_FILE"
|
||||||
|
|
||||||
|
# Build a list of changes (old -> new) according to override rules
|
||||||
|
changes=()
|
||||||
for k in "${!tags[@]}"; do
|
for k in "${!tags[@]}"; do
|
||||||
|
old="${existing[$k]:-}"
|
||||||
|
new="${tags[$k]}"
|
||||||
if [[ $FORCE_UPDATE -eq 1 ]]; then
|
if [[ $FORCE_UPDATE -eq 1 ]]; then
|
||||||
# Force override regardless of current value (matches FORCE=1 behavior in refresh-hypr-tags.sh)
|
if [[ -n "$new" && "$old" != "$new" ]]; then
|
||||||
map[$k]="${tags[$k]}"
|
changes+=("$k: $old -> $new")
|
||||||
|
map[$k]="$new"
|
||||||
else
|
else
|
||||||
# Only override if pinned value is 'auto' or 'latest' (or unset)
|
# still ensure map has at least old value
|
||||||
if [[ "${existing[$k]:-}" =~ ^(auto|latest)$ ]] || [[ -z "${existing[$k]:-}" ]]; then
|
[[ -n "${map[$k]:-}" ]] || map[$k]="$old"
|
||||||
map[$k]="${tags[$k]}"
|
fi
|
||||||
|
else
|
||||||
|
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
|
||||||
fi
|
fi
|
||||||
done
|
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
|
for k in "${!map[@]}"; do
|
||||||
echo "$k=${map[$k]}"
|
echo "$k=${map[$k]}"
|
||||||
@ -479,11 +516,21 @@ run_stack() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "\nSummary:"
|
printf "\nSummary:\n"
|
||||||
for mod in "${modules[@]}"; do
|
for mod in "${modules[@]}"; do
|
||||||
printf "%-24s %s\n" "$mod" "${results[$mod]:-SKIPPED}"
|
printf "%-24s %s\n" "$mod" "${results[$mod]:-SKIPPED}"
|
||||||
done
|
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"
|
} | tee -a "$SUMMARY_LOG"
|
||||||
|
|
||||||
# Non-zero on any FAILs
|
# Non-zero on any FAILs
|
||||||
@ -519,6 +566,8 @@ while [[ $# -gt 0 ]]; do
|
|||||||
;;
|
;;
|
||||||
--force-update)
|
--force-update)
|
||||||
FORCE_UPDATE=1
|
FORCE_UPDATE=1
|
||||||
|
# --force-update implies --fetch-latest so tags actually refresh
|
||||||
|
FETCH_LATEST=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--restore)
|
--restore)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user