Outline what the first version of the upgrade script should do

This commit is contained in:
2026-02-02 20:03:19 -05:00
parent 341db4f821
commit f352ae44e1

38
upgrade.sh Normal file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# shellcheck disable=SC2002
set -eu
set -o pipefail
IFS=$'\n\t'
# print useful message on failure
trap 's=$?; echo >&2 "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
# shellcheck disable=SC2034
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$DIR"
# - Check if the file .diachron-version exists; save its value in a variable
# named old_diachron_version
# - Check if the repository is dirty; if there are any files that git knows
# about that have been changed but not committed, abort with a message
# - Get the current commit and store it in a variable
# - Perform a two checkouts of
# https://gitea.philologue.net/philologue/diachron, each in its own
# temporary directory. We'll call one "old" and one "new"
# - In old, check out $old_diachron_version; in our working application
# directory, delete all of the files in file-list using git rm
# - In new, check out whatever was passed as argv[1]
# - Copy all of the files in file-list to the working application and stage
# them with git add
# - Commit
# - Should we run sync.sh or should we advise the user to run sync.sh?