Browse Source

Fix a missing dep and detect ver correctly in versionize.sh.

master
poikilos 5 years ago
parent
commit
28ece0ef8d
  1. 2
      install-mts.sh
  2. 2
      minetestenv-in-place.rc
  3. 62
      reset-minetest-install-source.sh
  4. 2
      update-minetest-linux64.sh
  5. 78
      versionize.sh

2
install-mts.sh

@ -54,7 +54,7 @@ if [ ! -f "$MT_BASH_RC_PATH" ]; then
exit 1
fi
source $MT_BASH_RC_PATH
# ^ same as install-minetest-linux64.sh
# ^ same as install-minetest-linux64.sh, versionize.sh
INSTALL_MTS_NAME="install-mts.sh"

2
minetestenv-in-place.rc

@ -866,7 +866,7 @@ detect_mt_version_at(){
fi
else
if [ -z "$this_err" ]; then
this_err="\"$1/release.txt\" does not exist"
this_err="\"$1/release.txt\" does not exist."
fi
fi
version_len=${#new_release_version}

62
reset-minetest-install-source.sh

@ -76,43 +76,65 @@ if [ "@$compiled_version" != "@$installed_version" ]; then
exit 2
fi
enable_offline=false
enable_keep=false
for var in "$@"
do
if [ "@$var" = "@--offline" ]; then
enable_offline=true
elif [ "@$var" = "@--keep" ]; then
enable_keep=true
else
customExit "Invalid argument: $var"
fi
done
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).
screenshot_count=0
if [ -d $extracted_path/screenshots ]; then
screenshot_count=`ls $extracted_path/screenshots/*.png | wc -l`
fi
if [ $screenshot_count -gt 0 ]; then
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 ~/ || customExit "can't move screenshots from $extracted_path/minetest/bin/*.png"
fi
rm -Rf "$extracted_path" || customExit "can't remove $extracted_name"
if [ "@$enable_keep" = "@true" ]; then
enable_offline=true
fi
if [ "@$enable_keep" != "@true" ]; then
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).
screenshot_count=0
if [ -d $extracted_path/screenshots ]; then
screenshot_count=`ls $extracted_path/screenshots/*.png | wc -l`
fi
if [ $screenshot_count -gt 0 ]; then
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 ~/ || customExit "can't move screenshots from $extracted_path/minetest/bin/*.png"
fi
rm -Rf "$extracted_path" || customExit "can't remove $extracted_name"
fi
fi
if [ "@$enable_offline" = "@true" ]; then
if [ ! -f "$zip_name" ]; then
customExit "* Offline install is impossible without '`pwd`/$zip_name'."
if [ "@$enable_keep" = "@true" ]; then
if [ ! -d "$extracted_path" ]; then
customExit "* Offline install is impossible without '`pwd`/$zip_name' (or '$extracted_path' with the --keep option)."
else
echo "* keeping existing \"$extracted_path\"..."
fi
else
customExit "* Offline install is impossible without '`pwd`/$zip_name' (or '$extracted_path' when using the --keep option)."
fi
fi
else
wget -O "$EM_CONFIG_PATH/$zip_name" $url/$zip_name || customExit "no $zip_name at $url"
fi
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."
if [ "@$enable_keep" = "@true" ]; then
if [ ! -d "$extracted_path" ]; then
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."
else
cd "$extracted_name" || customExit "There is no readable directory: \"`pwd`\" (that or the zip is necessary for --keep)."
fi
fi
cat "$extracted_path/release.txt"
echo "compiling libraries..."
date

2
update-minetest-linux64.sh

@ -54,7 +54,7 @@ if [ ! -f "$MT_BASH_RC_PATH" ]; then
exit 1
fi
source $MT_BASH_RC_PATH
# ^ same as install-mts.sh
# ^ same as install-mts.sh, versionize.sh
#INSTALL_SCRIPT_NAME="update-minetest-linux64.sh"

78
versionize.sh

