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-09-21 07:58:12 +09:00
|
|
|
say "Start upgrading Firefish!"
|
2023-11-14 23:04:56 +09:00
|
|
|
br
|
2023-10-27 23:05:57 +09:00
|
|
|
|
2023-08-25 06:19:15 +09:00
|
|
|
# Pull changes
|
|
|
|
## git pull
|
2023-11-14 23:04:56 +09:00
|
|
|
OLD_COMMIT=$(git rev-parse HEAD)
|
2023-08-25 06:19:15 +09:00
|
|
|
|
|
|
|
say "Pulling changes from the remote repo..."
|
|
|
|
|
|
|
|
running "git checkout -- package.json packages/backend/assets"
|
|
|
|
git checkout -- package.json packages/backend/assets
|
|
|
|
|
2023-11-06 06:35:10 +09:00
|
|
|
running "git pull --ff --no-edit --autostash --strategy-option theirs"
|
|
|
|
git pull --ff --no-edit --autostash --strategy-option theirs
|
2023-08-25 06:19:15 +09:00
|
|
|
|
2023-11-14 23:04:56 +09:00
|
|
|
NEW_COMMIT=$(git rev-parse HEAD)
|
|
|
|
say "Pulled successfully!"
|
|
|
|
br
|
2023-08-25 06:19:15 +09:00
|
|
|
|
|
|
|
## check if the update script itself is updated
|
2023-11-12 05:31:20 +09:00
|
|
|
say "Checking if the update script itself has been modified by this update..."
|
2023-11-15 13:23:36 +09:00
|
|
|
if [ "$(git diff "${OLD_COMMIT}" "${NEW_COMMIT}" update.sh neko/update)" != "" ]; then
|
2023-08-25 06:19:15 +09:00
|
|
|
say "Oh meow, that seems to be the case."
|
|
|
|
say "I'm sorry to bother you, but please run this script again!"
|
|
|
|
exit 1
|
|
|
|
else
|
2023-11-14 23:04:56 +09:00
|
|
|
say "This script seems to be up-to-date!"
|
|
|
|
br
|
2023-08-25 06:19:15 +09:00
|
|
|
fi
|
|
|
|
|
2023-10-28 20:19:25 +09:00
|
|
|
## show messages
|
|
|
|
for message in neko/messages/*; do
|
|
|
|
file=$(basename -- "${message}")
|
2023-11-12 05:31:20 +09:00
|
|
|
if [ ! -f "neko/flags/${file}" ]; then
|
|
|
|
if [ $# != 1 ] || [ "$1" != "--skip-all-confirmations" ]; then
|
2023-10-29 02:44:22 +09:00
|
|
|
say "There is an important notice!"
|
|
|
|
cat "${message}"
|
2023-11-14 23:04:56 +09:00
|
|
|
|
2023-10-28 21:42:14 +09:00
|
|
|
say "Continue? (Are you ready for upgrading?)"
|
2023-11-14 23:04:56 +09:00
|
|
|
printf "[y/N] > "
|
|
|
|
read -r yn
|
|
|
|
|
2023-10-28 21:42:14 +09:00
|
|
|
case "${yn}" in
|
|
|
|
[Yy]|[Yy][Ee][Ss])
|
|
|
|
touch "neko/flags/${file}"
|
|
|
|
say "Let's go!"
|
|
|
|
say "To read the message again, run: \$ cat ${message}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
say "Okay, please run this script again when you're ready!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2023-10-29 02:44:22 +09:00
|
|
|
else
|
|
|
|
touch "neko/flags/${file}"
|
2023-10-28 21:42:14 +09:00
|
|
|
fi
|
2023-10-28 20:19:25 +09:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2023-11-12 05:31:20 +09:00
|
|
|
say "Do you use Docker?"
|
2023-11-14 23:04:56 +09:00
|
|
|
printf "[y/N] > "
|
|
|
|
read -r yn
|
2023-11-12 05:31:20 +09:00
|
|
|
|
|
|
|
case "${yn}" in
|
|
|
|
[Yy]|[Yy][Ee][Ss])
|
2023-11-14 09:42:43 +09:00
|
|
|
./neko/update/docker.sh "$@"
|
2023-11-12 05:31:20 +09:00
|
|
|
;;
|
|
|
|
*)
|
2023-11-14 09:42:43 +09:00
|
|
|
./neko/update/native.sh "$@"
|
2023-11-12 05:31:20 +09:00
|
|
|
;;
|
|
|
|
esac
|
2023-08-25 06:19:15 +09:00
|
|
|
|
|
|
|
# Done
|
|
|
|
say "Enjoy your sabakan life~"
|