detect backend, screen, nodejs, v5 in mts-ENLIVEN

master
poikilos 2018-09-22 01:16:20 +00:00 committed by Jacob Gustafson
parent b28dc1864b
commit 8053cf1999
5 changed files with 128 additions and 29 deletions

View File

@ -26,7 +26,28 @@ fi
# screen -S MinetestServer minetestserver --gameid ENLIVEN --worldname FCAGameAWorld
# screen -S MinetestServer /home/owner/minetest/bin/minetestserver --gameid ENLIVEN --worldname FCAGameAWorld
MT_MYWORLD_NAME="FCAWorldB"
screen -S MinetestServer $mts --gameid ENLIVEN --worldname $MT_MYWORLD_NAME
if [ ! -d "$HOME/.minetest/worlds/" ]; then
echo "ERROR: missing $HOME/.minetest/worlds/$MT_MYWORLD_NAME"
MT_MYWORLD_DIR="$HOME/.minetest/worlds/$MT_MYWORLD_NAME"
WORLD_MT_PATH="$MT_MYWORLD_DIR/world.mt"
if [ ! -d "$MT_MYWORLD_DIR" ]; then
echo "ERROR: Nothing to do since missing $MT_MYWORLD_DIR"
exit 1
fi
if grep -q "backend =" "$WORLD_MT_PATH"; then
echo "backends:"
cat $WORLD_MT_PATH | grep backend
else
if [ -d "$MT_MYWORLD_DIR/map.db" ]; then
echo "ERROR: Nothing to do since map.db was found but there is no backend specified in $WORLD_MT_PATH:"
cat "$WORLD_MT_PATH"
exit 1
else
cat "WARNING: no backend specified in $WORLD_MT_PATH"
echo "3..."
sleep 1
echo "2..."
sleep 1
echo "1..."
sleep 1
fi
fi
screen -S MinetestServer $mts --gameid ENLIVEN --worldname $MT_MYWORLD_NAME

19
etc/git_all_push Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
# Before doing this, you can try:
# git diff
if [ ! -z "$1" ]; then
if [ -z "$2" ]; then
echo "git add -A"
git add -A
echo "git commit -m \"$1\""
git commit -m "$1"
echo "git push"
git push
else
echo "Too many arguments. Specify only a message, in quotes."
fi
else
echo "You must specify a message in quotes."
fi

View File

