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. 76
      minetestenv.rc

76
minetestenv.rc

@ -65,18 +65,36 @@ err_txt=$HOME/err-enliven.txt
#if [ "$0" = "-bash" ]; then #if [ "$0" = "-bash" ]; then
#'[[' doesn't work in debian #'[[' doesn't work in debian
show_changes="true" show_changes="true"
if [[ $0 == *"$shell_name"* ]]; then #[[ doesn't work in debian:
REPO_PATH="$HOME/GitHub/EnlivenMinetest" #if [[ $0 == *"$shell_name"* ]]; then
echo "You must have pasted this into terminal, so assuming REPO_PATH:" #doesn't work on Fedora since shell_name is blank even when in shell and not pasting:
echo " $REPO_PATH" #if [ "$shell_name" != "" ]; then
else #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") 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 # Absolute path this script is in, thus /home/user/bin
SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTPATH=$(dirname "$SCRIPT")
REPO_PATH="$SCRIPTPATH" REPO_PATH="$SCRIPTPATH"
#formerly, this script was in a subdir: #formerly, this script was in a subdir:
#REPO_PATH=$(dirname "$SCRIPTPATH") #REPO_PATH=$(dirname "$SCRIPTPATH")
fi #fi
PATCHES_PATH="$REPO_PATH/patches" PATCHES_PATH="$REPO_PATH/patches"
echo "PATCHES_PATH: $PATCHES_PATH" echo "PATCHES_PATH: $PATCHES_PATH"
@ -179,20 +197,22 @@ if [ -z "$MT_DEFAULT_WORLD_NAME" ]; then
fi fi
#if [ "$0" = "-bash" ]; then #if [ "$0" = "-bash" ]; then
#'[[' doesn't work in debian: #'[[' doesn't work in debian:
if [[ $0 == *"$shell_name"* ]]; then #if [[ $0 == *"$shell_name"* ]]; then
REPO_PATH="$HOME/GitHub/EnlivenMinetest" #doesn't work on Fedora since shell_name is blank even when in shell and not pasting:
MT_MYWORLD_NAME="world" #if [ "$shell_name" != "" ]; then
echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:" # REPO_PATH="$HOME/GitHub/EnlivenMinetest"
echo " $MT_MYWORLD_NAME" # MT_MYWORLD_NAME="world"
echo "Press Ctrl C to cancel, otherwise $MT_MYWORLD_NAME will be used..." # 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 # sleep 1
#echo " 3..." # echo " 1..."
# sleep 1 # sleep 1
#echo " 2..." #else
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 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 #$MT_DEFAULT_WORLD_NAME
echo using "$MT_MYWORLD_NAME" echo using "$MT_MYWORLD_NAME"
@ -202,15 +222,19 @@ if [ -z "$MT_DEFAULT_WORLD_NAME" ]; then
sleep 1 sleep 1
echo " 1..." echo " 1..."
sleep 1 sleep 1
fi #fi
else 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: #'[[' doesn't work in debian:
if [[ $0 == *"$shell_name"* ]]; then #if [[ $0 == *"$shell_name"* ]]; then
REPO_PATH="$HOME/GitHub/EnlivenMinetest" #if [ "$shell_name" = "" ]; then echo "running normally (not pasted)"
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME" #doesn't work on Fedora since shell_name is blank even when in shell and not pasting:
echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:" #if [ "$shell_name" != "" ]; then
echo " $MT_MYWORLD_NAME" # REPO_PATH="$HOME/GitHub/EnlivenMinetest"
else # 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 ls $MT_WORLDS_DIR
read -p "Please enter a world [blank for $MT_DEFAULT_WORLD_NAME]: " MT_MYWORLD_NAME read -p "Please enter a world [blank for $MT_DEFAULT_WORLD_NAME]: " MT_MYWORLD_NAME
#$MT_DEFAULT_WORLD_NAME #$MT_DEFAULT_WORLD_NAME
@ -226,7 +250,7 @@ else
if [ -z "$MT_MYWORLD_NAME" ]; then if [ -z "$MT_MYWORLD_NAME" ]; then
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME" MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
fi fi
fi #fi
fi fi
if [ ! -d "$MT_WORLDS_DIR/$MT_MYWORLD_NAME" ]; then if [ ! -d "$MT_WORLDS_DIR/$MT_MYWORLD_NAME" ]; then
echo " ERROR: failed to find world path, so cannot continue." > $err_txt echo " ERROR: failed to find world path, so cannot continue." > $err_txt

Loading…
Cancel
Save