From 7b46a8a32748f936a71ef56359b32418950592db Mon Sep 17 00:00:00 2001 From: sys4 Date: Mon, 22 Aug 2022 12:34:55 +0200 Subject: [PATCH] Add mod storage backend support --- install.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index bf4d1e6..c07c270 100755 --- a/install.sh +++ b/install.sh @@ -29,6 +29,7 @@ usage() { echo -e "\t-m --map-backend " echo -e "\t-p --player-backend " echo -e "\t-a --auth-backend " + echo -e "\t-s --mod-storage-backend " echo -e "\t-M --minetest-mapper Install with minetest mapper support." echo -e "\t-w --world Custom world name." echo -e "\t-P --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;;