Files
ElyOffice/packaging/windows/files.sh
T
ZacharyZhang-NYandClaude Opus 5.5 50d348d4e5 R6.11 round 2 fix: the installer lists every file it installs
The list names each file and folder; upgrades and uninstall move only
listed files and remove a folder only when empty. Every file, nested
ones included, must be writable first. A new file whose place holds a
file this app did not install refuses the install. A copy failing
midway removes what it wrote and puts the old release back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 16:18:55 -04:00

24 lines
668 B
Bash

#!/usr/bin/env bash
# Prints the files and folders 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