2023-11-14 23:04:56 +09:00
|
|
|
#!/bin/sh
|
2023-08-25 06:19:15 +09:00
|
|
|
set -eu
|
|
|
|
|
2023-11-14 23:04:56 +09:00
|
|
|
. neko/update/utils
|
2023-07-22 20:25:52 +09:00
|
|
|
|
2023-11-18 16:37:55 +09:00
|
|
|
say 'Start upgrading Firefish!'
|
2023-10-27 23:05:57 +09:00
|
|
|
|
2023-08-25 06:19:15 +09:00
|
|
|
# Pull changes
|
2024-01-02 06:11:33 +09:00
|
|
|
OLD_COMMIT=$(git rev-parse --short HEAD)
|
2023-08-25 06:19:15 +09:00
|
|
|
|
2023-11-18 16:37:55 +09:00
|
|
|
say 'Pulling changes from the remote repo...'
|
|
|
|
run 'git checkout -- package.json packages/backend/assets'
|
|
|
|
run 'git pull --ff --no-edit --autostash --strategy-option theirs'
|
2023-08-25 06:19:15 +09:00
|
|
|
|
2024-01-02 06:11:33 +09:00
|
|
|
NEW_COMMIT=$(git rev-parse --short HEAD)
|
|
|
|
|
|
|
|
if [ "${OLD_COMMIT}" != "${NEW_COMMIT}" ]; then
|
2024-01-05 13:22:50 +09:00
|
|
|
run "git log --no-merges --reverse --format='%s (by %an)' ${OLD_COMMIT}..${NEW_COMMIT} > neko/volume/CHANGELOG"
|
2024-01-02 06:11:33 +09:00
|
|
|
fi
|
2023-11-21 21:33:56 +09:00
|
|
|
|
2023-11-18 16:37:55 +09:00
|
|
|
say 'Pulled successfully!'
|
2023-11-14 23:04:56 +09:00
|
|
|
br
|
2023-08-25 06:19:15 +09:00
|
|
|
|
2024-01-10 10:00:07 +09:00
|
|
|
# Check if the update script itself is modified
|
|
|
|
if [ "$(git diff "${OLD_COMMIT}" "${NEW_COMMIT}" update.sh)" != '' ]; then
|
|
|
|
say 'This script itself has been modified by the update. Reloading...'
|
2023-11-14 23:04:56 +09:00
|
|
|
br
|
2024-01-10 10:00:07 +09:00
|
|
|
exec "$0" "$@"
|
2024-01-09 10:50:34 +09:00
|
|
|
else
|
2024-01-10 10:00:07 +09:00
|
|
|
./neko/update/main.sh "$@"
|
2024-01-09 10:50:34 +09:00
|
|
|
fi
|