From bed7d73ee88b76f2b2a11aadb13323385ab436ac Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Thu, 28 Mar 2019 12:05:24 -0400 Subject: [PATCH] only stop install on missing source IF not compiled already --- webapp/install-mts.sh | 121 +++++++++++++++++++++++++++--------------- 1 file changed, 78 insertions(+), 43 deletions(-) diff --git a/webapp/install-mts.sh b/webapp/install-mts.sh index f4daca3..dae19a0 100755 --- a/webapp/install-mts.sh +++ b/webapp/install-mts.sh @@ -5,36 +5,37 @@ echo echo echo "Starting install..." date -echo "Checking if program is compiled..." -extracted_name=linux-minetest-kit -flag_dir="$extracted_name/mtsrc" -if [ ! -d "$flag_dir" ]; then - echo "ERROR: missing $flag_dir" - echo "- If you do not have a minetest source directory with" - echo " libraries built yet, you must add that such as by running:" - echo - echo "bash reset-minetest-install-source.sh" - echo - echo +customDie() { + cat <& program.log - echo "Compiling via perl..." + echo "Compiling via perl (this may take a while--output redirected to `pwd`/program.log)..." perl mtcompile-program.pl build --server $extra_options >& program.log else # NOTE: no pl in $extracted_name, assuming bash: - echo "Compiling via bash..." - bash -e mtcompile-program.sh build --server $extra_options >& program.log + if [ -f mtcompile-program.sh ]; then + echo "Compiling via bash (this may take a while--output redirected to `pwd`/program.log)..." + bash -e mtcompile-program.sh build --server $extra_options >& program.log + else + echo + echo "ERROR: Install cannot finish since there is no" + echo " mtcompile-program.pl nor mtcompile-program.pl" + echo " in the extracted $extracted_name directory." + echo + echo + fi fi end=`date +%s` compile_time=$((end-start)) - echo "Compiling program finished in $compile_time seconds." + echo "Compiling the program finished in $compile_time seconds." else - echo "using existing minetest..." + echo "* using existing minetest..." fi if [ ! -f "$flag_file" ]; then - echo "ERROR: Build did not complete--missing '$flag_file'" - exit 1 + customDie "The build did not complete since '$flag_file' is missing." fi dest_flag_file="$HOME/$flag_file" if [ -f "$dest_flag_file" ]; then mv -f "$dest_flag_file" "$dest_flag_file.bak" fi if [ -f "$dest_flag_file" ]; then - echo "ERROR: not complete since can't move old '$dest_flag_file'" - exit 1 + customDie "Install is incomplete because it can't move '$dest_flag_file'." fi if [ ! -d minetest ]; then - echo "ERROR: can't install since missing `pwd`/minetest" - exit 1 + customDie "Install is incomplete because `pwd`/minetest is missing." fi -try_dest="/tank/local/owner/minetest" -if [ -d "$try_dest" ]; then - echo "Installing minetest as symlink '$HOME/minetest' pointing to '$try_dest'..." - rsync -rt minetest/ $try_dest +virtual_dest="$HOME/minetest" +link_target=`readlink $virtual_dest` +# install_dest="/tank/local/owner/minetest" +install_dest="$virtual_dest" +if [ ! -z "$link_target" ]; then + install_dest="$link_target" + echo "* detected that $virtual_dest is a symlink to $link_target" + echo " (redirecting rsync to prevent symlink to dir conversion: installing to $install_dest" + echo " and recreating symlink '$virtual_dest' pointing to '$install_dest')..." + #rsync -rt "minetest/" "$install_dest" || customDie "Cannot rsync files from installer data `pwd`/minetest/ to $install_dest" if [ ! -d "$HOME/minetest" ]; then - ln -s $try_dest $HOME/minetest + echo "* creating link to $install_dest directory as $HOME/minetest..." + #ln -s "$install_dest" "$HOME/minetest" fi else echo "Installing minetest to '$HOME'..." - rsync -rt minetest/ $HOME/minetest - if [ ! -f "$dest_flag_file" ]; then - echo "ERROR: not complete--couldn't create '$dest_flag_file'" - exit 1 - fi + #rsync -rt minetest/ $install_dest || customDie "Cannot rsync files from installer data `pwd`/minetest/ to $install_dest" +fi +if [ ! -f "$dest_flag_file" ]; then + echo "ERROR: not complete--couldn't create '$dest_flag_file'" + #exit 1 fi flag_dir="$HOME/minetest/games/Bucket_Game" @@ -175,9 +206,13 @@ fi server_minetest_conf_dest="$HOME/minetest/games/ENLIVEN/minetest.conf" if [ -f "$server_minetest_conf_dest" ]; then - echo - echo "NOTE: $server_minetest_conf_dest will be overwritten (minetest.org releases allow you to put a world.conf file in your world, so that should be customized instead)..." - echo + cat << END +NOTE: minetest.org releases allow you to put a world.conf file in your + world, so that is the file you should edit manually in your world + --this installer overwrites $server_minetest_conf_dest and + worlds/CenterOfTheSun settings (the author Poikilos' world). + +END fi echo "Writing '$server_minetest_conf_dest'..." cp -f "patches/subgame/minetest.server-example.conf" "$server_minetest_conf_dest"