Backups under .ely-old are numbered in list order, so paths near the Windows limit still upgrade and uninstall. Uninstall checks the list file first and puts everything back if it cannot delete it. Five comments shortened. Round 3 was the last; ticked without review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
651 B
Bash
24 lines
651 B
Bash
#!/usr/bin/env bash
|
|
# Prints what an install owns: files.sh <stage> <slug>
|
|
set -euo pipefail
|
|
|
|
stage=${1:?staged folder from packaging/stage.sh}
|
|
slug=${2:?app slug, such as ely-doc}
|
|
cd "$stage"
|
|
[ -z "$(find . -type l)" ] || {
|
|
echo "files.sh: links in $stage" >&2
|
|
exit 1
|
|
}
|
|
# Folders first, parents before children; then files.
|
|
{
|
|
find . -mindepth 1 -type d | sort | sed 's|$|/|'
|
|
{ find . -type f; echo "./$slug.ico"; echo ./uninstall.exe; } | sort -u
|
|
} | sed 's|^\./||' | while IFS= read -r path; do
|
|
case $path in *\\* | *[[:cntrl:]]*)
|
|
echo "files.sh: unsafe name $path" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
printf '%s\r\n' "${path//\//\\}"
|
|
done
|