Browse Source

read web version of release.txt before downloading

resolves #330
master
poikilos 5 years ago
committed by Jacob Gustafson
parent
commit
9484944ab9
  1. 24
      webapp/install-mts.sh
  2. 46
      webapp/reset-minetest-install-source.sh
  3. 39
      webapp/versionize.sh

24
webapp/install-mts.sh

@ -15,6 +15,27 @@ $1
END END
exit 1 exit 1
} }
customWarn() {
cat <<END
WARNING:
$1
END
echo -en "\a" > /dev/tty0 # beep (You must specify a tty path if not in console mode)
echo "Press Ctrl+C to cancel..."
sleep 1
echo -en "\a" > /dev/tty0
echo "3..."
sleep 1
echo -en "\a" > /dev/tty0
echo "2..."
sleep 1
echo -en "\a" > /dev/tty0
echo "1..."
sleep 1
}
install_git_mod_here(){ install_git_mod_here(){
git_url="$1" git_url="$1"
@ -162,6 +183,7 @@ END
end=`date +%s` end=`date +%s`
compile_time=$((end-start)) compile_time=$((end-start))
echo "Compiling the program finished in $compile_time seconds." echo "Compiling the program finished in $compile_time seconds."
cp release.txt minetest/ | customWarn "Cannot copy `pwd`/release.txt to `pwd`/minetest/"
else else
echo "* using existing minetest..." echo "* using existing minetest..."
fi fi
@ -453,7 +475,7 @@ fi
popd popd
settings_dump="`pwd`/settings-dump.txt" settings_dump="`pwd`/settings-dump.txt"
settings_types_list="`pwd`/settingtypes-list.txt" settings_types_list="`pwd`/settingtypes-list.txt"
#grep -r `pwd`/linux-minetest-kit/minetest/games/Bucket_Game -e "setting_get" > $settings_dump # grep -r `pwd`/linux-minetest-kit/minetest/games/Bucket_Game -e "setting_get" > $settings_dump
pushd linux-minetest-kit/minetest/games pushd linux-minetest-kit/minetest/games
if [ ! -f "$settings_dump" ]; then if [ ! -f "$settings_dump" ]; then
echo "Creating $settings_dump..." echo "Creating $settings_dump..."

46
webapp/reset-minetest-install-source.sh

@ -14,12 +14,58 @@ in_use_name=minetest
# killall $in_use_name # killall $in_use_name
#fi #fi
url=https://downloads.minetest.org url=https://downloads.minetest.org
release_txt_url=http://downloads.minetest.org/release.txt
customWarn() {
cat <<END
WARNING:
$1
END
echo -en "\a" > /dev/tty0 # beep (You must specify a tty path if not in console mode)
echo "Press Ctrl+C to cancel..."
sleep 1
echo -en "\a" > /dev/tty0
echo "3..."
sleep 1
echo -en "\a" > /dev/tty0
echo "2..."
sleep 1
echo -en "\a" > /dev/tty0
echo "1..."
sleep 1
}
customDie () { customDie () {
echo "ERROR: Cannot continue since" echo "ERROR: Cannot continue since"
echo "$1" echo "$1"
exit 1 exit 1
} }
available_release_line=`curl http://downloads.minetest.org/release.txt | head -n 1`
# echo "Release data: $available_release_line" # "Release *" where * is YYMMDD
# See <https://unix.stackexchange.com/questions/174037/extracting-the-second-word-from-a-string-variable>
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"
fi
installed_release_line=`head -n 1 ~/minetest/release.txt`
installed_version=$(echo $installed_release_line | awk '{print $2}')
compiled_release_line=`head -n 1 ~/minetest/release.txt`
compiled_version=$(echo $compiled_release_line | awk '{print $2}')
echo "installed_version: $installed_version"
echo "compiled_version: $compiled_version"
echo "available_version: $available_version"
if [ "@$installed_version" = "@$available_version" ]; then
echo "You already have the latest version installed."
exit 1
fi
if [ "@$compiled_version" -ne "@$installed_version" ]; then
echo "ERROR: You have not yet installed version $compiled_version which you already compiled (you have installed $installed_version)."
echo "You should run ./install-mts.sh instead (with --client option if you want more than minetestserver)"
exit 2
fi
enable_offline=false enable_offline=false
for var in "$@" for var in "$@"
do do

39
webapp/versionize.sh

@ -16,6 +16,27 @@ if [ -z "$original_src_path" ]; then
echo "You must specify a zip file path OR directory path." echo "You must specify a zip file path OR directory path."
exit 1 exit 1
fi fi
customWarn() {
cat <<END
WARNING:
$1
END
echo -en "\a" > /dev/tty0 # beep (You must specify a tty path if not in console mode)
echo "Press Ctrl+C to cancel..."
sleep 1
echo -en "\a" > /dev/tty0
echo "3..."
sleep 1
echo -en "\a" > /dev/tty0
echo "2..."
sleep 1
echo -en "\a" > /dev/tty0
echo "1..."
sleep 1
}
customDie() { customDie() {
echo echo
echo "ERROR:" echo "ERROR:"
@ -75,17 +96,24 @@ elif [ -d "$try_path" ]; then
else else
customDie "$try_path is not a file or directory." customDie "$try_path is not a file or directory."
fi fi
if [ ! -f "$src_path/release.txt" ]; then release_txt_path="$src_path/minetest/release.txt"
if [ ! -f "$release_txt_path" ]; then
try_release_txt_path="$src_path/release.txt"
if [ ! -f "$try_release_txt_path" ]; then
echo echo
echo echo
echo "* '$src_path' remains$destroy_msg." echo "* '$src_path' remains$destroy_msg."
customDie "Missing $src_path/release.txt" customDie "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"
fi
fi fi
release_line="`head -n 1 $src_path/release.txt`" release_line="`head -n 1 $release_txt_path`"
version="${release_line##* }" # get second word version="${release_line##* }" # get second word
version_len=${#version} version_len=${#version}
if [ "$version_len" -ne "6" ]; then if [ "$version_len" -ne "6" ]; then
customDie "Unexpected version scheme (not 6 characters): '$version'" customDie "Unexpected version scheme (not 6 characters): '$version' near '$release_line' in file $release_txt_path"
fi fi
echo "src_name=$src_name" echo "src_name=$src_name"
echo "src_path=$src_path" echo "src_path=$src_path"
@ -103,6 +131,9 @@ if [ ! -z "$src_archive" ]; then
extension="${filename##*.}" extension="${filename##*.}"
filename="${filename%.*}" filename="${filename%.*}"
dst_archive="$versions_path/$filename-$version.$extension" dst_archive="$versions_path/$filename-$version.$extension"
if [ -f "$dst_archive" ]; then
customWarn "This will overwrite '$dst_archive' with '$src_archive'."
fi
if [ -f "$src_archive" ]; then if [ -f "$src_archive" ]; then
mv "$src_archive" "$dst_archive" || customDie "Cannot mv '$src_archive' '$dst_archive'" mv "$src_archive" "$dst_archive" || customDie "Cannot mv '$src_archive' '$dst_archive'"
echo "* moved archive to '$dst_archive'" echo "* moved archive to '$dst_archive'"

Loading…
Cancel
Save