Browse Source

remove hacky pastability for portability reasons

pastability no longer needed since can just do: source minetestenv.rc
master
poikilos 6 years ago
committed by Jacob Gustafson
parent
commit
70f5f9bda0
  1. 80
      minetestenv.rc

80
minetestenv.rc

@ -65,18 +65,36 @@ err_txt=$HOME/err-enliven.txt
#if [ "$0" = "-bash" ]; then
#'[[' doesn't work in debian
show_changes="true"
if [[ $0 == *"$shell_name"* ]]; then
REPO_PATH="$HOME/GitHub/EnlivenMinetest"
echo "You must have pasted this into terminal, so assuming REPO_PATH:"
echo " $REPO_PATH"
else
#[[ doesn't work in debian:
#if [[ $0 == *"$shell_name"* ]]; then
#doesn't work on Fedora since shell_name is blank even when in shell and not pasting:
#if [ "$shell_name" != "" ]; then
#REPO_PATH="$HOME/GitHub/EnlivenMinetest"
#echo "You must have pasted this into terminal, so assuming REPO_PATH:"
#echo " $REPO_PATH"
#else
SCRIPT=$(readlink -f "$0")
if [ "$SCRIPT" = "/bin/bash" ]; then
SCRIPT=minetestenv.rc
if [ ! -f "$SCRIPT" ]; then
echo "ERROR: could not find self (need location of self in order to get SCRIPTPATH and then REPO_PATH in order for patches directory to be found."
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
sleep 1
echo " 3..."
sleep 1
echo " 2..."
sleep 1
echo " 1..."
sleep 1
exit 1
fi
fi
# Absolute path this script is in, thus /home/user/bin
SCRIPTPATH=$(dirname "$SCRIPT")
REPO_PATH="$SCRIPTPATH"
#formerly, this script was in a subdir:
#REPO_PATH=$(dirname "$SCRIPTPATH")
fi
#fi
PATCHES_PATH="$REPO_PATH/patches"
echo "PATCHES_PATH: $PATCHES_PATH"
@ -179,20 +197,22 @@ if [ -z "$MT_DEFAULT_WORLD_NAME" ]; then
fi
#if [ "$0" = "-bash" ]; then
#'[[' doesn't work in debian:
if [[ $0 == *"$shell_name"* ]]; then
REPO_PATH="$HOME/GitHub/EnlivenMinetest"
MT_MYWORLD_NAME="world"
echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:"
echo " $MT_MYWORLD_NAME"
echo "Press Ctrl C to cancel, otherwise $MT_MYWORLD_NAME will be used..."
#sleep 1
#echo " 3..."
#sleep 1
#echo " 2..."
sleep 1
echo " 1..."
sleep 1
else
#if [[ $0 == *"$shell_name"* ]]; then
#doesn't work on Fedora since shell_name is blank even when in shell and not pasting:
#if [ "$shell_name" != "" ]; then
# REPO_PATH="$HOME/GitHub/EnlivenMinetest"
# MT_MYWORLD_NAME="world"
# echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:"
# echo " $MT_MYWORLD_NAME"
# echo "Press Ctrl C to cancel, otherwise $MT_MYWORLD_NAME will be used..."
# #sleep 1
# #echo " 3..."
# #sleep 1
# #echo " 2..."
# sleep 1
# echo " 1..."
# sleep 1
#else
read -e -p "Please enter a world (name only--must be in $MT_WORLDS_DIR): " -i "$MT_MYWORLD_NAME" MT_MYWORLD_NAME
#$MT_DEFAULT_WORLD_NAME
echo using "$MT_MYWORLD_NAME"
@ -202,15 +222,19 @@ if [ -z "$MT_DEFAULT_WORLD_NAME" ]; then
sleep 1
echo " 1..."
sleep 1
fi
#fi
else
#NOTE: $0 doesn't work because gives actual command (such as `./filename.sh`--gives filename only if command was `bash filename.sh`)
#'[[' doesn't work in debian:
if [[ $0 == *"$shell_name"* ]]; then
REPO_PATH="$HOME/GitHub/EnlivenMinetest"
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:"
echo " $MT_MYWORLD_NAME"
else
#if [[ $0 == *"$shell_name"* ]]; then
#if [ "$shell_name" = "" ]; then echo "running normally (not pasted)"
#doesn't work on Fedora since shell_name is blank even when in shell and not pasting:
#if [ "$shell_name" != "" ]; then
# REPO_PATH="$HOME/GitHub/EnlivenMinetest"
# MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
# echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:"
# echo " $MT_MYWORLD_NAME"
#else
ls $MT_WORLDS_DIR
read -p "Please enter a world [blank for $MT_DEFAULT_WORLD_NAME]: " MT_MYWORLD_NAME
#$MT_DEFAULT_WORLD_NAME
@ -226,7 +250,7 @@ else
if [ -z "$MT_MYWORLD_NAME" ]; then
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
fi
fi
#fi
fi
if [ ! -d "$MT_WORLDS_DIR/$MT_MYWORLD_NAME" ]; then
echo " ERROR: failed to find world path, so cannot continue." > $err_txt

Loading…
Cancel
Save