Browse Source

Make install and upgrade functions. Add a linux64 binary webinstall.

master
poikilos 4 years ago
parent
commit
875e5bc70e
  1. 330
      install-minetest-linux64.sh
  2. 187
      install-mts.sh

330
install-minetest-linux64.sh

@ -0,0 +1,330 @@
#!/bin/bash
me=`basename "$0"`
echo
echo
echo
echo "Starting install..."
MY_NAME="install-mts.sh"
EM_CONFIG_PATH="$HOME/.config/EnlivenMinetest"
date
customExit() {
errorCode=1
if [ ! -z "$2" ]; then
errorCode="$2"
fi
cat <<END
ERROR:
$1
END
exit $errorCode
}
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_shortcut(){
enable_clear_icon_cache=false
_SRC_SHORTCUT_PATH=$1
if [ ! -f "$_SRC_SHORTCUT_PATH" ]; then
customExit "\"$_SRC_SHORTCUT_PATH\" is missing."
fi
_DST_SHORTCUT_NAME=$2
# _CAPTION is optional (original "Name" is kept if not specified)
_EXEC=$3
_WORKING_DIR=$4
_ICON=$5
_CAPTION=$6
dest_icons=$HOME/.local/share/applications
dest_icon=$dest_icons/$_DST_SHORTCUT_NAME
if [ ! -d "$dest_icons" ]; then
mdkir -p "$dest_icons" || customExit "mkdir -p \"$dest_icons\" failed."
fi
# if [ -f "$dest_icon" ]; then
# comment since never fixes broken icon anyway
# TODO: fixed bad cache even if icon was rewritten properly after written improperly
# * not tried yet:
# * rm $HOME/.kde/share/config/kdeglobals
# enable_clear_icon_cache=true
# fi
echo "* writing icon '$dest_icon'..."
if [ ! -z "$_ICON" ]; then
if [ ! -z "$_CAPTION" ]; then
cat "$_SRC_SHORTCUT_PATH" | grep -v "^Icon=" | grep -v "^Path=" | grep -v "^Exec=" | grep -v "^Name=" > "$dest_icon"
else
cat "$_SRC_SHORTCUT_PATH" | grep -v "^Icon=" | grep -v "^Path=" | grep -v "^Exec=" > "$dest_icon"
fi
else
if [ ! -z "$_CAPTION" ]; then
cat "$_SRC_SHORTCUT_PATH" | grep -v "^Path=" | grep -v "^Exec=" | grep -v "^Name=" > "$dest_icon"
else
cat "$_SRC_SHORTCUT_PATH" | grep -v "^Path=" | grep -v "^Exec=" > "$dest_icon"
fi
fi
# Icon must be an absolute path (other variables use $HOME in
# desktop file above), so exclude it above and rewrite it below:
echo "Path=$dest_programs/minetest/bin" >> "$dest_icon"
if [ ! -z "$_CAPTION" ]; then
echo "Name=$_CAPTION" >> "$dest_icon"
fi
if [ ! -z "$_ICON" ]; then
echo "Icon=$_ICON" >> "$dest_icon"
fi
echo "Exec=$_EXEC" >> "$dest_icon"
if [ "@$enable_clear_icon_cache" = "@true" ]; then
if [ -f "`command -v gnome-shell`" ]; then
echo "Refreshing Gnome icons..."
gnome-shell --replace & disown
sleep 10
fi
if [ -f "$HOME/.cache/icon-cache.kcache" ]; then
echo "clearing $HOME/.cache/icon-cache.kcache..."
rm $HOME/.cache/icon-cache.kcache
fi
if [ -f "`command -v kquitapp5`" ]; then
echo "Refreshing KDE icons..."
if [ "`command -v kstart5`" ]; then
kquitapp5 plasmashell && kstart5 plasmashell
else
kquitapp5 plasmashell && kstart plasmashell
fi
sleep 15
fi
if [ -f "`command -v xfce4-panel`" ]; then
echo "Refreshing Xfce icons..."
xfce4-panel -r && xfwm4 --replace
sleep 5
fi
if [ -f "`command -v lxpanelctl`" ]; then
echo "Refreshing LXDE icons..."
lxpanelctl restart && openbox --restart
sleep 5
fi
fi
}
# ^ same as install-minetest-linux64.sh
install_my_shortcut(){
#requires SHORTCUT_PATH to already be set to a valid Minetest ".desktop" file.
EXEC_PATH="$INSTALL_PATH/bin/minetest"
if [ ! -f "$EXEC_PATH" ]; then
echo "* WARNING: The Minetest executable is not present: \"$EXEC_PATH\""
fi
WORKING_DIR_PATH="$INSTALL_PATH/bin"
if [ ! -d "$WORKING_DIR_PATH" ]; then
echo "* WARNING: The Minetest working directory is not present: \"$WORKING_DIR_PATH\""
fi
MT_ICON="$INSTALL_PATH/misc/minetest-xorg-icon-128.png"
if [ ! -f "$MT_ICON" ]; then
echo "* WARNING: The Minetest icon is not present: \"$MT_ICON\""
fi
install_shortcut "$SHORTCUT_PATH" "org.minetest.minetest.desktop" "$EXEC_PATH" "$WORKING_DIR_PATH" "$MT_ICON" "Final Minetest"
}
DL_NAME=minetest-linux64.zip
DL_PATH=$HOME/Downloads/$DL_NAME
EXTRACTED_NAME=minetest-linux64
if [ -z "$INSTALL_PATH" ]; then
INSTALL_PATH="$HOME/minetest"
fi
SHORTCUT_PATH="$INSTALL_PATH/misc/net.minetest.minetest.desktop"
TRY_ORG_PATH="$INSTALL_PATH/misc/org.minetest.minetest.desktop"
if [ -f "$TRY_ORG_PATH" ]; then
SHORTCUT_PATH="$TRY_ORG_PATH"
fi
if [ -z "$MY_TMP" ]; then
MY_TMP=/tmp/minetest-webinstall
fi
mkdir -p "$MY_TMP"
EXTRACTED_PATH="$MY_TMP/$EXTRACTED_NAME"
exitAndDeleteDownload(){
if [ -f "$DL_PATH" ]; then
echo "* removing \"$DL_PATH\" since it didn't work..."
rm -f "$DL_PATH"
fi
customExit "$1" $2
}
if [ -d "$HOME/minetest-linux64" ]; then
if [ ! -d "$INSTALL_PATH" ]; then
mv "$HOME/minetest-linux64" "$INSTALL_PATH"
# ^ so that code below can find an existing installation
fi
fi
if [ -f "$HOME/$DL_NAME" ]; then
DL_PATH="$HOME/$DL_NAME"
fi
if [ -z "$ENABLE_DL" ]; then
ENABLE_DL=false
fi
for var in "$@"
do
if [ "@$var" = "@--update" ]; then
ENABLE_DL=true
fi
done
if [ ! -f "$DL_PATH" ]; then
ENABLE_DL=true
fi
old_release_line=
if [ -f "$INSTALL_PATH/release.txt" ]; then
old_release_line="`cat $INSTALL_PATH/release.txt | grep Release`"
fi
old_version=
if [ ! -z "$old_release_line" ]; then
old_version="${old_release_line##* }" # get second word
else
old_version="1st"
if [ -d "$INSTALL_PATH.1st" ]; then
old_version="bak"
fi
fi
release_line=
RELEASE_TXT_URL="https://downloads.minetest.org/release.txt"
if [ ! -f "$MY_TMP/release.txt" ]; then
curl $RELEASE_TXT_URL -o "$MY_TMP/release.txt" || customExit "curl $RELEASE_TXT_URL failed."
fi
release_line="`cat $MY_TMP/release.txt | grep Release`"
if [ -z "$release_line" ]; then
cat "$MY_TMP/release.txt"
customExit "Obtaining a Release line from $RELEASE_TXT_URL failed (got '$release_line')."
fi
version=
if [ ! -z "$release_line" ]; then
version="${release_line##* }" # get second word
else
version="new"
fi
#version_len=${#version}
#if [ "$version_len" -ne "6" ]; then
# customExit "Unexpected version scheme (not 6 characters): '$version' near '$release_line' in file $release_txt_path"
#fi
if [ "@$old_version" = "@$version" ]; then
#if [ ! -f "$SHORTCUT_PATH" ]; then
install_my_shortcut
#fi
customExit "Version $version is already installed at $INSTALL_PATH. There is nothing to do."
fi
if [ "@$ENABLE_DL" = "@true" ]; then
if [ ! -d "$HOME/Downloads" ]; then
mkdir -p "$HOME/Downloads"
fi
curl https://downloads.minetest.org/$DL_NAME -o "$DL_PATH" || exitAndDeleteDownload "The download failed."
else
echo "* using existing $DL_PATH..."
fi
cd "$MY_TMP" || customExit "cd \"$MY_TMP\" failed."
if [ ! -f "`command -v unzip`" ]; then
cat <<END
You are missing the unzip command.
END
if [ -f "`command -v apt-get`" ]; then
cat<<END
Try:
sudo apt-get update -y
sudo apt-get install -y unzip
END
elif [ -f "`command -v dnf`" ]; then
cat<<END
Try:
sudo dnf install -y unzip
END
fi
exit 1
fi
killall minetest 2>/dev/null 1>&2
upgradeAndMerge(){
UPGRADE_TYPE="$1"
if [ ! -d "$INSTALL_PATH/$UPGRADE_TYPE" ]; then
customExit "* WARNING: $UPGRADE_TYPE upgrade is skipped since $INSTALL_PATH/$UPGRADE_TYPE is not present."
else
echo "* upgrading $UPGRADE_TYPE"
for UPGRADE_PATH in `find $INSTALL_PATH/$UPGRADE_TYPE -maxdepth 1`
do
UPGRADE_NAME="`basename $UPGRADE_PATH`"
if [ "$UPGRADE_PATH" = "$INSTALL_PATH/$UPGRADE_TYPE" ]; then
echo " * examining $UPGRADE_PATH..."
elif [ -d "$UPGRADE_PATH" ]; then
echo " * upgrading $UPGRADE_NAME..."
if [ -d "$INSTALL_PATH.$old_version/$UPGRADE_TYPE/$UPGRADE_NAME" ]; then
rm -Rf "$INSTALL_PATH.$old_version/$UPGRADE_TYPE/$UPGRADE_NAME" || customExit "* rm -Rf \"$INSTALL_PATH.$old_version/$UPGRADE_TYPE/$UPGRADE_NAME\" failed."
mv "$UPGRADE_PATH" "$INSTALL_PATH.$old_version/$UPGRADE_TYPE/$UPGRADE_NAME" || customExit "mv \"$UPGRADE_PATH\" \"$INSTALL_PATH.$old_version/$UPGRADE_TYPE/$UPGRADE_NAME\""
fi
else
echo " * upgrading $UPGRADE_NAME..."
mv -f "$UPGRADE_PATH" "$INSTALL_PATH.$old_version/$UPGRADE_TYPE/$UPGRADE_NAME" || customExit "mv \"$UPGRADE_PATH\" \"$INSTALL_PATH.$old_version/$UPGRADE_TYPE/$UPGRADE_NAME\""
fi
done
rmdir "$INSTALL_PATH/$UPGRADE_TYPE" || customExit "rmdir \"$INSTALL_PATH/$UPGRADE_TYPE\" failed."
mv "$INSTALL_PATH.$old_version/$UPGRADE_TYPE" "$INSTALL_PATH/" || customExit "mv \"$INSTALL_PATH.$old_version/$UPGRADE_TYPE\" \"$INSTALL_PATH/\""
fi
}
if [ -d "$MY_TMP/$EXTRACTED_NAME" ]; then
rm -Rf "$MY_TMP/$EXTRACTED_NAME" || customExit "* removing the old \"$MY_TMP/$EXTRACTED_NAME\" failed."
fi
unzip "$DL_PATH" || customExit "Extracting $DL_PATH failed."
if [ -d "$EXTRACTED_PATH" ]; then
# cd "$HOME" || customExit "cd \"$HOME\" failed."
if [ -d "$INSTALL_PATH" ]; then
if [ -d "$INSTALL_PATH.$old_version" ]; then
customExit "You already have an old copy of \"$INSTALL_PATH.$old_version\". You must rename it or backup your world and other data then remove it before proceeding."
fi
if [ ! -f "`command -v basename`" ]; then
customExit "Install cannot continue because the basename command is not present."
fi
if [ ! -f "`command -v find`" ]; then
customExit "Install cannot continue because the find command is not present."
fi
mv "$INSTALL_PATH" "$INSTALL_PATH.$old_version"
mv "$EXTRACTED_PATH" "$INSTALL_PATH"
upgradeAndMerge "games"
upgradeAndMerge "worlds"
upgradeAndMerge "mods"
if [ -f "$INSTALL_PATH.$old_version/minetest.conf" ]; then
mv "$INSTALL_PATH.$old_version/minetest.conf" "$INSTALL_PATH/minetest.conf"
fi
else
mv "$EXTRACTED_PATH" "$INSTALL_PATH"
fi
# curl https://downloads.minetest.org/release.txt -o "$INSTALL_PATH/release.txt"
else
customExit "Extracting \"$DL_PATH\" did not result in $EXTRACTED_PATH."
fi
echo "Installing Final Minetest $version to $INSTALL_PATH is complete."

