More fixes for update

This commit is contained in:
2026-10-19 14:01:00 -06:00
parent a65f07c22e
commit f10463b89c
5 changed files with 37 additions and 10 deletions
+15 -3
View File
@@ -1,5 +1,16 @@
#!/bin/bash
# The whole script is wrapped in { ...; exit; } so bash parses all of it before
# running anything. That way, replacing this file mid-run (e.g. by git pull and
# the copy below) can't make the running copy read a mix of old and new text.
{
# Install a script atomically (copy to a temp file, then rename over the target)
install_script() {
local tmp
tmp="$(mktemp "$2.XXXXXX")" && cp "$1" "$tmp" && chmod 755 "$tmp" && mv -f "$tmp" "$2"
}
# Print the logo
print_logo() {
cat << "EOF"
@@ -28,9 +39,8 @@ if [[ -z "$UPDATE_REEXECED" ]] && ! git -C "$COREDESKTOP" pull; then
export UPDATE_PULL_FAILED=1
fi
mkdir -p "$COREDESKTOP/updates.d"
# --remove-destination replaces copies left root-owned by older versions of this script
cp --remove-destination "$COREDESKTOP/update" ~/.local/bin/update
cp --remove-destination "$COREDESKTOP/refresh" ~/.local/bin/refresh
install_script "$COREDESKTOP/update" ~/.local/bin/update
install_script "$COREDESKTOP/refresh" ~/.local/bin/refresh
if [[ -z "$UPDATE_REEXECED" ]]; then
export UPDATE_REEXECED=1
@@ -63,3 +73,5 @@ if (( ${#FAILED[@]} > 0 )); then
fi
echo "Done."
exit 0
}