From 9981072c5f38326d7a4d4a8efdc1d94c3c98c71f Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Wed, 6 Feb 2019 13:55:22 -0500 Subject: [PATCH] add installer --- install.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..f9fa1f6 --- /dev/null +++ b/install.sh @@ -0,0 +1,31 @@ +#!/bin/sh +echo +dot_mt="$HOME/.minetest" +if [ ! -d "$dot_mt" ]; then + echo "ERROR: Nothing done since no $dot_mt." + exit 1 +fi +MT_MYGAME_MODS_PATH="$dot_mt/mods" +MTMOD_DEST_NAME="nether" +MTMOD_DEST_PATH="$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME" +flag_file="$MTMOD_DEST_PATH/init.lua" +end_msg="Successfully installed to $MTMOD_DEST_PATH" +if [ ! -d "$MTMOD_DEST_PATH" ]; then + mkdir -p "$MTMOD_DEST_PATH" +fi +if [ ! -f init.lua ]; then + cd "${0%/*}" + echo "WARNING: had to change directory to `pwd` since init.lua was not found..." +fi + +if [ ! -f init.lua ]; then + echo "You are not in the nether mod, so install.sh failed." + exit 2 +fi +cp -R * "$MTMOD_DEST_PATH" +if [ ! -f "$flag_file" ]; then + end_msg="$MTMOD_DEST_PATH could not be installed ($flag_file not copied to destination)." +fi +echo "$end_msg" +echo +echo