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

31 lines
809 B
Bash
Executable file

#!/bin/sh
set -eu
. neko/update/utils
say 'Start upgrading Firefish!'
# Pull changes
OLD_COMMIT=$(git rev-parse --short HEAD)
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 origin main'
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"
fi
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