dev: refactor update script
This commit is contained in:
parent
18488962fc
commit
0a29467541
3 changed files with 17 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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-)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue