Browse Source

improve detection of client, make dest_programs variable

master
poikilos 6 years ago
committed by Jacob Gustafson
parent
commit
67be533b73
  1. 88
      webapp/install-mts.sh

88
webapp/install-mts.sh

@ -15,6 +15,9 @@ $1
END
exit 1
}
dest_programs="$HOME"
#NOTE: $HOME is still used further down, for $HOME/.* and $HOME/i_am_dedicated_minetest_server flag file (which can be empty)
#TODO: change $HOME/i_am_dedicated_minetest_server to $HOME/.config/EnlivenMinetest/i_am_dedicated_minetest_server or rc file
extracted_name=linux-minetest-kit
flag_dir_rel="$extracted_name/mtsrc"
flag_dir="`pwd`/$flag_dir_rel"
@ -27,12 +30,13 @@ fi
if [ "@$2" = "@--client" ]; then
enable_client=true
fi
flag_icon="$HOME/Desktop/org.minetest.minetest.desktop"
# flag_icon="$HOME/Desktop/org.minetest.minetest.desktop"
flag_client_dest_file="$dest_programs/minetest/bin/minetest"
flag_file="minetest/bin/minetestserver"
if [ -f "$flag_icon" ]; then
if [ -f "$flag_client_dest_file" ]; then
enable_client=true
echo "* automatically adding --client to compile since detected"
echo " '$flag_icon'"
echo " '$flag_client_dest_file'"
# echo "--press Ctrl C to cancel..."
# sleep 2
fi
@ -103,7 +107,7 @@ fi
if [ ! -f "$flag_file" ]; then
customDie "The build did not complete since '$flag_file' is missing."
fi
dest_flag_file="$HOME/$flag_file"
dest_flag_file="$dest_programs/$flag_file"
if [ -f "$dest_flag_file" ]; then
mv -f "$dest_flag_file" "$dest_flag_file.bak"
fi
@ -113,7 +117,7 @@ fi
if [ ! -d minetest ]; then
customDie "Install is incomplete because `pwd`/minetest is missing."
fi
virtual_dest="$HOME/minetest"
virtual_dest="$dest_programs/minetest"
link_target=`readlink $virtual_dest`
# install_dest="/tank/local/owner/minetest"
install_dest="$virtual_dest"
@ -123,60 +127,60 @@ if [ ! -z "$link_target" ]; then
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
echo "* creating link to $install_dest directory as $HOME/minetest..."
ln -s "$install_dest" "$HOME/minetest"
if [ ! -d "$dest_programs/minetest" ]; then
echo "* creating link to $install_dest directory as $dest_programs/minetest..."
ln -s "$install_dest" "$dest_programs/minetest"
fi
else
echo "Installing minetest directory to '$HOME'..."
echo "Installing minetest directory to '$dest_programs'..."
rsync -rt minetest/ $install_dest || customDie "Cannot rsync files from installer data `pwd`/minetest/ to $install_dest"
fi
if [ ! -f "$dest_flag_file" ]; then
customDie "ERROR: not complete--couldn't install binary as '$dest_flag_file'"
fi
flag_dir="$HOME/minetest/games/Bucket_Game"
flag_dir="$dest_programs/minetest/games/Bucket_Game"
if [ ! -d "$flag_dir" ]; then
customDie "ERROR: missing $flag_dir"
fi
if [ ! -d "$HOME/minetest/games/ENLIVEN" ]; then
echo "Copying $flag_dir to $HOME/minetest/games/ENLIVEN..."
cp -R "$flag_dir" "$HOME/minetest/games/ENLIVEN"
echo "name = ENLIVEN" > "$HOME/minetest/games/ENLIVEN/game.conf"
if [ ! -d "$dest_programs/minetest/games/ENLIVEN" ]; then
echo "Copying $flag_dir to $dest_programs/minetest/games/ENLIVEN..."
cp -R "$flag_dir" "$dest_programs/minetest/games/ENLIVEN"
echo "name = ENLIVEN" > "$dest_programs/minetest/games/ENLIVEN/game.conf"
else
mod_name=coderbuild
echo "updating $mod_name..."
rsync -rt "$flag_dir/mods/$mod_name" "$HOME/minetest/games/ENLIVEN/mods"
rsync -rt "$flag_dir/mods/$mod_name" "$dest_programs/minetest/games/ENLIVEN/mods"
mod_name=codercore
echo "updating $mod_name..."
rsync -rt "$flag_dir/mods/$mod_name" "$HOME/minetest/games/ENLIVEN/mods"
rsync -rt "$flag_dir/mods/$mod_name" "$dest_programs/minetest/games/ENLIVEN/mods"
mod_name=coderedit
echo "updating $mod_name..."
rsync -rt "$flag_dir/mods/$mod_name" "$HOME/minetest/games/ENLIVEN/mods"
rsync -rt "$flag_dir/mods/$mod_name" "$dest_programs/minetest/games/ENLIVEN/mods"
mod_name=coderfood
echo "updating $mod_name..."
rsync -rt "$flag_dir/mods/$mod_name" "$HOME/minetest/games/ENLIVEN/mods"
rsync -rt "$flag_dir/mods/$mod_name" "$dest_programs/minetest/games/ENLIVEN/mods"
mod_name=codermobs
echo "updating $mod_name..."
rsync -rt "$flag_dir/mods/$mod_name" "$HOME/minetest/games/ENLIVEN/mods"
rsync -rt "$flag_dir/mods/$mod_name" "$dest_programs/minetest/games/ENLIVEN/mods"
mod_name=decorpack
echo "updating $mod_name..."
rsync -rt "$flag_dir/mods/$mod_name" "$HOME/minetest/games/ENLIVEN/mods"
rsync -rt "$flag_dir/mods/$mod_name" "$dest_programs/minetest/games/ENLIVEN/mods"
mod_name=mtmachines
echo "updating $mod_name..."
rsync -rt "$flag_dir/mods/$mod_name" "$HOME/minetest/games/ENLIVEN/mods"
# cp -f "$flag_dir/mods/LICENSE" "$HOME/minetest/games/ENLIVEN/mods/LICENSE"
rsync -rt "$flag_dir/mods/$mod_name" "$dest_programs/minetest/games/ENLIVEN/mods"
# cp -f "$flag_dir/mods/LICENSE" "$dest_programs/minetest/games/ENLIVEN/mods/LICENSE"
fi
popd
pushd ..
src="patches/subgame/menu"
dst="$HOME/minetest/games/ENLIVEN/menu"
dst="$dest_programs/minetest/games/ENLIVEN/menu"
echo "updating '$dst' from '$src/'..."
rsync -rt "$src/" "$dst"
src="patches/Bucket_Game-patched"
dst="$HOME/minetest/games/ENLIVEN"
dst="$dest_programs/minetest/games/ENLIVEN"
echo "updating '$dst' from '$src/'..."
rsync -rt "$src/" "$dst"
if [ -d "$dst/mods/coderfood/food_basic/etc" ]; then
@ -184,28 +188,28 @@ if [ -d "$dst/mods/coderfood/food_basic/etc" ]; then
fi
# Bucket_Game doesn't come with a minetest.conf, only minetest.conf.example* files
# if [ ! -f "$HOME/minetest/minetest.Bucket_Game-example.conf" ]; then
# cp -f "$HOME/minetest/minetest.conf" "$HOME/minetest/minetest.Bucket_Game-example.conf"
# if [ ! -f "$dest_programs/minetest/minetest.Bucket_Game-example.conf" ]; then
# cp -f "$dest_programs/minetest/minetest.conf" "$dest_programs/minetest/minetest.Bucket_Game-example.conf"
# fi
client_example_dest="$HOME/minetest/minetest.ENLIVEN.client-example.conf"
client_example_dest="$dest_programs/minetest/minetest.ENLIVEN.client-example.conf"
# client conf writing only ever happens once, unless you manually delete $client_example_dest file:
if [ ! -f "$client_example_dest" ]; then
if [ -f "$HOME/minetest/minetest.conf" ]; then
if [ -f "$dest_programs/minetest/minetest.conf" ]; then
echo "Backing up minetest.conf..."
if [ ! -f "$HOME/minetest/minetest.conf.1st" ]; then
cp -f "$HOME/minetest/minetest.conf" "$HOME/minetest/minetest.conf.1st"
if [ ! -f "$dest_programs/minetest/minetest.conf.1st" ]; then
cp -f "$dest_programs/minetest/minetest.conf" "$dest_programs/minetest/minetest.conf.1st"
else
cp -f "$HOME/minetest/minetest.conf" "$HOME/minetest/minetest.conf.bak"
cp -f "$dest_programs/minetest/minetest.conf" "$dest_programs/minetest/minetest.conf.bak"
fi
fi
echo "Installing minetest.conf and ENLIVEN example conf files..."
cp -f "patches/subgame/minetest.client-example.conf" "$HOME/minetest/minetest.conf"
cp -f "patches/subgame/minetest.LAN-client-example.conf" "$HOME/minetest/minetest.ENLIVEN.LAN-client-example.conf"
cp -f "patches/subgame/minetest.server-example.conf" "$HOME/minetest/minetest.ENLIVEN.server-example.conf"
cp -f "patches/subgame/minetest.client-example.conf" "$dest_programs/minetest/minetest.conf"
cp -f "patches/subgame/minetest.LAN-client-example.conf" "$dest_programs/minetest/minetest.ENLIVEN.LAN-client-example.conf"
cp -f "patches/subgame/minetest.server-example.conf" "$dest_programs/minetest/minetest.ENLIVEN.server-example.conf"
cp -f "patches/subgame/minetest.client-example.conf" "$client_example_dest"
fi
server_minetest_conf_dest="$HOME/minetest/games/ENLIVEN/minetest.conf"
server_minetest_conf_dest="$dest_programs/minetest/games/ENLIVEN/minetest.conf"
if [ -f "$server_minetest_conf_dest" ]; then
cat << END
@ -263,9 +267,9 @@ if [ "@$enable_client" = "@true" ]; then
cat "patches/deploy-patched/misc/org.minetest.minetest.desktop" | grep -v Icon | grep -v Path | grep -v Exec > "$dest_icon"
# Icon must be an absolute path (other variables use $HOME in
# desktop file above), so exclude it above and rewrite it below:
echo "Icon=$HOME/minetest/misc/minetest-xorg-icon-128.png" >> "$dest_icon"
echo "Path=$HOME/minetest/bin" >> "$dest_icon"
echo "Exec=$HOME/minetest/bin/minetest" >> "$dest_icon"
echo "Icon=$dest_programs/minetest/misc/minetest-xorg-icon-128.png" >> "$dest_icon"
echo "Path=$dest_programs/minetest/bin" >> "$dest_icon"
echo "Exec=$dest_programs/minetest/bin/minetest" >> "$dest_icon"
if [ "@$enable_clear_icon_cache" = "@true" ]; then
if [ -f "`command -v gnome-shell`" ]; then
echo "Refreshing Gnome icons..."
@ -298,10 +302,10 @@ if [ "@$enable_client" = "@true" ]; then
fi
fi
if [ -f $HOME/minetest/games/ENLIVEN/mods/codermobs/codermobs/animal_materials.lua ]; then
if [ -f $dest_programs/minetest/games/ENLIVEN/mods/codermobs/codermobs/animal_materials.lua ]; then
if [ -d patches/mods-stopgap/animal_materials_legacy ]; then
echo "* installing animal_materials_legacy (only needed for worlds created with old versions of Bucket_Game)"
rsync -rt patches/mods-stopgap/animal_materials_legacy $HOME/minetest/games/ENLIVEN/mods/
rsync -rt patches/mods-stopgap/animal_materials_legacy $dest_programs/minetest/games/ENLIVEN/mods/
else
echo "* MISSING patches/mods-stopgap/animal_materials"
fi
@ -309,10 +313,10 @@ else
echo "* SKIPPING a stopgap mod since no animal_materials"
fi
if [ -d "$HOME/minetest/games/ENLIVEN/mods/coderbuild/nftools" ]; then
if [ -d "$dest_programs/minetest/games/ENLIVEN/mods/coderbuild/nftools" ]; then
if [ -d patches/mods-stopgap/nftools_legacy ]; then
echo "* installing nftools_legacy (only needed for worlds created with old versions of Bucket_Game)"
rsync -rt patches/mods-stopgap/nftools_legacy $HOME/minetest/games/ENLIVEN/mods/
rsync -rt patches/mods-stopgap/nftools_legacy $dest_programs/minetest/games/ENLIVEN/mods/
else
echo "* MISSING patches/mods-stopgap/nftools_legacy"
fi

Loading…
Cancel
Save