1
0
Fork 1
mirror of https://example.com synced 2024-11-25 20:36:40 +09:00
firefish/update.sh

32 lines
809 B
Bash
Raw Normal View History

#!/bin/sh
set -eu
. neko/update/utils
2023-07-22 20:25:52 +09:00
2023-11-18 16:37:55 +09:00
say 'Start upgrading Firefish!'
# Pull changes
2024-01-02 06:11:33 +09:00
OLD_COMMIT=$(git rev-parse --short HEAD)
2023-11-18 16:37:55 +09:00
say 'Pulling changes from the remote repo...'
run 'git checkout -- package.json packages/backend/assets'
2024-01-18 00:26:46 +09:00
run 'git pull --ff --no-edit --autostash --strategy-option theirs origin main'
2024-01-02 06:11:33 +09:00
NEW_COMMIT=$(git rev-parse --short HEAD)
if [ "${OLD_COMMIT}" != "${NEW_COMMIT}" ]; then
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!'
br
# 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...'
br
exec "$0" "$@"
else
./neko/update/main.sh "$@"
fi