@ -1,4 +1,62 @@
#!/bin/bash
#!/bin/bash
clear
me=`basename "$0"`
echo
echo
echo
scripting_rc_path=~/.config/EnlivenMinetest/scripting.rc
if [ -f "$EM_CONFIG_PATH/scripting.rc" ]; then
echo "* [$MT_ENV_RUP_NAME] using $scripting_rc_path..."
source $scripting_rc_path
fi
if [ -z "$REPO_PATH" ]; then
REPO_PATH="$HOME/git/EnlivenMinetest"
fi
MT_BASH_RC_NAME="minetestenv-in-place.rc"
CURRENT_MT_SCRIPTS_DIR="$HOME/.local/bin"
MT_BASH_RC_PATH="$CURRENT_MT_SCRIPTS_DIR/$MT_BASH_RC_NAME"
TRY_CURRENT_MT_SCRIPTS_DIR="$REPO_PATH"
TRY_MT_BASH_RC_PATH="$TRY_CURRENT_MT_SCRIPTS_DIR/$MT_BASH_RC_NAME"
if [ -f "$TRY_MT_BASH_RC_PATH" ]; then
CURRENT_MT_SCRIPTS_DIR="$TRY_CURRENT_MT_SCRIPTS_DIR"
MT_BASH_RC_PATH="$TRY_MT_BASH_RC_PATH"
#fi
#if [ ! -f "$MT_BASH_RC_PATH" ]; then
else
if [ ! -d "$CURRENT_MT_SCRIPTS_DIR" ]; then
mkdir -p "$CURRENT_MT_SCRIPTS_DIR"
fi
MT_BASH_RC_URL=https://raw.githubusercontent.com/poikilos/EnlivenMinetest/master/$MT_BASH_RC_NAME
curl $MT_BASH_RC_URL -o "$MT_BASH_RC_PATH"
if [ $? -ne 0 ]; then
#if [ ! -f "$MT_BASH_RC_PATH" ]; then
# This is necessary on cygwin for some reason.
curl $MT_BASH_RC_URL > "$MT_BASH_RC_PATH"
fi
#if [ $? -ne 0 ]; then
if [ ! -f "$MT_BASH_RC_PATH" ]; then
# This is necessary on cygwin for some reason.
wget -O "$MT_BASH_RC_PATH" $MT_BASH_RC_URL
fi
if [ $? -ne 0 ]; then
echo
echo "ERROR: Downloading $MT_BASH_RC_URL to $MT_BASH_RC_PATH failed."
echo
sleep 10
exit 1
fi
fi
if [ ! -f "$MT_BASH_RC_PATH" ]; then
echo
echo "$MT_BASH_RC_PATH is not present."
echo
sleep 10
exit 1
fi
source $MT_BASH_RC_PATH
# ^ same as install-mts.sh, update-minetest-linux64.sh
echo
echo "Collecting version..."
EM_CONFIG_PATH=$HOME/.config/EnlivenMinetest
@ -99,10 +157,28 @@ else
customExit "$try_path is not a file or directory."
fi
detect_mt_version_at "$src_path/minetest"
KIT_RELEASE_TXT=$src_path/release.txt
BIN_RELEASE_TXT=$src_path/minetest/release.txt
if [ ! -f "$BIN_RELEASE_TXT" ]; then
if [ -f "$KIT_RELEASE_TXT" ]; then
# This is expected to occur since we only now unzipped it.
#if [ -d "BIN_RELEASE_TXT=$src_path/minetest" ]; then
cp "$KIT_RELEASE_TXT" "$BIN_RELEASE_TXT"
#fi
fi
fi
detect_mt_version_at "$src_path"
if [ -z "$new_release_version" ]; then
detect_mt_version_at "$src_path/minetest"
fi
# ^ DOES exit if no 6-digit version is detected when no 3rd param
# is provided.
if [ -z "$new_release_version" ]; then
echo "new_release_version from $src_path/minetest is blank."
exit 1
fi
echo "src_name=$src_name"
echo "src_path=$src_path"
echo "new_release_version=$new_release_version"

Loading…
Cancel
Save