1
0
Fork 1
mirror of https://example.com synced 2024-11-22 14:36:39 +09:00

dev: refactor update script

This commit is contained in:
naskya 2024-01-09 10:23:23 +09:00
parent 18488962fc
commit 0a29467541
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
3 changed files with 17 additions and 4 deletions

View file

@ -4,7 +4,7 @@ set -eu
. neko/update/utils
# Confirm that the server is stopped
if [ "$#" != '1' ] || [ "$1" != '--skip-all-confirmations' ]; then
if ! contains '--skip-all-confirmations' "$@"; then
say 'Did you stop your server?'
printf '[Y/n] > '
read -r yn

View file

@ -27,6 +27,19 @@ br() {
printf '\n'
}
contains() {
target="$1"
shift
for item in "$@"; do
if [ "${item}" = "${target}" ]; then
return 0 # found
fi
done
return 1 # not found
}
version() {
UPSTREAM_VERSION=$(pnpm pkg get version | sed -e 's/"//g')
COMMIT_DATE=$(git show --no-patch --pretty='%cs' FETCH_HEAD | sed -e 's/-//g' | cut -c 3-)

View file

@ -43,7 +43,9 @@ for message in $(find neko/messages -type f ! -name '*.resolved' -print | sort);
file=$(basename -- "${message}")
if [ ! -f "neko/flags/${file}" ]; then
if [ "$#" != '1' ] || [ "$1" != '--skip-all-confirmations' ]; then
if contains '--skip-all-confirmations' "$@"; then
touch "neko/flags/${file}"
else
say 'There is an important notice!'
cat "${message}"
@ -63,8 +65,6 @@ for message in $(find neko/messages -type f ! -name '*.resolved' -print | sort);
exit 1
;;
esac
else
touch "neko/flags/${file}"
fi
fi
done