Browse Source

Rename functions.

master
poikilos 5 years ago
parent
commit
cada3a8c50
  1. 12
      branch.sh
  2. 52
      build-MultiCraft.sh
  3. 8
      build-minetest-here.sh
  4. 4
      install-minetest.sh
  5. 5
      install-minimal.sh
  6. 6
      minetestmapper-deps.sh
  7. 18
      minetestmapper-web-install.sh
  8. 14
      patches/deprecated/merged-upstream/Bucket_Game/mods/codermobs/codermobs/install-to-HOME-Bucket_Game.sh
  9. 30
      patches/internal-prepatch.sh
  10. 42
      prepatch.sh
  11. 22
      reset-minetest-install-source.sh
  12. 20
      utilities/extra/install-ENLIVEN-minetest_game.sh
  13. 8
      utilities/extra/uninstall.sh
  14. 6
      utilities/generatemod.py
  15. 30
      versionize.sh

12
branch.sh

@ -4,11 +4,11 @@ exit 0
master=~/minetest/games/Bucket_Game
branches=~/git/1.pull-requests/Bucket_Game-branches
if [ ! -d "$branches" ]; then
mkdir -p "$branches" || customDie "Failed to mkdir -p '$branches'"
mkdir -p "$branches" || customExit "Failed to mkdir -p '$branches'"
echo "Created '$branches'"
fi
customDie() {
customExit() {
errcode=1
echo
echo "ERROR:"
@ -53,13 +53,13 @@ do
if [ "@$next" = "@branch" ]; then
# NOT -p on purpose--guarantee normal name (and no spaces)
branch="$var"
mkdir "$branches/$branch" || customDie "The new branch name must be valid directory name--can't create '$branches/$var'"
mkdir "$branches/$branch" || customExit "The new branch name must be valid directory name--can't create '$branches/$var'"
else
tryPath="$master/$var"
if [ -f "$tryPath" ]; then
partial=$var
else
customDie "File does not exist: '$tryPath'"
customExit "File does not exist: '$tryPath'"
fi
fi
next=
@ -68,12 +68,12 @@ done
if [ -z "$branch" ]; then
usage
customDie "You must specify a branch name"
customExit "You must specify a branch name"
fi
if [ -z "$partial" ]; then
usage
customDie "You must specify a file to fork"
customExit "You must specify a file to fork"
fi
masterFile="$master/$partial"

52
build-MultiCraft.sh

@ -6,7 +6,7 @@
me="$0"
RAN_FROM="`pwd`"
customDie() {
customExit() {
echo
echo
echo "$me ERROR:"
@ -44,7 +44,7 @@ END
usageDie() {
usage
customDie $1
customExit $1
}
dieIfOnline() {
@ -89,10 +89,10 @@ do
BUILD_WHAT="$var"
USE_WHAT=true
else
customDie "'$var' is not a directory."
customExit "'$var' is not a directory."
fi
else
customDie "$var is not a valid option."
customExit "$var is not a valid option."
fi
done
@ -115,12 +115,12 @@ srcRepo="`pwd`/$BUILD_WHAT"
if [ ! -d "$srcRepo" ]; then
srcRepo="$GIT_REPOS_DIR/$BUILD_WHAT"
if [ ! -d "$GIT_REPOS_DIR" ]; then
mkdir -p "$GIT_REPOS_DIR" || customDie echo "mkdir -p '$GIT_REPOS_DIR' FAILED."
mkdir -p "$GIT_REPOS_DIR" || customExit echo "mkdir -p '$GIT_REPOS_DIR' FAILED."
fi
fi
echo "* Using $srcRepo..."
if [ ! -d /tmp/MultiCraft ]; then
mkdir /tmp/MultiCraft || customDie echo "mkdir -p '/tmp/MultiCraft' FAILED."
mkdir /tmp/MultiCraft || customExit echo "mkdir -p '/tmp/MultiCraft' FAILED."
fi
artifactsPath=/tmp/MultiCraft/src.txt
cat > $artifactsPath <<END
@ -174,9 +174,9 @@ if [ "@$UNINSTALL" = "@true" ]; then
echo
prevDir="`pwd`"
echo "Uninstalling $DESTINATION..."
cd "$DESTINATION" || customDie echo "cd $DESTINATION FAILED."
cd "$DESTINATION" || customExit echo "cd $DESTINATION FAILED."
if [ ! -d /tmp/MultiCraft ]; then
mkdir /tmp/MultiCraft || customDie echo "mkdir -p '/tmp/MultiCraft' FAILED."
mkdir /tmp/MultiCraft || customExit echo "mkdir -p '/tmp/MultiCraft' FAILED."
fi
manifestPath=/tmp/MultiCraft/manifest.txt
cat > $manifestPath <<END
@ -1780,7 +1780,7 @@ bin
po
END
if [ -z "$DESTINATION" ]; then
customDie "DESTINATION is blank."
customExit "DESTINATION is blank."
fi
while read p; do
if [ -f "$DESTINATION/$p" ]; then
@ -1803,16 +1803,16 @@ fi
if [ "@$INSTALL" = "@true" ]; then
echo "* installing from '$srcRepo' to '$DESTINATION'..."
if [ ! -f "`command -v rsync`" ]; then
customDie "You must first install rsync to use the install option."
customExit "You must first install rsync to use the install option."
fi
if [ ! -d "$DESTINATION" ]; then
mkdir -p "$DESTINATION" || customDie "mkdir -p '$DESTINATION' FAILED."
mkdir -p "$DESTINATION" || customExit "mkdir -p '$DESTINATION' FAILED."
fi
if [ -f "$DESTINATION/multicraft.conf" ]; then
echo " - The existing multicraft.conf will not be overwritten."
rsync -rt --info=progress2 --exclude-from "$artifactsPath" --exclude 'multicraft.conf' "$srcRepo/" "$DESTINATION" || customDie "rsync failed."
rsync -rt --info=progress2 --exclude-from "$artifactsPath" --exclude 'multicraft.conf' "$srcRepo/" "$DESTINATION" || customExit "rsync failed."
else
rsync -rt --info=progress2 --exclude-from "$artifactsPath" "$srcRepo/" "$DESTINATION" || customDie "rsync failed."
rsync -rt --info=progress2 --exclude-from "$artifactsPath" "$srcRepo/" "$DESTINATION" || customExit "rsync failed."
fi
rm $artifactsPath
rmdir --ignore-fail-on-non-empty /tmp/MultiCraft
@ -1825,10 +1825,10 @@ if [ "@$INSTALL" = "@true" ]; then
fi
if [ ! -f "$dstExe" ]; then
customDie "Install did not result in '$dstExe'."
customExit "Install did not result in '$dstExe'."
fi
if [ ! -d "$dstShortcuts" ]; then
mkdir -p "$dstShortcuts" || customDie echo "mkdir -p '$dstShortcuts' FAILED."
mkdir -p "$dstShortcuts" || customExit echo "mkdir -p '$dstShortcuts' FAILED."
fi
cat > $dstShortcut <<END
[Desktop Entry]
@ -1861,7 +1861,7 @@ END
if [ $? -eq 0 ]; then
echo "* Created $dstShortcut."
else
customDie "Creating $dstShortcut FAILED."
customExit "Creating $dstShortcut FAILED."
fi
echo
echo
@ -1882,25 +1882,25 @@ fi
fi
if [ ! -d "$srcRepo" ]; then
cd "$GIT_REPOS_DIR" || customDie "cd '$GIT_REPOS_DIR' FAILED"
cd "$GIT_REPOS_DIR" || customExit "cd '$GIT_REPOS_DIR' FAILED"
fi
goodFlagFile=MultiCraft/CMakeLists.txt
if [ -f "`command -v git`" ]; then
echo "In `pwd`..."
if [ ! -d "$BUILD_WHAT" ]; then
if [ "@$OFFLINE" = "@false" ]; then
git clone https://github.com/MultiCraft/MultiCraft.git || customDie "Cannot clone MultiCraft from `pwd`"
git clone https://github.com/MultiCraft/MultiCraft.git || customExit "Cannot clone MultiCraft from `pwd`"
fi
cd "$BUILD_WHAT" || customDie "Cannot cd '$BUILD_WHAT' from `pwd`"
cd "$BUILD_WHAT" || customExit "Cannot cd '$BUILD_WHAT' from `pwd`"
else
cd "$BUILD_WHAT" || customDie "Cannot cd '$BUILD_WHAT' from `pwd`"
cd "$BUILD_WHAT" || customExit "Cannot cd '$BUILD_WHAT' from `pwd`"
if [ "@$OFFLINE" = "@false" ]; then
git pull || dieIfOnline "WARNING: Cannot pull '$BUILD_WHAT' from `pwd`"
fi
fi
else
if [ ! -f "$goodFlagFile" ]; then
customDie "You are missing git, and offline install is not possible without in current directory (`pwd`)"
customExit "You are missing git, and offline install is not possible without in current directory (`pwd`)"
else
cd "$BUILD_WHAT" || usageDie "Cannot cd '$BUILD_WHAT' from `pwd`"
fi
@ -1909,7 +1909,7 @@ cd games || usageDie "cd games FAILED in `pwd`"
rmdir --ignore-fail-on-non-empty default
if [ ! -d "default" ]; then
if [ "@$OFFLINE" = "@false" ]; then
git clone https://github.com/MultiCraft/MultiCraft_game default || customDie "git clone https://github.com/MultiCraft/MultiCraft_game FAILED"
git clone https://github.com/MultiCraft/MultiCraft_game default || customExit "git clone https://github.com/MultiCraft/MultiCraft_game FAILED"
else
echo
echo
@ -1921,9 +1921,9 @@ if [ ! -d "default" ]; then
fi
else
if [ "@$OFFLINE" = "@false" ]; then
cd default || customDie "cd default FAILED in `pwd`"
git pull || customDie "git pull FAILED in `pwd`"
cd .. || customDie "cd .. FAILED in `pwd`"
cd default || customExit "cd default FAILED in `pwd`"
git pull || customExit "git pull FAILED in `pwd`"
cd .. || customExit "cd .. FAILED in `pwd`"
fi
fi
cd .. || usageDie "cd .. FAILED in `pwd`"
@ -1936,7 +1936,7 @@ echo "Running cmake srcPath..."
cmake $srcPath $flag1 -G"CodeBlocks - Unix Makefiles" -DRUN_IN_PLACE=1 -DENABLE_GETTEXT=1 -DENABLE_FREETYPE=1 -DENABLE_LEVELDB=1 || usageDie "cmake failed in `pwd`. See any messages above for more information. Run ./install-minetest-build-deps.sh if you did not."
echo
echo "Running make..."
make -j$(nproc) || customDie "make failed. See any messages above for more information. Run ./install-minetest-build-deps.sh if you did not."
make -j$(nproc) || customExit "make failed. See any messages above for more information. Run ./install-minetest-build-deps.sh if you did not."
if [ -f "`pwd`/bin/MultiCraft" ]; then
echo "`pwd`/bin/MultiCraft"
else

8
build-minetest-here.sh

@ -1,5 +1,5 @@
#!/bin/bash
customDie(){
customExit(){
echo "$1"
exit 1
}
@ -8,14 +8,14 @@ if [ ! -d $mybuild ]; then
# mkdir $mybuild
echo
fi
# cd $mybuild || customDie "$0: cd build failed in '`pwd`'."
# cd $mybuild || customExit "$0: cd build failed in '`pwd`'."
if [ -f bin/minetest ]; then
make clean || customDie "$0: make clean failed in '`pwd`'."
make clean || customExit "$0: make clean failed in '`pwd`'."
fi
if [ -z "$RUN_IN_PLACE" ]; then
RUN_IN_PLACE=0
fi
cmake . -DENABLE_GETTEXT=1 -DENABLE_FREETYPE=1 -DENABLE_LEVELDB=1 -DENABLE_REDIS=1 -DRUN_IN_PLACE=$RUN_IN_PLACE && make -j$(grep -c processor /proc/cpuinfo) || customDie "$0: Build failed in '`pwd`'."
cmake . -DENABLE_GETTEXT=1 -DENABLE_FREETYPE=1 -DENABLE_LEVELDB=1 -DENABLE_REDIS=1 -DRUN_IN_PLACE=$RUN_IN_PLACE && make -j$(grep -c processor /proc/cpuinfo) || customExit "$0: Build failed in '`pwd`'."
echo
if [ "@$RUN_IN_PLACE" = "@1" ]; then
echo "WARNING: do not do make install with -DRUN_IN_PLACE=$RUN_IN_PLACE!"

4
install-minetest.sh

@ -2,7 +2,7 @@
# The git repo ONLY includes the core engine: http://localhost:3000/minetest/minetest.git
# The build kit should be used, & has "patched Irrlicht, the new LuaJit, built-in LevelDB and Snappy support, Bucket Game, Bucket City, Wonder World, the schems collection, and other pieces"
customDie() {
customExit() {
echo
echo "ERROR:"
echo "$1"
@ -10,7 +10,7 @@ customDie() {
echo
}
cd webapp || customDie "You must run this script from the directory containing the webapp directory."
cd webapp || customExit "You must run this script from the directory containing the webapp directory."
if [ ! -d linux-minetest-kit ]; then
bash reset-minetest-install-source.sh
fi

5
install-minimal.sh

@ -25,8 +25,6 @@ countDown(){
echo "This will DELETE ~/minetest/games/minimal and remake it!"
countDown
#> You'll need minimum git 1.9 for this to work. Tested it myself only with 2.2.0 and 2.2.2.
#-<https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934>
REPO_URL=https://github.com/minetest/minetest
# REPO_URL=http://git.minetest.org:3000/minetest/minetest.git
DEST_REPO=~/Downloads/git/minetest_minimal
@ -40,6 +38,9 @@ if [ -e $DEST_GAMES/minimal ]; then
fi
if [ ! -d "$DEST_REPO" ]; then
# "You'll need minimum git 1.9 for this to work. Tested it myself
# only with 2.2.0 and 2.2.2."
# -<https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934>
mkdir -p ~/Downloads/git \
&& git init "$DEST_REPO" \
&& cd "$DEST_REPO" \

6
minetestmapper-deps.sh

@ -1,6 +1,6 @@
#!/bin/bash
customDie() {
customExit() {
echo
echo
echo "ERROR:"
@ -27,12 +27,12 @@ elif [ -f "`command -v yum`" ]; then
INSTALL_CMD="yum -y install"
PACKAGE_TYPE="rpm"
else
customDie "Your package system is not implemented in this script."
customExit "Your package system is not implemented in this script."
fi
if [ "@$PACKAGE_TYPE" = "@deb" ]; then
sudo $INSTALL_CMD libgd-dev libsqlite3-dev libleveldb-dev libhiredis-dev libpq-dev
elif [ "@$PACKAGE_TYPE" = "@rpm" ]; then
sudo $INSTALL_CMD gd-devel sqlite-devel leveldb-devel hiredis-devel libpq-devel
else
customDie "The package names for your OS are unknown."
customExit "The package names for your OS are unknown."
fi

18
minetestmapper-web-install.sh

@ -1,6 +1,6 @@
#!/bin/bash
customDie() {
customExit() {
echo
echo
echo "ERROR:"
@ -24,19 +24,19 @@ mkdir -p $REPOS_PATH
REPO_PATH="$REPOS_PATH/$_REPO_NAME"
if [ ! -d "$REPOS_PATH" ]; then
mkdir -p "$REPOS_PATH" || customDie "mkdir -p \"$REPOS_PATH\" failed."
mkdir -p "$REPOS_PATH" || customExit "mkdir -p \"$REPOS_PATH\" failed."
fi
cd "$REPOS_PATH" || customDie "cd \"$REPOS_PATH\" failed."
cd "$REPOS_PATH" || customExit "cd \"$REPOS_PATH\" failed."
if [ -d "$REPO_PATH" ]; then
cd "$REPO_PATH" || customDie "cd \"$REPO_PATH\" failed."
git pull || customDie "git pull failed in `pwd`."
cd "$REPO_PATH" || customExit "cd \"$REPO_PATH\" failed."
git pull || customExit "git pull failed in `pwd`."
else
git clone "$_REPO_URL" "$REPO_PATH" || customDie "git clone \"$_REPO_URL\" \"$REPO_PATH\" failed."
git clone "$_REPO_URL" "$REPO_PATH" || customExit "git clone \"$_REPO_URL\" \"$REPO_PATH\" failed."
fi
echo "* compiling in `pwd`..."
cmake . -DENABLE_LEVELDB=1 -DENABLE_POSTGRES=1 -DENABLE_REDIS=1 || customDie "cmake . failed in `pwd`."
make -j$(nproc) || customDie "make failed in `pwd`."
cmake . -DENABLE_LEVELDB=1 -DENABLE_POSTGRES=1 -DENABLE_REDIS=1 || customExit "cmake . failed in `pwd`."
make -j$(nproc) || customExit "make failed in `pwd`."
_EXE_PATH="`pwd`/$_EXE_NAME"
if [ -f "$_EXE_PATH" ]; then
echo "* finished compiling \"$_EXE_PATH\""
@ -48,7 +48,7 @@ if [ -f "$_EXE_PATH" ]; then
if [ -f "$EXE_DEST_PATH" ]; then
echo "* installed \"$EXE_DEST_PATH\""
else
customDie "* installing \"$EXE_DEST_PATH\" failed."
customExit "* installing \"$EXE_DEST_PATH\" failed."
fi
else
echo "* finished compiling in `pwd` (but $_EXE_PATH was not detected)"

14
patches/deprecated/merged-upstream/Bucket_Game/mods/codermobs/codermobs/install-to-HOME-Bucket_Game.sh

@ -2,7 +2,7 @@
echo
echo
customDie() {
customExit() {
echo
echo "ERROR:"
echo "$1"
@ -11,13 +11,13 @@ customDie() {
}
if [ ! -f deer.lua ]; then
customDie "No deer.lua, so can't patch."
customExit "No deer.lua, so can't patch."
fi
my_bucket_game=$HOME/minetest/games/Bucket_Game
my_codermobs_codermobs=$my_bucket_game/mods/codermobs/codermobs
my_codermobs_init=$my_codermobs_codermobs/init.lua
if [ ! -f "$my_codermobs_init" ]; then
customDie "$my_codermobs_init does not exist."
customExit "$my_codermobs_init does not exist."
fi
echo "* patching $my_codermobs_init..."
if [ -z "`cat $my_codermobs_init | grep deer.lua`" ]; then
@ -27,14 +27,14 @@ else
fi
if [ -f "$my_codermobs_codermobs/deer.lua" ]; then
echo "* removing old $my_codermobs_codermobs/deer.lua..."
rm $my_codermobs_codermobs/deer.lua || customDie "Cannot remove old $my_codermobs_codermobs/deer.lua"
rm $my_codermobs_codermobs/deer.lua || customExit "Cannot remove old $my_codermobs_codermobs/deer.lua"
fi
echo "* copying to $my_codermobs_codermobs/deer.lua..."
cp deer.lua "$my_codermobs_codermobs/" || customDie "Cannot copy to $my_codermobs_codermobs/deer.lua"
cp deer.lua "$my_codermobs_codermobs/" || customExit "Cannot copy to $my_codermobs_codermobs/deer.lua"
echo "* copying over $my_codermobs_codermobs/textures/..."
cp textures/* "$my_codermobs_codermobs/textures/" || customDie "Cannot copy to $my_codermobs_codermobs/textures/"
cp textures/* "$my_codermobs_codermobs/textures/" || customExit "Cannot copy to $my_codermobs_codermobs/textures/"
echo "* copying over $my_codermobs_codermobs/models/..."
cp models/* "$my_codermobs_codermobs/models/" || customDie "Cannot copy to $my_codermobs_codermobs/textures/"
cp models/* "$my_codermobs_codermobs/models/" || customExit "Cannot copy to $my_codermobs_codermobs/textures/"
echo "Done."
echo
echo

30
patches/internal-prepatch.sh

@ -2,7 +2,7 @@
# such as meld /home/owner/minetest/games/ENLIVEN/ /home/owner/git/EnlivenMinetest/patches/Bucket_Game-patched/
me=`basename "$0"`
customDie() {
customExit() {
echo
if [ -z "$1" ]; then
echo "Unknown error."
@ -23,7 +23,7 @@ patches="$HOME/git/EnlivenMinetest/patches"
project1_path="$patches/$project1"
project2_path="$patches/$project2"
if [ ! -d "$patches" ]; then
customDie "You are missing $patches so a patch basis and patched target cannot be created there."
customExit "You are missing $patches so a patch basis and patched target cannot be created there."
fi
licenses="license.txt LICENSE LICENSE.txt oldcoder.txt LICENSE.md license.md"
usage() {
@ -79,30 +79,30 @@ dir2_pp="$(dirname -- "$dir2_p")"
#echo "* checking $dir2_pp..."
if [ ! -d "$project0_path" ]; then
customDie "ERROR: You must have '$project0' installed as '$project0_path'"
customExit "ERROR: You must have '$project0' installed as '$project0_path'"
fi
if [ ! -f "$file0_path" ]; then
customDie "ERROR: Missing '$file0_path')"
customExit "ERROR: Missing '$file0_path')"
fi
if [ ! -d "$dir1" ]; then
mkdir -p "$dir1" || customDie "Cannot mkdir $dir1"
mkdir -p "$dir1" || customExit "Cannot mkdir $dir1"
fi
if [ ! -d "$dir2" ]; then
mkdir -p "$dir2" || customDie "Cannot mkdir $dir2"
mkdir -p "$dir2" || customExit "Cannot mkdir $dir2"
fi
# if file1 exists, overwriting is ok--update basis so diff will make patch correctly
echo "* updating $file1_path"
cp -f "$file0_path" "$file1_path" || customDie "Cannot cp '$file0_path' '$file1_path'"
cp -f "$file0_path" "$file1_path" || customExit "Cannot cp '$file0_path' '$file1_path'"
if [ -f "$file2_path" ]; then
customDie "Nothing done since '$file2_path' already exists."
customExit "Nothing done since '$file2_path' already exists."
fi
echo "* creating $file2_path"
cp -f "$file0_path" "$file2_path" || customDie "Cannot cp '$file0_path' '$file2_path'"
cp -f "$file0_path" "$file2_path" || customExit "Cannot cp '$file0_path' '$file2_path'"
if [ -f "`command -v geany`" ]; then
nohup geany "$file2_path" &
fi
@ -119,10 +119,10 @@ for license in "${arr[@]}"; do
lic2="$dir2/$license"
if [ -f "$lic0" ]; then
echo "* updating LICENSE '$lic1'..."
cp -f "$lic0" "$lic1" || customDie "Cannot cp -f '$lic0' '$lic1'"
cp -f "$lic0" "$lic1" || customExit "Cannot cp -f '$lic0' '$lic1'"
if [ ! -f "$lic2" ]; then
echo " - also for $project2..."
cp --no-clobber "$lic0" "$lic2" || customDie "Cannot cp -f '$lic0' '$lic2'"
cp --no-clobber "$lic0" "$lic2" || customExit "Cannot cp -f '$lic0' '$lic2'"
fi
fi
lic0="$dir0_p/$license"
@ -130,10 +130,10 @@ for license in "${arr[@]}"; do
lic2="$dir2_p/$license"
if [ -f "$lic0" ]; then
echo "* updating LICENSE '$lic1'..."
cp -f "$lic0" "$lic1" || customDie "Cannot cp -f '$lic0' '$lic1'"
cp -f "$lic0" "$lic1" || customExit "Cannot cp -f '$lic0' '$lic1'"
if [ ! -f "$lic2" ]; then
echo " - also for $project2..."
cp --no-clobber "$lic0" "$lic2" || customDie "Cannot cp -f '$lic0' '$lic2'"
cp --no-clobber "$lic0" "$lic2" || customExit "Cannot cp -f '$lic0' '$lic2'"
fi
fi
lic0="$dir0_pp/$license"
@ -141,10 +141,10 @@ for license in "${arr[@]}"; do
lic2="$dir2_pp/$license"
if [ -f "$lic0" ]; then
echo "* updating '$lic1'..."
cp -f "$lic0" "$lic1" || customDie "Cannot cp -f '$lic0' '$lic1'"
cp -f "$lic0" "$lic1" || customExit "Cannot cp -f '$lic0' '$lic1'"
if [ ! -f "$lic2" ]; then
echo " - also for $project2..."
cp --no-clobber "$lic0" "$lic2" || customDie "Cannot cp -f '$lic0' '$lic2'"
cp --no-clobber "$lic0" "$lic2" || customExit "Cannot cp -f '$lic0' '$lic2'"
fi
fi
done

42
prepatch.sh

@ -6,7 +6,7 @@ me=`basename "$0"`
# expected)
# --install Install the specified patch.
customDie() {
customExit() {
echo
if [ -z "$1" ]; then
echo "Unknown error."
@ -66,7 +66,7 @@ project2_path="$repo/$project2/$branch"
if [ "@$enable_meld" = "@true" ]; then
echo "meld..."
if [ -z "$branch" ]; then
customDie "You must specify a branch name after --meld."
customExit "You must specify a branch name after --meld."
fi
subgame=
patch_game_src=
@ -76,7 +76,7 @@ if [ "@$enable_meld" = "@true" ]; then
if [ -d "$project2_path/mods" ]; then
patch_game_src="$project2_path"
else
customDie "Cannot detect mods directory in $project2_path/mods"
customExit "Cannot detect mods directory in $project2_path/mods"
fi
#below (commented part) should only happen if $project2_path already has been edited (diverged from $project1_path)
#echo "meld $patch_game_src/ $HOME/minetest/games/ENLIVEN..."
@ -98,7 +98,7 @@ if [ "@$enable_meld" = "@true" ]; then
echo "* install nohup to prevent programs from dumping output to console..."
fi
else
customDie "You do not have meld installed."
customExit "You do not have meld installed."
fi
else
echo "meld '$HOME/minetest/games/ENLIVEN' '$patch_game_src'..."
@ -110,7 +110,7 @@ if [ "@$enable_meld" = "@true" ]; then
echo "* install nohup to prevent programs from dumping output to console..."
fi
else
customDie "You do not have meld installed."
customExit "You do not have meld installed."
fi
fi
echo
@ -118,7 +118,7 @@ if [ "@$enable_meld" = "@true" ]; then
exit 0
elif [ "@$enable_install" = "@true" ]; then
if [ -z "$branch" ]; then
customDie "You must specify a branch name after --install."
customExit "You must specify a branch name after --install."
fi
echo "* installing $branch branch..."
subgame=
@ -127,7 +127,7 @@ elif [ "@$enable_install" = "@true" ]; then
elif [ -d "$project2_path/patched/mods" ]; then
patch_game_src="$project2_path/patched"
else
customDie "Cannot detect mods directory in $project2_path/mods"
customExit "Cannot detect mods directory in $project2_path/mods"
fi
echo "rsync -rt $patch_game_src/ $HOME/minetest/games/ENLIVEN..."
rsync -rt "$patch_game_src/" "$HOME/minetest/games/ENLIVEN"
@ -139,7 +139,7 @@ elif [ "@$enable_install" = "@true" ]; then
exit 0
fi
if [ ! -d "$patches" ]; then
customDie "You are missing $patches so a patch basis and patched target cannot be created there."
customExit "You are missing $patches so a patch basis and patched target cannot be created there."
fi
licenses="license.txt LICENSE LICENSE.txt oldcoder.txt LICENSE.md license.md"
usage() {
@ -199,30 +199,30 @@ dir2_pp="$(dirname -- "$dir2_p")"
#echo "* checking $dir2_pp..."
if [ ! -d "$project0_path" ]; then
customDie "ERROR: You must have '$project0' installed as '$project0_path'"
customExit "ERROR: You must have '$project0' installed as '$project0_path'"
fi
if [ ! -f "$file0_path" ]; then
customDie "ERROR: Missing '$file0_path')"
customExit "ERROR: Missing '$file0_path')"
fi
if [ ! -d "$dir1" ]; then
mkdir -p "$dir1" || customDie "Cannot mkdir $dir1"
mkdir -p "$dir1" || customExit "Cannot mkdir $dir1"
fi
if [ ! -d "$dir2" ]; then
mkdir -p "$dir2" || customDie "Cannot mkdir $dir2"
mkdir -p "$dir2" || customExit "Cannot mkdir $dir2"
fi
# if file1 exists, overwriting is ok--update basis so diff will make patch correctly
echo "* updating $file1_path"
cp -f "$file0_path" "$file1_path" || customDie "Cannot cp '$file0_path' '$file1_path'"
cp -f "$file0_path" "$file1_path" || customExit "Cannot cp '$file0_path' '$file1_path'"
if [ -f "$file2_path" ]; then
customDie "Nothing done since '$file2_path' already exists."
customExit "Nothing done since '$file2_path' already exists."
fi
echo "* creating $file2_path"
cp -f "$file0_path" "$file2_path" || customDie "Cannot cp '$file0_path' '$file2_path'"
cp -f "$file0_path" "$file2_path" || customExit "Cannot cp '$file0_path' '$file2_path'"
if [ -f "`command -v zbstudio`" ]; then
nohup zbstudio "$file2_path" &
else
@ -243,10 +243,10 @@ for license in "${arr[@]}"; do
lic2="$dir2/$license"
if [ -f "$lic0" ]; then
echo "* updating LICENSE '$lic1'..."
cp -f "$lic0" "$lic1" || customDie "Cannot cp -f '$lic0' '$lic1'"
cp -f "$lic0" "$lic1" || customExit "Cannot cp -f '$lic0' '$lic1'"
if [ ! -f "$lic2" ]; then
echo " - also for $project2..."
cp --no-clobber "$lic0" "$lic2" || customDie "Cannot cp -f '$lic0' '$lic2'"
cp --no-clobber "$lic0" "$lic2" || customExit "Cannot cp -f '$lic0' '$lic2'"
fi
fi
lic0="$dir0_p/$license"
@ -254,10 +254,10 @@ for license in "${arr[@]}"; do
lic2="$dir2_p/$license"
if [ -f "$lic0" ]; then
echo "* updating LICENSE '$lic1'..."
cp -f "$lic0" "$lic1" || customDie "Cannot cp -f '$lic0' '$lic1'"
cp -f "$lic0" "$lic1" || customExit "Cannot cp -f '$lic0' '$lic1'"
if [ ! -f "$lic2" ]; then
echo " - also for $project2..."
cp --no-clobber "$lic0" "$lic2" || customDie "Cannot cp -f '$lic0' '$lic2'"
cp --no-clobber "$lic0" "$lic2" || customExit "Cannot cp -f '$lic0' '$lic2'"
fi
fi
lic0="$dir0_pp/$license"
@ -265,10 +265,10 @@ for license in "${arr[@]}"; do
lic2="$dir2_pp/$license"
if [ -f "$lic0" ]; then
echo "* updating '$lic1'..."
cp -f "$lic0" "$lic1" || customDie "Cannot cp -f '$lic0' '$lic1'"
cp -f "$lic0" "$lic1" || customExit "Cannot cp -f '$lic0' '$lic1'"
if [ ! -f "$lic2" ]; then
echo " - also for $project2..."
cp --no-clobber "$lic0" "$lic2" || customDie "Cannot cp -f '$lic0' '$lic2'"
cp --no-clobber "$lic0" "$lic2" || customExit "Cannot cp -f '$lic0' '$lic2'"
fi
fi
done

22
reset-minetest-install-source.sh

@ -46,7 +46,7 @@ END
sleep 1
}
customDie () {
customExit () {
echo "ERROR: Cannot continue since"
echo "$1"
exit 1
@ -57,7 +57,7 @@ available_release_line=`curl http://downloads.minetest.org/release.txt | head -n
available_version=$(echo $available_release_line | awk '{print $2}')
# OR: available_version="${available_release_line##* }" # get second word
if [ ${#available_version} -ne 6 ]; then
customDie "The available version is not recognized: $available_version"
customExit "The available version is not recognized: $available_version"
fi
installed_release_line=`head -n 1 ~/minetest/release.txt`
installed_version=$(echo $installed_release_line | awk '{print $2}')
@ -81,10 +81,10 @@ do
if [ "@$var" = "@--offline" ]; then
enable_offline=true
else
customDie "Invalid argument: $var"
customExit "Invalid argument: $var"
fi
done
cd "$EM_CONFIG_PATH" || customDie "[$MY_NAME] cd \"$EM_CONFIG_PATH\" failed."
cd "$EM_CONFIG_PATH" || customExit "[$MY_NAME] cd \"$EM_CONFIG_PATH\" failed."
if [ -d "$extracted_path" ]; then
# NOTE: ls -lR provides a count, so it is not suitable unless output
# is parsed. `| wc -l` is easier (word count).
@ -93,26 +93,26 @@ if [ -d "$extracted_path" ]; then
screenshot_count=`ls $extracted_path/screenshots/*.png | wc -l`
fi
if [ $screenshot_count -gt 0 ]; then
mv $extracted_path/screenshots/*.png ~/ || customDie "can't move screenshots from $extracted_path/screenshots/*.png"
mv $extracted_path/screenshots/*.png ~/ || customExit "can't move screenshots from $extracted_path/screenshots/*.png"
rmdir --ignore-fail-on-non-empty "$extracted_path/screenshots"
fi
if [ `ls $extracted_path/minetest/bin/*.png | wc -l` -gt 0 ]; then
# if [ ! -d screenshots ]; then mkdir screenshots; fi
# NOTE: system-wide install of minetest puts screenshots in ~/ (cwd)
mv $extracted_path/minetest/bin/*.png ~/ || customDie "can't move screenshots from $extracted_path/minetest/bin/*.png"
mv $extracted_path/minetest/bin/*.png ~/ || customExit "can't move screenshots from $extracted_path/minetest/bin/*.png"
fi
rm -Rf "$extracted_path" || customDie "can't remove $extracted_name"
rm -Rf "$extracted_path" || customExit "can't remove $extracted_name"
fi
if [ "@$enable_offline" = "@true" ]; then
if [ ! -f "$zip_name" ]; then
customDie "* Offline install is impossible without '`pwd`/$zip_name'."
customExit "* Offline install is impossible without '`pwd`/$zip_name'."
fi
else
wget -O "$EM_CONFIG_PATH/$zip_name" $url/$zip_name || customDie "no $zip_name at $url"
wget -O "$EM_CONFIG_PATH/$zip_name" $url/$zip_name || customExit "no $zip_name at $url"
fi
unzip -u $zip_name || customDie "Can't unzip $zip_name"
cd "$extracted_name" || customDie "Unzipping \"$zip_name\" in \"`pwd`\" did not result in a readable directory named \"$extracted_name\" there."
unzip -u $zip_name || customExit "Can't unzip $zip_name"
cd "$extracted_name" || customExit "Unzipping \"$zip_name\" in \"`pwd`\" did not result in a readable directory named \"$extracted_name\" there."
cat "$extracted_path/release.txt"
echo "compiling libraries..."
date

20
utilities/extra/install-ENLIVEN-minetest_game.sh

@ -49,7 +49,7 @@ if [ ! -f minetestenv.rc ]; then
fi
EnlivenMinetest_dir="`pwd`"
if [ ! -f minetestenv.rc ]; then
# NOTE: customDie is not defined until after this clause.
# NOTE: customExit is not defined until after this clause.
echo "ERROR: Nothing done since missing minetestenv.rc (must be in same directory or '$HOME/git/EnlivenMinetest' or '`pwd`')."
echo "This session will exit unless you press Ctrl-C to cancel script..."
sleep 1
@ -137,7 +137,7 @@ BUILD_DATE=`date '+%Y-%m-%d'`
# BACKUP world.mt:
if [ ! -d "$MT_MYGAME_DIR" ]; then
mkdir "$MT_MYGAME_DIR" || customDie "$USER cannot mkdir '$MT_MYGAME_DIR' (make sure the directory containing it exists)"
mkdir "$MT_MYGAME_DIR" || customExit "$USER cannot mkdir '$MT_MYGAME_DIR' (make sure the directory containing it exists)"
show_changes="false"
# else
# # workaround bug in earlier version of installer
@ -226,7 +226,7 @@ fi
#sudo mkdir "$MT_MYGAME_DIR"
#sudo mkdir "$MT_MYGAME_MODS_PATH"
if [ ! -d "$MT_MYGAME_DIR/" ]; then
customDie "ERROR: failed to create $MT_MYGAME_DIR, so cannot continue."
customExit "ERROR: failed to create $MT_MYGAME_DIR, so cannot continue."
fi
#sudo cp -R $USR_SHARE_MINETEST/games/$mtgame_name/mods/* "$MT_MYGAME_DIR/mods/"
echo "Copying $MT_MINETEST_GAME_PATH to $MT_MYGAME_DIR"
@ -393,10 +393,10 @@ if [ "$enable_spawners" = "true" ]; then
echo "removing $MTMOD_DEST_NAME..."
rm -Rf "$MTMOD_DEST_PATH"
else
customDie "ERROR: could not find $MTMOD_DEST_PATH for removal, so cancelling ENLIVEN install"
customExit "ERROR: could not find $MTMOD_DEST_PATH for removal, so cancelling ENLIVEN install"
fi
if [ -d "$MTMOD_DEST_PATH" ]; then
customDie "ERROR: could not remove $MTMOD_DEST_PATH for removal, so cancelling ENLIVEN install"
customExit "ERROR: could not remove $MTMOD_DEST_PATH for removal, so cancelling ENLIVEN install"
fi
#defaults are:
@ -557,7 +557,7 @@ add_git_mod lapis LapisLazuli https://github.com/Napiophelios/LapisLazuli.git
# echo "WARNING: not enabling columns in $MTMOD_DEST_PATH/init.lua since already patched as indicated by the presence of '$MTMOD_DEST_PATH/columns_enabled' flag file."
# fi
#else
# customDie "FAILED to patch lapis since no $MTMOD_DEST_PATH/init.lua"
# customExit "FAILED to patch lapis since no $MTMOD_DEST_PATH/init.lua"
#fi
echo "not installing helicopter--crashes 0.4.14-git, but was updated on 2017-06-08 and was not tested since then"
@ -708,7 +708,7 @@ else
if [ -d "$MT_MYGAME_MODS_PATH/farming" ]; then
echo " [ + ] reinstalled minetest_game farming."
else
customDie "ERROR: failed to install $USR_SHARE_MINETEST/games/$mtgame_name/mods/farming to $MT_MYGAME_MODS_PATH/farming, so cannot continue."
customExit "ERROR: failed to install $USR_SHARE_MINETEST/games/$mtgame_name/mods/farming to $MT_MYGAME_MODS_PATH/farming, so cannot continue."
fi
add_git_mod crops crops https://github.com/minetest-mods/crops
fi
@ -894,7 +894,7 @@ if [ -d "$PATCHES_PATH" ]; then
fi
cp -f $PATCHES_PATH/deprecated/mods-multiplayer-minetest_game/$PATCH_SKINS_MOD_NAME/$SUB_NAME/* "$SUB_PATH"
if [ ! -d "$SUB_PATH" ]; then
customDie "ERROR: failed to install poikilos's skins to $SUB_PATH, so cannot continue."
customExit "ERROR: failed to install poikilos's skins to $SUB_PATH, so cannot continue."
else
echo "installed poikilos's skins to $SUB_PATH"
fi
@ -906,7 +906,7 @@ if [ -d "$PATCHES_PATH" ]; then
fi
cp -f $PATCHES_PATH/deprecated/mods-multiplayer-minetest_game/$PATCH_SKINS_MOD_NAME/$SUB_NAME/* "$SUB_PATH"
if [ ! -d "$SUB_PATH" ]; then
customDie "ERROR: failed to install poikilos's skins to $SUB_PATH, so cannot continue."
customExit "ERROR: failed to install poikilos's skins to $SUB_PATH, so cannot continue."
else
echo "installed metadata for poikilos's skins to $SUB_PATH"
fi
@ -981,7 +981,7 @@ if [ -d "$PATCHES_PATH" ]; then
echo "# cp -Rf $PATCHES_PATH/mods-stopgap-minetest_game/* $MT_MYGAME_MODS_PATH/"
#echo "rm -Rf $MT_MYGAME_MODS_PATH/1.nonworking # leftovers from deprecated ENLIVEN installer"
else
customDie "did not find $PATCHES_PATH"
customExit "did not find $PATCHES_PATH"
fi
echo
if [ "$enable_version_0_5" != "true" ]; then

8
utilities/extra/uninstall.sh

@ -1,7 +1,7 @@
#!/bin/sh
extracted_path=$HOME/Downloads/minetest
mnf_name=install_manifest.txt
customDie() {
customExit() {
echo
echo "ERROR:"
echo "$1"
@ -10,14 +10,14 @@ customDie() {
exit 1
}
if [ ! -f "$extracted_path/$mnf_name" ]; then
customDie "$extracted_path/$mnf_name is missing, so $0 cannot continue."
customExit "$extracted_path/$mnf_name is missing, so $0 cannot continue."
fi
if [ ! -f "`command -v xargs`" ]; then
customDie "This script cannot work without xargs. Try uninstall.py."
customExit "This script cannot work without xargs. Try uninstall.py."
fi
cd $extracted_path || customDie "* cannot cd $extracted_path."
cd $extracted_path || customExit "* cannot cd $extracted_path."
echo "- about to run 'sudo xargs rm < $mnf_name'..."
xargs rm < $mnf_name
echo "- about to run 'sudo xargs rmdir --ignore-fail-on-non-empty < $mnf_name'..."

6
utilities/generatemod.py

@ -7,7 +7,7 @@ myPath = os.path.realpath(__file__)
myDir = os.path.dirname(myPath)
def customDie(msg, code=1):
def customExit(msg, code=1):
print("")
print("ERROR:")
print(msg)
@ -67,7 +67,7 @@ for i in range(1, len(sys.argv)):
else:
if (len(sys.argv[i]) >= 2) and (sys.argv[i][:2] == "--"):
usage()
customDie("Invalid option: " + sys.argv[i])
customExit("Invalid option: " + sys.argv[i])
options.append(sys.argv[i])
if (len(options) != 1) and (len(options) != 3):
usage()
@ -90,7 +90,7 @@ if (len(options) == 3):
toMod = toName[:delimI]
if toMod.find(":") > -1:
usage()
customDie("Your modname contains too many colons.")
customExit("Your modname contains too many colons.")
exit(1)
else:
toMod = "default"

30
versionize.sh

@ -3,7 +3,7 @@ echo
echo "Collecting version..."
MY_NAME="versionize.sh"
EM_CONFIG_PATH=$HOME/.config/EnlivenMinetest
cd "$EM_CONFIG_PATH" || customDie "[$MY_NAME] cd \"$EM_CONFIG_PATH\" failed."
cd "$EM_CONFIG_PATH" || customExit "[$MY_NAME] cd \"$EM_CONFIG_PATH\" failed."
if [ -z "$original_src_path" ]; then
original_src_path="$1"
fi
@ -40,7 +40,7 @@ END
echo "1..."
sleep 1
}
customDie() {
customExit() {
echo
echo "ERROR:"
echo " $1"
@ -54,7 +54,7 @@ destroy_msg=""
src_path="$EM_CONFIG_PATH/linux-minetest-kit"
versions_path="$EM_CONFIG_PATH/minetest-versions"
if [ ! -d "$versions_path" ]; then
mkdir -p "$versions_path" || customDie "mkdir $versions_path FAILED"
mkdir -p "$versions_path" || customExit "mkdir $versions_path FAILED"
fi
src_name=""
try_path="$EM_CONFIG_PATH/$original_src_path"
@ -63,14 +63,14 @@ if [ -f "$original_src_path" ]; then
elif [ -d "$original_src_path" ]; then
echo "* detected directory param..."
else
customDie "$original_src_path is not a file or directory."
customExit "$original_src_path is not a file or directory."
fi
cd /tmp || customDie "cannot cd to /tmp"
cd /tmp || customExit "cannot cd to /tmp"
if [ -d versionize ]; then
rm -Rf versionize || customDie "cannot remove /tmp/versionize"
rm -Rf versionize || customExit "cannot remove /tmp/versionize"
fi
mkdir versionize || customDie "cannot create /tmp/versionize"
cd /tmp/versionize || customDie "cannot cd /tmp/versionize"
mkdir versionize || customExit "cannot create /tmp/versionize"
cd /tmp/versionize || customExit "cannot cd /tmp/versionize"
if [ -f "$original_src_path" ]; then
echo "* detected archive file full path..."
try_path="$original_src_path"
@ -86,18 +86,18 @@ if [ -f "$try_path" ]; then
unzip "$try_path"
src_name="`ls`"
if [ ! -d "$src_name" ]; then
customDie "unzip $try_path did not result in a directory!"
customExit "unzip $try_path did not result in a directory!"
fi
src_path="`pwd`/$src_name"
destroy_msg=" (but will be destroyed on next run)"
if [ ! -d "$src_path" ]; then
customDie "$src_path from unzip $try_path is not a directory!"
customExit "$src_path from unzip $try_path is not a directory!"
fi
elif [ -d "$try_path" ]; then
src_path="$try_path"
src_name="`basename $src_path`"
else
customDie "$try_path is not a file or directory."
customExit "$try_path is not a file or directory."
fi
release_txt_path="$src_path/minetest/release.txt"
if [ ! -f "$release_txt_path" ]; then
@ -106,7 +106,7 @@ if [ ! -f "$release_txt_path" ]; then
echo
echo
echo "* '$src_path' remains$destroy_msg."
customDie "Missing $release_txt_path (or $src_path/release.txt)"
customExit "Missing $release_txt_path (or $src_path/release.txt)"
else
echo "Missing $release_txt_path (usually copied from $try_release_txt_path by EnlivenMinetest compille script(s)); reverting to $try_release_txt_path"
release_txt_path="$try_release_txt_path"
@ -116,7 +116,7 @@ release_line="`head -n 1 $release_txt_path`"
version="${release_line##* }" # get second word
version_len=${#version}
if [ "$version_len" -ne "6" ]; then
customDie "Unexpected version scheme (not 6 characters): '$version' near '$release_line' in file $release_txt_path"
customExit "Unexpected version scheme (not 6 characters): '$version' near '$release_line' in file $release_txt_path"
fi
echo "src_name=$src_name"
echo "src_path=$src_path"
@ -138,7 +138,7 @@ if [ ! -z "$src_archive" ]; then
customWarn "This will overwrite '$dst_archive' with '$src_archive'."
fi
if [ -f "$src_archive" ]; then
mv "$src_archive" "$dst_archive" || customDie "Cannot mv '$src_archive' '$dst_archive'"
mv "$src_archive" "$dst_archive" || customExit "Cannot mv '$src_archive' '$dst_archive'"
echo "* moved archive to '$dst_archive'"
echo
echo
@ -160,7 +160,7 @@ if [ -d "$dest_path" ]; then
echo
exit 0
fi
mv "$src_path" "$dest_path" || customDie "Failed to move to 'dest_path'"
mv "$src_path" "$dest_path" || customExit "Failed to move to 'dest_path'"
echo
echo "Done $0."
echo

Loading…
Cancel
Save