1
0
Fork 1
mirror of https://example.com synced 2024-11-23 02:36:38 +09:00

dev: add ability to pass --docker, --podman, or --native to update.sh

passing more than one of these flags is not expected
This commit is contained in:
naskya 2024-01-09 10:50:34 +09:00
parent 0a29467541
commit ddbf884cb5
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
2 changed files with 28 additions and 18 deletions

View file

@ -69,25 +69,35 @@ for message in $(find neko/messages -type f ! -name '*.resolved' -print | sort);
fi fi
done done
docker_update() {
./neko/update/container.sh 'docker' "$@"
}
podman_update() {
./neko/update/container.sh 'podman' "$@"
}
native_update() {
./neko/update/native.sh "$@"
}
if contains '--docker' "$@"; then docker_update "$@"
elif contains '--podman' "$@"; then podman_update "$@"
elif contains '--native' "$@"; then native_update "$@"
else
say 'Do you use Docker or Podman?' say 'Do you use Docker or Podman?'
printf 'd: Docker, p: Podman, n: No [d/p/N] > ' printf 'd: Docker, p: Podman, n: No [d/p/N] > '
read -r resp read -r resp
case "${resp}" in case "${resp}" in
[Dd])
./neko/update/docker.sh 'docker' "$@"
;;
[Pp])
./neko/update/docker.sh 'podman' "$@"
;;
[Yy]|[Yy][Ee][Ss]) [Yy]|[Yy][Ee][Ss])
sadsay "Watch out! ${resp} is not a valid answer." >&2 sadsay "Watch out! ${resp} is not a valid answer." >&2
exit 1 exit 1
;; ;;
*) [Dd]) docker_update "$@" ;;
./neko/update/native.sh "$@" [Pp]) podman_update "$@" ;;
;; *) native_update "$@" ;;
esac esac
fi
# Done # Done
say 'Enjoy your sabakan life~' say 'Enjoy your sabakan life~'