Browse Source

Make a temp world, allow specifying a template world for that, and add related usage output. Improve other output.

master
poikilos 2 years ago
parent
commit
55e13c1ece
  1. 62
      utilities/lmk-run

62
utilities/lmk-run

@ -6,14 +6,23 @@ usage(){
lmk-run lmk-run
------- -------
This script is part of <https://github.com/poikilos/EnlivenMinetest>. This script is part of <https://github.com/poikilos/EnlivenMinetest>.
Does all of the following
- Gets and unzips linux-minetest-kit.zip if possible if there is no
linux-minetest-kit in the current working directory.
- Compile libraries if there is no linux-minetest-kit/toolstree.
- Compile minetest if there is no exe matching the specified options.
Suggested setup for a user in the sudo group: Suggested setup for a user in the sudo group:
''' '''
chgrp sudo /opt chgrp sudo /opt
# continue to Further setup
''' '''
Suggested setup for minebest user: Suggested setup for minebest user:
''' '''
chgrp minebest /opt chgrp minebest /opt
# continue to Further setup
''' '''
Further setup: Further setup:
@ -26,6 +35,12 @@ ln -s ~/git/EnlivenMinetest/utilities/fix-lmk-permissions.sh
''' '''
Examples: Examples:
lmk-run classic client ~/minetest/worlds/center
# ^ creates classic client and opens the world ~/minetest/worlds/center
# - requires that the game is in linux-minetest-kit/minetest/games
# that has the gameid matching the one in the world (same goes for
# any of the automatically checked world paths).
lmk-run classic server lmk-run classic server
# ^ creates minetestserver # ^ creates minetestserver
@ -44,6 +59,8 @@ lmk-run finetest client
lmk-run trolltest client lmk-run trolltest client
# ^ creates trolltest # ^ creates trolltest
END END
} }
if [ "x$1" = "x--help" ]; then if [ "x$1" = "x--help" ]; then
@ -130,10 +147,51 @@ fi
if [ ! -f minetest/bin/$EXE_NAME ]; then if [ ! -f minetest/bin/$EXE_NAME ]; then
echo "[lmk-run] compiling..." echo "[lmk-run] compiling..."
$PRE_CMD perl mtcompile-program.pl build --$LMK_MODE $APP_ARG $PRE_CMD perl mtcompile-program.pl build --$LMK_MODE $APP_ARG
if [ $? -ne 0 ]; then code=$?
>&2 echo "[lmk-run] Error: '$PRE_CMD perl mtcompile-program.pl build --$LMK_MODE $APP_ARG' failed in `pwd`." if [ $code -ne 0 ]; then
>&2 echo "[lmk-run] Error: '$PRE_CMD perl mtcompile-program.pl build --$LMK_MODE $APP_ARG' failed in `pwd` with code $code."
exit 1 exit 1
fi fi
else else
echo "[lmk-run] using existing `pwd`/minetest/bin/$EXE_NAME" echo "[lmk-run] using existing `pwd`/minetest/bin/$EXE_NAME"
fi fi
cd minetest/bin
if [ $? -ne 0 ]; then
PRE_CMD=""
>&2 echo "[lmk-run] 'cd minebest/bin' failed in `pwd`."
fi
#if "x$APP" = "xserver" ]; then
echo "* Looking for a test world to copy..."
if [ "x$SRC_WORLD" = "x" ]; then
SRC_WORLD="$3"
else
SRC_WORLD=
fi
if [ "x$SRC_WORLD" = "x" ]; then
for dir in ~/minetest-220509/worlds/bg190406 /home/owner/bg190406
do
printf "* checking for \"$dir\"..."
if [ -d $dir ]; then
SRC_WORLD="$dir"
break
fi
done
fi
if [ "x$SRC_WORLD" = "x" ]; then
echo "No known test world was found. Try making a small world first, and specify it as the 3rd parameter or set SRC_WORLD in the environment. Note that the gameid in the file must exist."
exit 1
else
echo "[lmk-run] found $SRC_WORLD to copy"
fi
world_name="`basename $SRC_WORLD`"
mkdir -p ~/tmp
dst_world="$HOME/tmp/${world_name}-$EXE_NAME"
echo "[lmk-run] syncing to $dst_world destructively..."
rsync -rt --erase $SRC_WORLD/ $dst_world
if [ $? -ne 0 ]; then
>&2 echo "[lmk-run] 'rsync -rt --erase $SRC_WORLD/ $dst_world' failed in `pwd`."
fi
echo "[lmk-run] running $EXE_NAME --world $dst_world"
./$EXE_NAME --world $dst_world
#else
#fi

Loading…
Cancel
Save