Add mod storage backend support

This commit is contained in:
bri cassa 2022-08-22 12:34:55 +02:00
parent 099165cb34
commit 7b46a8a327

View File

@ -29,6 +29,7 @@ usage() {
echo -e "\t-m --map-backend <sqlite3|leveldb|redis|postgresql|dummy>"
echo -e "\t-p --player-backend <sqlite3|leveldb|postgresql|dummy|files>"
echo -e "\t-a --auth-backend <sqlite3|leveldb|postgresql|files>"
echo -e "\t-s --mod-storage-backend <sqlite3|files|dummy>"
echo -e "\t-M --minetest-mapper Install with minetest mapper support."
echo -e "\t-w --world <name> Custom world name."
echo -e "\t-P --port <port> Custom server port number."
@ -69,6 +70,7 @@ save_conf() {
echo "MAP_BACKEND=$MAP_BACKEND" >> "$conf"
echo "PLAYER_BACKEND=$PLAYER_BACKEND" >> "$conf"
echo "AUTH_BACKEND=$AUTH_BACKEND" >> "$conf"
echo "MOD_STORAGE_BACKEND=$MOD_STORAGE_BACKEND" >> "$conf"
echo "MINETEST_MAPPER=$MINETEST_MAPPER" >> "$conf"
echo "URL=$URL" >> "$conf"
echo "BRANCH=$BRANCH" >> "$conf"
@ -296,6 +298,19 @@ install_world() {
*)
error "$AUTH_BACKEND is not valid";;
esac
case $MOD_STORAGE_BACKEND in
"sqlite3"|"")
echo "mod_storage_backend = sqlite3" >> $mt
;;
"files")
echo "mod_storage_backend = files" >> $mt
;;
"dummy")
echo "mod_storage_backend = dummy" >> $mt
;;
*)
error "$MOD_STORAGE_BACKEND is not valid";;
esac
read -p "Server announce? (y/N) " val
if [[ $val =~ [yY][eE][sS]|[yY] ]]; then
echo "server_announce = true" >> $mt
@ -383,6 +398,7 @@ action() {
[ -z $MAP_BACKEND ] && MAP_BACKEND=sqlite3
[ -z $PLAYER_BACKEND ] && PLAYER_BACKEND=sqlite3
[ -z $AUTH_BACKEND ] && AUTH_BACKEND=sqlite3
[ -z $MOD_STORAGE_BACKEND ] && MOD_STORAGE_BACKEND=sqlite3
[ -z $MINETEST_MAPPER ] && MINETEST_MAPPER=0
[ -z $PORT ] && PORT=30000
[ -z $URL ] && URL="https://sys4.fr/gitea/"
@ -402,6 +418,7 @@ action() {
echo -e "\t- $MAP_BACKEND will be used as map backend."
echo -e "\t- $PLAYER_BACKEND will be used as player backend."
echo -e "\t- $AUTH_BACKEND will be used as auth backend."
echo -e "\t- $MOD_STORAGE_BACKEND will be used as mod storage backend."
echo -e "\t- Port used: $PORT."
[ $MINETEST_MAPPER -eq 1 ] && echo -e "\t- Minetest mapper support added."
echo
@ -422,7 +439,7 @@ action() {
[ $# -lt 0 ] && usage
OPT=$(getopt -o h,b:,d:,m:,p:,a:,M,w:,P: -l help,minetest-bin:,minetest-dir:,map-backend:,player-backend:,auth-backend:,minetest-mapper,url:,branch:,world:,port: -- "$@")
OPT=$(getopt -o h,b:,d:,m:,p:,a:,s:,M,w:,P: -l help,minetest-bin:,minetest-dir:,map-backend:,player-backend:,auth-backend:,mod-storage-backend:,minetest-mapper,url:,branch:,world:,port: -- "$@")
set -- $OPT
while true; do
@ -444,6 +461,9 @@ while true; do
-a|--auth-backend)
AUTH_BACKEND=$(strip "$2")
shift 2;;
-s|--mod-storage-backend)
MOD_STORAGE_BACKEND=$(strip "$2")
shift 2;;
-M|--minetest-mapper)
MINETEST_MAPPER=1
shift 1;;