@ -113,6 +113,27 @@ if [ -f "$MT_MYWORLD_DIR/world.mt" ]; then
mv -f "$MT_MYWORLD_DIR/world.mt" "$MT_MYWORLD_DIR/world.mt.bak"
fi
#process conf file (account for spaces around equal sign and variable names containing name of other variable name)
shopt -s extglob
configfile="$WORLD_MT_PATH" # set the actual path name of your (DOS or Unix) config file
tr -d '\r' < $configfile > $configfile.unix
while IFS='= ' read -r lhs rhs
do
if [[ ! $lhs =~ ^\ *# && -n $lhs ]]; then
rhs="${rhs%%\#*}" # Del in line right comments
rhs="${rhs%%*( )}" # Del trailing spaces
rhs="${rhs%\"*}" # Del opening string quotes
rhs="${rhs#\"*}" # Del closing string quotes
declare world_mt_var_$lhs="$rhs"
fi
done < $configfile.unix
# REMAKE world.mt
cd
if [ -f "$WORLD_MT_PATH" ]; then
@ -121,11 +142,16 @@ if [ -f "$WORLD_MT_PATH" ]; then
sudo chgrp `cat /tmp/local_mts_user` "$WORLD_MT_PATH"
fi
echo "gameid = $MT_MYGAME_NAME" > "$WORLD_MT_PATH"
if [ "`grep -q "backend" "$WORLD_MT_PATH"`" -eq 0 ]; then
echo "has no backend"
#if ! grep -q "backend =" "$WORLD_MT_PATH"; then
if [ -z "$world_mt_var_backend" ]; then
echo "has no backend, setting leveldb..."
echo "backend = leveldb" >> "$WORLD_MT_PATH"
fi
#if ! grep -q "backend" "$WORLD_MT_PATH"; then
if [ -z "$world_mt_var_player_backend" ]; then
echo "has no player_backend, setting sqlite3..."
echo "player_backend = sqlite3" >> "$WORLD_MT_PATH"
fi
echo "backend = leveldb" >> "$WORLD_MT_PATH"
echo "player_backend = sqlite3" >> "$WORLD_MT_PATH"
echo "teleport_perms_to_build = false" >> "$WORLD_MT_PATH"
echo "teleport_perms_to_configure = false" >> "$WORLD_MT_PATH"
echo "teleport_requires_pairing = true" >> "$WORLD_MT_PATH"
@ -667,6 +693,8 @@ add_git_mod awards_board awards_board https://gitlab.com/poikilos/awards_board.g
#region PLAYER UX MODS
echo "Adding TenPlus1's money (BARTER-ONLY fork of kotolegokot's minetest-mod-money):"
add_git_mod money money https://notabug.org/TenPlus1/money
add_git_mod lightning lightning https://github.com/minetest-mods/lightning.git
add_git_mod unified_inventory unified_inventory https://github.com/minetest-mods/unified_inventory.git
@ -928,8 +956,8 @@ echo ""
echo " * for invhack, remember to do: /giveme invhack:tool"
echo " * uncomment columns in lapis mod"
echo " * Make sure client (server done already above) minetest.conf has secure.trusted_mods = advanced_npc"
echo " * Make sure writable minetest conf was successfully written"
echo " over $MT_MYGAME_DIR/minetest.conf with (NOTE: protector_drop is deprecated):"
#echo " * Make sure writable minetest conf was successfully written"
#echo " over $MT_MYGAME_DIR/minetest.conf with (NOTE: protector_drop is deprecated):"
echo "protector_radius = 7"
echo "protector_pvp = true"
echo "protector_pvp_spawn = 10"
@ -952,6 +980,12 @@ else
fi
echo "(used $MT_MINETEST_GAME_PATH as base)"
echo "spawners_enable: $spawners_enable"
echo
echo "As for world.mt, the following WORLD_MT_PATH was used: $WORLD_MT_PATH"
echo " content:"
cat "$WORLD_MT_PATH"
echo
echo
if [ -f "`command -v blender`" ]; then
BLENDER_CURRENT_VERSION=`blender --version | cut -d " " -f 2`

View File

@ -9,8 +9,8 @@ if [ "$1" = "--help" ]; then
echo "This script installs ENLIVEN subgame for minetest. It uses individual git repositories, so please only run this once so as not to exceed their bandwidth."
echo "Usage:"
echo
echo "version_0_5_enable=<value> (where value is true or false): forces 0.5 (if not specified, this script uses 0.5 versions of mods if minetest is at /usr/local/share/minetest)"
echo
#echo "version_0_5_enable=<value> (where value is true or false): forces 0.5 (if not specified, this script uses 0.5 versions of mods if minetest is at /usr/local/share/minetest)"
#echo
echo "local_enable=<value> (where value is true or false): forces /usr/local/share/minetest (if not specified, script detects minetest but if exists both in /usr/share/ and /usr/local/share, prefers /usr/local/share/minetest)"
echo
exit 0
@ -112,15 +112,15 @@ fi
if [ -f "$CONFIGS_PATH/local_enable" ]; then
local_enable=$(head -n 1 $CONFIGS_PATH/local_enable)
fi
if [ -f "$CONFIGS_PATH/version_0_5_enable" ]; then
version_0_5_enable=$(head -n 1 $CONFIGS_PATH/version_0_5_enable)
fi
#if [ -f "$CONFIGS_PATH/version_0_5_enable" ]; then
# version_0_5_enable=$(head -n 1 $CONFIGS_PATH/version_0_5_enable)
#fi
if [ -z "$local_enable" ]; then
echo "$local_enable" > "$CONFIGS_PATH/local_enable"
fi
if [ -z "$version_0_5_enable" ]; then
echo "$version_0_5_enable" > "$CONFIGS_PATH/version_0_5_enable"
fi
#if [ -z "$version_0_5_enable" ]; then
# echo "$version_0_5_enable" > "$CONFIGS_PATH/version_0_5_enable"
#fi
mtgame_name="minetest_game"
MT_MINETEST_GAME_PATH=$USR_SHARE_MINETEST/games/$mtgame_name
@ -330,10 +330,12 @@ if [ ! -d "$MTMOD_DEST_PATH" ] || [ "$update_enable" = "true" ]; then
sudo rm -Rf "$MTMOD_DEST_PATH"
fi
if [ ! -z "$BRANCH" ]; then
echo "Cloning $BRANCH branch..."
echo "BRANCH: Cloning $BRANCH branch..."
echo "git clone -b $BRANCH --single-branch $URL"
git clone -b $BRANCH --single-branch $URL
else
echo "Cloning main branch since no branch specified: $BRANCH"
#echo "Cloning main branch since no branch specified: $BRANCH"
echo "git clone $URL"
git clone $URL
fi
if [ -d "$MTMOD_UNZ_NAME" ]; then
@ -412,14 +414,14 @@ echo
echo
echo "To preconfigure, write true or false to files in $CONFIGS_PATH named:"
echo " local_enable"
echo " version_0_5_enable"
#echo " version_0_5_enable"
echo
echo "Using following configuration:"
if [ -z "$version_0_5_enable" ]; then
echo " version_0_5_enable: (auto--set this var before pasting region into terminal)"
else
echo " version_0_5_enable: $version_0_5_enable"
fi
#if [ -z "$version_0_5_enable" ]; then
# echo " version_0_5_enable: (auto--set this var before pasting region into terminal)"
#else
echo " version_0_5_enable: $version_0_5_enable"
#fi
if [ -z "$local_enable" ]; then
echo " local_enable: (auto--set this var before pasting region into terminal)"
else

View File

@ -8,13 +8,36 @@ if [ -d ~/Applications/EnlivenMinetest/webapp ]; then
cd ~/Applications/EnlivenMinetest/webapp
elif [ -d ~/Documents/EnlivenMinetest/webapp ]; then
cd ~/Documents/GitHub/EnlivenMinetest/webapp
else
elif [ -d ~/GitHub/EnlivenMinetest/webapp ]; then
cd ~/GitHub/EnlivenMinetest/webapp
elif [ -d webapp ]; then
cd webapp
else
echo "FAILED to find webapp directory in EnlivenMinetest"
fi
node_bin="echo"
if [ `which node` ]; then
node_bin="node"
echo "detected node.js command: $node_bin"
elif [ `which js` ]; then
node_bin="js"
echo "detected node.js command: $node_bin"
else
echo "ERROR: Nothing to do since could not find a node or js command!"
exit 1
fi
#js app.js
if [ -f "`command -v node`" ]; then
screen -S EnlivenMinetest node server.js
if [ ` which screen` ]; then
screen -S EnlivenMinetest $node_bin server.js
else
screen -S EnlivenMinetest js server.js
echo "WARNING: no screen command so running directly in this session..."
echo "3..."
sleep 1
echo "2..."
sleep 1
echo "1..."
sleep 1
$node_bin server.js
fi