More integration of etl-launcher and etl-installer

Installer would prepare all symlinks in sudo mode, etl-launcher should
not be necessary after it. Include also data instruction HTML.
This commit is contained in:
Petr Menšík 2021-10-26 00:07:43 +02:00
parent 65bc3af058
commit 1a5b469791
3 changed files with 115 additions and 14 deletions

View file

@ -32,6 +32,7 @@ DIALOG=$(type -p dialog 2>/dev/null)
SUDO=$(type -p sudo 2>/dev/null)
ET_FILE=et-linux-2.60.x86.run
DSTDIR="$HOME/.etlegacy"
SYSTEM_ET_DIR="/usr/local/games/enemy-territory"
#
# Tools
@ -105,7 +106,7 @@ downloader() {
#
echo -e "${colorB}***********************************************************************${reset}"
echo -e " Enemy Teritorry: Legacy - ${colorG}Wolf:ET assets${reset} Linux extractor"
echo -e " Enemy Teritorry: Legacy - ${colorG}Wolf:ET assets${reset} Linux installer"
echo -e "${colorB}***********************************************************************${reset}"
echo
@ -146,19 +147,34 @@ if ! proceed "y" $"Do you agree with the EULA?"; then
note e $"Installation exited"
fi
if [ -x "$SUDO" ]; then
if proceed "n" "Install data for all users (requires sudo rights)?"; then
RUNAS=""
else
RUNAS="$SUDO"
DSTDIR="/usr/local/games/enemy-territory"
fi
if [ -w /usr/local/games ]; then
RUNAS="" # root can write there already
DSTDIR="$SYSTEM_ET_DIR"
elif [ -x "$SUDO" ] && ! proceed "n" "Install data for all users (requires sudo rights)?"; then
RUNAS="$SUDO"
DSTDIR="$SYSTEM_ET_DIR"
else
RUNAS=""
fi
note i $"Extracting assets into "$DSTDIR"..."
# RUNAS is intentionally unqoted
if $RUNAS install -d "$DSTDIR" && $RUNAS sh ./et-linux-2.60.x86.run --noexec --tar xf -C "$DSTDIR" 'etmain/pak*.pk3'
if $RUNAS install -d "$DSTDIR" && $RUNAS sh "$ET_FILE" --noexec --tar xf -C "$DSTDIR" 'etmain/pak*.pk3'
then
note s $"Extraction successful!"
if [ "$DSTDIR" = "$SYSTEM_ET_DIR" ]; then
for DIR in /usr/lib{,64}/etlegacy/etmain
do
if [ -d "$DIR" ]; then
pushd $DIR
for PAK in "$DSTDIR"/etmain/pak*.pk3; do
$RUNAS ln -s "$PAK"
done
popd
fi
done
note s $"Pk3 system symlinks done."
fi
else
note e $"Extraction failed!"
fi
@ -166,7 +182,7 @@ fi
# cleaning
echo
if ! proceed "n" $"Remove downloaded file archive?"; then
rm -i "$ET_FILE"
rm -f "$ET_FILE"
fi
# end

View file

@ -19,10 +19,34 @@ ETHOME="$HOME/.etlegacy"
ETMAIN="$ETHOME/etmain"
FOUNDPAK=
DATAPAGE=/usr/share/etlegacy/etlegacy-data.html
INSTALLER="$(type -p etl-installer 2>/dev/null)"
[ -d "$ETHOME" ] || mkdir -p "$ETHOME"
[ -d "$ETMAIN" ] || mkdir "$ETMAIN"
show_instructions() {
exec xdg-open "$DATAPAGE"
}
start_game() {
exec /usr/bin/etl
}
start_installer() {
if tty 2>/dev/null; then
"$INSTALLER" && return 0
else
# In graphical session, try running it in terminal
# Do not care about errors here
# FIXME: is there better way to run command in terminal? Something like xdg-open?
gnome-terminal --title "ET Legacy data installer" -- "$INSTALLER" && return 0
konsole "$INSTALLER" && return 0
uxterm "$INSTALLER" && return 0
xterm "$INSTALLER" && return 0
fi
return 1
}
for PAK in etmain/pak{0,1,2}.pk3
do
if ! [ -f "$ETHOME/$PAK" ]; then
@ -41,8 +65,14 @@ do
fi
done
if [ -z "$FOUNDPAK" ] && [ -f "$DATAPAGE" ]; then
echo "pak0.pk3 data not found!"
exec xdg-open "$DATAPAGE"
if [ -z "$FOUNDPAK" ]; then
echo "pak[012].pk3 data not found!"
if [ -x "$INSTALLER"]; then
start_installer && start_game
# Would terminate here on success
fi
if [ -f "$DATAPAGE" ]; then
show_instructions
fi
fi
exec /usr/bin/etl
start_game

55
linux/etlegacy-data.html Normal file
View file

@ -0,0 +1,55 @@
<!doctype html>
<head>
<title>ET: Legacy requires data</title>
<style type="text/css">
<!--
h1 { color: #ff2f00 }
body { background-color: black; color: gray; }
-->
</style>
</head>
<body>
<h1>ET: Legacy requires data</h1>
<p>Even when <a href="https://www.etlegacy.com">ET: Legacy</a> is a free software and open-source,
it requires additional data files from original
<a href="https://www.splashdamage.com/games/wolfenstein-enemy-territory/">Wolfenstein: Enemy Territory</a>.
Without the game data this game cannot work.
</p>
<p>Data were not licensed under <a href="https://en.wikipedia.org/wiki/Free-software_license">free software license</a>,
which is a reason we could not ship them to you. Do not worry,
<a href="https://www.splashdamage.com/games/wolfenstein-enemy-territory/">Splash Damage</a> still provides original
game including required data free of charge for non-commercial use.
</p>
<h2>How to install data</h2>
<ol>
<li>Download old from <a href="#download">Splash Damage</a></li>
<li>Use <a href="#packager">game-data-packager</a></li>
<li>Install etlegacy-installer and start it from menu</li>
</ol>
<h3 id="download">Download from Splash Damage</h3>
<ol>
<li>Open <a href="https://www.splashdamage.com/games/wolfenstein-enemy-territory/">Wolfenstein: Enemy Territory</a></li>
<li>Choose Download, Linux Full game</li>
<li>unzip the archive</li>
<li>Open the directory in terminal</li>
<li>sudo sh et260b.x86_keygen_V03.run</li>
<li>Skip etkey creation</li>
<li>Read and accept the license</li>
<li>Use default paths</li>
<li>Choose no to install startup entries</li>
</ol>
<h3 id="packager">Install data using game-data-packager</h3>
<ol>
<li>Install package dame-data-packager</li>
<li>run game-data-packager enemy-territory -i</li>
<li>Ensure you understand and accept the <a href="file:///usr/share/licenses/enemy-territory-data/EULA_Wolfenstein_Enemy_Territory.txt">license</li>
</ol>
</body>