187
install-mts.sh

@ -6,9 +6,13 @@ echo
echo "Starting install..." echo "Starting install..."
MY_NAME="install-mts.sh" MY_NAME="install-mts.sh"
EM_CONFIG_PATH="$HOME/.config/EnlivenMinetest" EM_CONFIG_PATH="$HOME/.config/EnlivenMinetest"
date date
customDie() {
customExit() {
errorCode=1
if [ ! -z "$2" ]; then
errorCode="$2"
fi
cat <<END cat <<END
ERROR: ERROR:
@ -16,8 +20,11 @@ $1
END END
exit 1 exit $errorCode
} }
customWarn() { customWarn() {
cat <<END cat <<END
@ -40,22 +47,91 @@ END
sleep 1 sleep 1
} }
install_shortcut(){
enable_clear_icon_cache=false
_SRC_SHORTCUT_PATH=$1
_DST_SHORTCUT_NAME=$2
# _CAPTION is optional (original "Name" is kept if not specified)
_EXEC=$3
_WORKING_DIR=$4
_ICON=$5
_CAPTION=$6
dest_icons=$HOME/.local/share/applications
dest_icon=$dest_icons/$_DST_SHORTCUT_NAME
if [ ! -d "$dest_icons" ]; then
mdkir -p "$dest_icons" || customExit "mkdir -p \"$dest_icons\" failed."
fi
# if [ -f "$dest_icon" ]; then
# comment since never fixes broken icon anyway
# TODO: fixed bad cache even if icon was rewritten properly after written improperly
# * not tried yet:
# * rm $HOME/.kde/share/config/kdeglobals
# enable_clear_icon_cache=true
# fi
echo "Writing icon '$dest_icon'..."
if [ ! -z "$_ICON" ]; then
cat "$_SRC_SHORTCUT_PATH" | grep -v Icon | grep -v Path | grep -v Exec > "$dest_icon"
else
cat "$_SRC_SHORTCUT_PATH" | grep -v Path | grep -v Exec > "$dest_icon"
fi
# Icon must be an absolute path (other variables use $HOME in
# desktop file above), so exclude it above and rewrite it below:
echo "Path=$dest_programs/minetest/bin" >> "$dest_icon"
if [ ! -z "$_ICON" ]; then
echo "Icon=$_ICON" >> "$dest_icon"
fi
echo "Exec=$_EXEC" >> "$dest_icon"
if [ "@$enable_clear_icon_cache" = "@true" ]; then
if [ -f "`command -v gnome-shell`" ]; then
echo "Refreshing Gnome icons..."
gnome-shell --replace & disown
sleep 10
fi
if [ -f "$HOME/.cache/icon-cache.kcache" ]; then
echo "clearing $HOME/.cache/icon-cache.kcache..."
rm $HOME/.cache/icon-cache.kcache
fi
if [ -f "`command -v kquitapp5`" ]; then
echo "Refreshing KDE icons..."
if [ "`command -v kstart5`" ]; then
kquitapp5 plasmashell && kstart5 plasmashell
else
kquitapp5 plasmashell && kstart plasmashell
fi
sleep 15
fi
if [ -f "`command -v xfce4-panel`" ]; then
echo "Refreshing Xfce icons..."
xfce4-panel -r && xfwm4 --replace
sleep 5
fi
if [ -f "`command -v lxpanelctl`" ]; then
echo "Refreshing LXDE icons..."
lxpanelctl restart && openbox --restart
sleep 5
fi
fi
}
# ^ same as install-minetest-linux64.sh
install_git_mod_here(){ install_git_mod_here(){
git_url="$1" git_url="$1"
mod_name="$2" mod_name="$2"
if [ -z "$git_url" ]; then if [ -z "$git_url" ]; then
customDie "install_git_mod_here requires a URL." customExit "install_git_mod_here requires a URL."
fi fi
if [ -z "$mod_name" ]; then if [ -z "$mod_name" ]; then
customDie "install_git_mod_here requires a mod name as the second parameter." customExit "install_git_mod_here requires a mod name as the second parameter."
fi fi
if [ ! -d "$mod_name" ]; then if [ ! -d "$mod_name" ]; then
git clone "$git_url" "$mod_name" git clone "$git_url" "$mod_name"
else else
cd "$mod_name" || customDie "(install_git_mod_here) 'cd \"$mod_name\"' failed in '`pwd`'" cd "$mod_name" || customExit "(install_git_mod_here) 'cd \"$mod_name\"' failed in '`pwd`'"
echo "* updating '`pwd`' from git..." echo "* updating '`pwd`' from git..."
git pull || echo "WARNING: (install_git_mod_here) 'git pull' failed in '`pwd`'" git pull || echo "WARNING: (install_git_mod_here) 'git pull' failed in '`pwd`'"
cd .. || customDie "(install_git_mod_here) 'cd ..' failed in '`pwd`'" cd .. || customExit "(install_git_mod_here) 'cd ..' failed in '`pwd`'"
fi fi
} }
enable_server=true enable_server=true
@ -64,7 +140,7 @@ dest_programs="$HOME"
#TODO: change $HOME/i_am_dedicated_minetest_server to $HOME/.config/EnlivenMinetest/i_am_dedicated_minetest_server or rc file #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" extracted_name="linux-minetest-kit"
extracted_path="$EM_CONFIG_PATH/$extracted_name" extracted_path="$EM_CONFIG_PATH/$extracted_name"
cd "$EM_CONFIG_PATH" || customDie "[$MY_NAME] cd \"$EM_CONFIG_PATH\" failed." cd "$EM_CONFIG_PATH" || customExit "[$MY_NAME] cd \"$EM_CONFIG_PATH\" failed."
flag_dir_rel="$extracted_name/mtsrc" flag_dir_rel="$extracted_name/mtsrc"
code_flag_dir_path="$extracted_path/mtsrc" code_flag_dir_path="$extracted_path/mtsrc"
if [ -z "$CUSTOM_SCRIPTS_PATH" ]; then if [ -z "$CUSTOM_SCRIPTS_PATH" ]; then
@ -107,7 +183,7 @@ else
echo " (can contain settings such as enable_run_after_compile=true)" echo " (can contain settings such as enable_run_after_compile=true)"
fi fi
pushd "$extracted_path" || customDie "pushd \"$extracted_path\" failed in \"`pwd`\"" pushd "$extracted_path" || customExit "pushd \"$extracted_path\" failed in \"`pwd`\""
extra_options="" extra_options=""
for var in "$@" for var in "$@"
@ -119,7 +195,7 @@ do
elif [ "@$var" = "@--noclean" ]; then elif [ "@$var" = "@--noclean" ]; then
enable_clean=false enable_clean=false
else else
customDie "Invalid argument: $var" customExit "Invalid argument: $var"
fi fi
done done
@ -198,7 +274,7 @@ END
fi fi
start=`date +%s` start=`date +%s`
cd "$extracted_path" || customDie "cd \"$extracted_path\" failed." cd "$extracted_path" || customExit "cd \"$extracted_path\" failed."
if [ -f "mtcompile-program.pl" ]; then if [ -f "mtcompile-program.pl" ]; then
# perl mtcompile-program.pl build >& program.log # perl mtcompile-program.pl build >& program.log
echo "Compiling via perl (this may take a while--output redirected to `pwd`/program.log)..." echo "Compiling via perl (this may take a while--output redirected to `pwd`/program.log)..."
@ -225,16 +301,16 @@ else
echo "* using existing $extracted_path/minetest..." echo "* using existing $extracted_path/minetest..."
fi fi
if [ ! -f "$this_src_flag_path" ]; then if [ ! -f "$this_src_flag_path" ]; then
customDie "The build did not complete since '$this_src_flag_path' is missing. Maybe you didn't compile the libraries. Running reset-minetest-install-source.sh should do that automatically, but you can also do: cd $extracted_path && ./mtcompile-libraries.sh build" customExit "The build did not complete since '$this_src_flag_path' is missing. Maybe you didn't compile the libraries. Running reset-minetest-install-source.sh should do that automatically, but you can also do: cd $extracted_path && ./mtcompile-libraries.sh build"
fi fi
if [ -f "$this_dst_flag_path" ]; then if [ -f "$this_dst_flag_path" ]; then
mv -f "$this_dst_flag_path" "$this_dst_flag_path.bak" mv -f "$this_dst_flag_path" "$this_dst_flag_path.bak"
fi fi
if [ -f "$this_dst_flag_path" ]; then if [ -f "$this_dst_flag_path" ]; then
customDie "Install is incomplete because it can't move '$this_dst_flag_path'." customExit "Install is incomplete because it can't move '$this_dst_flag_path'."
fi fi
if [ ! -d "$extracted_path/minetest" ]; then if [ ! -d "$extracted_path/minetest" ]; then
customDie "Install is incomplete because \"$extracted_path/minetest\" is missing." customExit "Install is incomplete because \"$extracted_path/minetest\" is missing."
fi fi
virtual_dest="$dest_programs/minetest" virtual_dest="$dest_programs/minetest"
link_target=`readlink $virtual_dest` link_target=`readlink $virtual_dest`
@ -256,7 +332,7 @@ if [ "@$enable_clean" = "@true" ]; then
if [ -d "$skins_dst" ]; then if [ -d "$skins_dst" ]; then
echo " - Backing up '$skins_dst' to '$skins_bak'..." echo " - Backing up '$skins_dst' to '$skins_bak'..."
if [ ! -d "$skins_bak" ]; then if [ ! -d "$skins_bak" ]; then
mkdir -p "$skins_bak" || customDie "* cannot create $skins_bak" mkdir -p "$skins_bak" || customExit "* cannot create $skins_bak"
fi fi
rsync -rt "$skins_dst/" "$skins_bak" rsync -rt "$skins_dst/" "$skins_bak"
fi fi
@ -264,7 +340,7 @@ if [ "@$enable_clean" = "@true" ]; then
do do
if [ -d "$dest_enliven_mods/$var" ]; then if [ -d "$dest_enliven_mods/$var" ]; then
echo " - erasing '$dest_enliven_mods/$var'..." echo " - erasing '$dest_enliven_mods/$var'..."
rm -Rf "$dest_enliven_mods/$var" || customDie "rm -Rf \"$dest_enliven_mods/$var\" failed" rm -Rf "$dest_enliven_mods/$var" || customExit "rm -Rf \"$dest_enliven_mods/$var\" failed"
# See rsync further down for installation of each of these # See rsync further down for installation of each of these
else else
echo " - already clean: no '$dest_enliven_mods/$var'..." echo " - already clean: no '$dest_enliven_mods/$var'..."
@ -275,7 +351,7 @@ fi
enliven_warning="" enliven_warning=""
if [ -d "$dest_enliven_mods" ]; then if [ -d "$dest_enliven_mods" ]; then
pushd "$dest_enliven_mods" || customDie "'pushd \"$dest_enliven_mods\"' failed." pushd "$dest_enliven_mods" || customExit "'pushd \"$dest_enliven_mods\"' failed."
install_git_mod_here https://github.com/BenjieFiftysix/sponge.git sponge install_git_mod_here https://github.com/BenjieFiftysix/sponge.git sponge
install_git_mod_here https://github.com/poikilos/metatools.git metatools install_git_mod_here https://github.com/poikilos/metatools.git metatools
install_git_mod_here https://github.com/MinetestForFun/fishing.git fishing install_git_mod_here https://github.com/MinetestForFun/fishing.git fishing
@ -283,7 +359,7 @@ if [ -d "$dest_enliven_mods" ]; then
install_git_mod_here https://github.com/minetest-mods/ccompass.git ccompass install_git_mod_here https://github.com/minetest-mods/ccompass.git ccompass
install_git_mod_here https://github.com/minetest-mods/throwing_arrows.git throwing_arrows install_git_mod_here https://github.com/minetest-mods/throwing_arrows.git throwing_arrows
popd || customDie "'popd' failed." popd || customExit "'popd' failed."
else else
enliven_warning="$enliven_warning* WARNING: Installing ENLIVEN mods was skipped since '$dest_enliven_mods' does not exist." enliven_warning="$enliven_warning* WARNING: Installing ENLIVEN mods was skipped since '$dest_enliven_mods' does not exist."
fi fi
@ -292,22 +368,22 @@ if [ ! -z "$link_target" ]; then
echo "* detected that $virtual_dest is a symlink to $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 " (redirecting rsync to prevent symlink to dir conversion: installing to $install_dest"
echo " and recreating symlink '$virtual_dest' pointing to '$install_dest')..." echo " and recreating symlink '$virtual_dest' pointing to '$install_dest')..."
rsync -rt "$extracted_path/minetest/" "$install_dest" || customDie "Cannot rsync files from installer data $extracted_path/minetest/ to $install_dest" rsync -rt "$extracted_path/minetest/" "$install_dest" || customExit "Cannot rsync files from installer data $extracted_path/minetest/ to $install_dest"
if [ ! -d "$dest_programs/minetest" ]; then if [ ! -d "$dest_programs/minetest" ]; then
echo "* creating link to $install_dest directory as $dest_programs/minetest..." echo "* creating link to $install_dest directory as $dest_programs/minetest..."
ln -s "$install_dest" "$dest_programs/minetest" ln -s "$install_dest" "$dest_programs/minetest"
fi fi
else else
echo "Installing \"$extracted_path/minetest\" directory to \"$dest_programs\"..." echo "Installing \"$extracted_path/minetest\" directory to \"$dest_programs\"..."
rsync -rt --info=progress2 $extracted_path/minetest/ $install_dest || customDie "Cannot rsync files from installer data $extracted_path/minetest/ to $install_dest" rsync -rt --info=progress2 $extracted_path/minetest/ $install_dest || customExit "Cannot rsync files from installer data $extracted_path/minetest/ to $install_dest"
fi fi
if [ ! -f "$this_dst_flag_path" ]; then if [ ! -f "$this_dst_flag_path" ]; then
customDie "ERROR: not complete--couldn't install binary as '$this_dst_flag_path'" customExit "ERROR: not complete--couldn't install binary as '$this_dst_flag_path'"
fi fi
dst_game_flag_dir_path="$dest_official_game" dst_game_flag_dir_path="$dest_official_game"
if [ ! -d "$dst_game_flag_dir_path" ]; then if [ ! -d "$dst_game_flag_dir_path" ]; then
customDie "ERROR: missing $dst_game_flag_dir_path" customExit "ERROR: missing $dst_game_flag_dir_path"
fi fi
if [ ! -d "$dest_programs/minetest/games/ENLIVEN" ]; then if [ ! -d "$dest_programs/minetest/games/ENLIVEN" ]; then
echo "Copying $dst_game_flag_dir_path to $dest_programs/minetest/games/ENLIVEN..." echo "Copying $dst_game_flag_dir_path to $dest_programs/minetest/games/ENLIVEN..."
@ -361,9 +437,9 @@ game_minetest_conf_dest="$dest_programs/minetest/games/ENLIVEN/minetest.conf"
client_example_dest="$dest_programs/minetest/minetest.ENLIVEN.client-example.conf" client_example_dest="$dest_programs/minetest/minetest.ENLIVEN.client-example.conf"
echo "Installing minetest.ENLIVEN.*-example.conf files..." echo "Installing minetest.ENLIVEN.*-example.conf files..."
cp -f "$PATCHES_PATH/subgame/minetest.LAN-client-example.conf" "$dest_programs/minetest/minetest.ENLIVEN.LAN-client-example.conf" || customDie "Cannot copy minetest.ENLIVEN.LAN-client-example.conf" cp -f "$PATCHES_PATH/subgame/minetest.LAN-client-example.conf" "$dest_programs/minetest/minetest.ENLIVEN.LAN-client-example.conf" || customExit "Cannot copy minetest.ENLIVEN.LAN-client-example.conf"
cp -f "$PATCHES_PATH/subgame/minetest.server-example.conf" "$dest_programs/minetest/minetest.ENLIVEN.server-example.conf" || customDie "Cannot copy minetest.ENLIVEN.server-example.conf" cp -f "$PATCHES_PATH/subgame/minetest.server-example.conf" "$dest_programs/minetest/minetest.ENLIVEN.server-example.conf" || customExit "Cannot copy minetest.ENLIVEN.server-example.conf"
cp -f "$PATCHES_PATH/subgame/minetest.client-example.conf" "$dest_programs/minetest/minetest.ENLIVEN.client-example.conf" || customDie "Cannot copy minetest.ENLIVEN.client-example.conf" cp -f "$PATCHES_PATH/subgame/minetest.client-example.conf" "$dest_programs/minetest/minetest.ENLIVEN.client-example.conf" || customExit "Cannot copy minetest.ENLIVEN.client-example.conf"
echo "Writing '$game_minetest_conf_dest'..." echo "Writing '$game_minetest_conf_dest'..."
cp -f "$PATCHES_PATH/subgame/minetest.conf" "$game_minetest_conf_dest" cp -f "$PATCHES_PATH/subgame/minetest.conf" "$game_minetest_conf_dest"
@ -379,9 +455,9 @@ if [ ! -f "$minetest_conf_dest" ]; then
# fi # fi
# fi # fi
echo "Writing minetest.conf (client region)..." echo "Writing minetest.conf (client region)..."
cp -f "$PATCHES_PATH/subgame/minetest.client-example.conf" "$minetest_conf_dest" || customDie "Cannot copy minetest.client-example.conf to $minetest_conf_dest" cp -f "$PATCHES_PATH/subgame/minetest.client-example.conf" "$minetest_conf_dest" || customExit "Cannot copy minetest.client-example.conf to $minetest_conf_dest"
echo "Appending example settings (server region) to '$minetest_conf_dest'..." echo "Appending example settings (server region) to '$minetest_conf_dest'..."
cat "$PATCHES_PATH/subgame/minetest.server-example.conf" >> "$minetest_conf_dest" || customDie "Cannot append minetest.server-example.conf" cat "$PATCHES_PATH/subgame/minetest.server-example.conf" >> "$minetest_conf_dest" || customExit "Cannot append minetest.server-example.conf"
else else
echo "$minetest_conf_dest exists (remove it if you want the installer to write an example version)" echo "$minetest_conf_dest exists (remove it if you want the installer to write an example version)"
fi fi
@ -433,54 +509,15 @@ if [ -d "$world_override_dst" ]; then
fi fi
enable_clear_icon_cache=false
if [ "@$ENABLE_CLIENT" = "@true" ]; then if [ "@$ENABLE_CLIENT" = "@true" ]; then
dest_icons=$HOME/.local/share/applications #params: _SRC_SHORTCUT_PATH, _DST_SHORTCUT_NAME, _EXEC, _WORKING_DIR, _ICON, _CAPTION:
dest_icon=$dest_icons/org.minetest.minetest.desktop SHORTCUT_PATH="$PATCHES_PATH/deploy-patched/misc/org.minetest.minetest.desktop"
# if [ -f "$dest_icon" ]; then EXEC_PATH="$dest_programs/minetest/bin/minetest"
# comment since never fixes broken icon anyway WORKING_DIR_PATH="$dest_programs/minetest/bin"
# TODO: fixed bad cache even if icon was rewritten properly after written improperly MT_ICON="$dest_programs/minetest/misc/minetest-xorg-icon-128.png"
# * not tried yet: install_shortcut "$SHORTCUT_PATH" "org.minetest.minetest.desktop" "$EXEC_PATH" "$WORKING_DIR_PATH" "$MT_ICON" "Final Minetest"
# * rm $HOME/.kde/share/config/kdeglobals
# enable_clear_icon_cache=true
# fi
echo "Writing icon '$dest_icon'..."
cat "$PATCHES_PATH/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=$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..."
gnome-shell --replace & disown
sleep 10
fi
if [ -f "$HOME/.cache/icon-cache.kcache" ]; then
echo "clearing $HOME/.cache/icon-cache.kcache..."
rm $HOME/.cache/icon-cache.kcache
fi
if [ -f "`command -v kquitapp5`" ]; then
echo "Refreshing KDE icons..."
if [ "`command -v kstart5`" ]; then
kquitapp5 plasmashell && kstart5 plasmashell
else
kquitapp5 plasmashell && kstart plasmashell
fi
sleep 15
fi
if [ -f "`command -v xfce4-panel`" ]; then
echo "Refreshing Xfce icons..."
xfce4-panel -r && xfwm4 --replace
sleep 5
fi
if [ -f "`command -v lxpanelctl`" ]; then
echo "Refreshing LXDE icons..."
lxpanelctl restart && openbox --restart
sleep 5
fi
fi
fi fi
if [ -f $dest_programs/minetest/games/ENLIVEN/mods/codermobs/codermobs/animal_materials.lua ]; then if [ -f $dest_programs/minetest/games/ENLIVEN/mods/codermobs/codermobs/animal_materials.lua ]; then
@ -553,7 +590,7 @@ if [ "@$enable_run_after_compile" = "@true" ]; then
echo "Trying to run minetest or other custom post-install script" echo "Trying to run minetest or other custom post-install script"
echo "(enable_run_after_compile is true in '$scripting_rc_path')." echo "(enable_run_after_compile is true in '$scripting_rc_path')."
if [ -d "$CUSTOM_SCRIPTS_PATH" ]; then if [ -d "$CUSTOM_SCRIPTS_PATH" ]; then
cd "$CUSTOM_SCRIPTS_PATH" || customDie "cd $CUSTOM_SCRIPTS_PATH failed." cd "$CUSTOM_SCRIPTS_PATH" || customExit "cd $CUSTOM_SCRIPTS_PATH failed."
if [ -f "$MT_POST_INSTALL_SCRIPT_1" ]; then if [ -f "$MT_POST_INSTALL_SCRIPT_1" ]; then
./$MT_POST_INSTALL_SCRIPT_1 ./$MT_POST_INSTALL_SCRIPT_1
echo "NOTE: if you put $MT_POST_INSTALL_SCRIPT_1" echo "NOTE: if you put $MT_POST_INSTALL_SCRIPT_1"

Loading…
Cancel
Save