This commit is contained in:
Petr Menšík 2023-03-17 18:26:38 +01:00 committed by GitHub
commit 226f884dd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 330 additions and 0 deletions

0
linux/.gitignore vendored Normal file
View file

194
linux/etl-installer Executable file
View file

@ -0,0 +1,194 @@
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Authors: 2014 Remy Marquis <remy.marquis@gmail.com>
# 2021 Petr Menšík <pemensik@fedoraproject.org>
#
# ET:Legacy Linux assets extractor - Download and extract Wolf:ET assets
#
# - Put this script anywhere
# - Run it using bash or sh
# TODO:
# - Add some mirrors
checksums=`mktemp`
cat >$checksums <<'EOF'
41cbbc1afb8438bc8fc74a64a171685550888856005111cbf9af5255f659ae36 et-linux-2.60.x86.run
EOF
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
#
reset="\e[0m"
colorR="\e[1;31m"
colorG="\e[1;32m"
colorY="\e[1;33m"
colorB="\e[1;34m"
note() {
case "$1" in
i) echo -e "${colorB}::${reset} $2";; # info
s) echo -e "${colorG}::${reset} $2";; # success
w) echo -e "${colorY}::${reset} $2";; # question
e) echo -e "${colorR}::${reset} $2"; # error
exit 1;;
esac
}
proceed_sh() {
case $1 in
y) printf "${colorY}%s${reset} ${colorW}%s${reset}" "::" $"$2 [Y/n] "
read -n 1 answer
echo
case $answer in
Y|y|'') return 0;;
*) return 1;;
esac;;
n) printf "${colorY}%s${reset} ${colorW}%s${reset}" "::" $"$2 [y/N] "
read -n 1 answer
echo
case $answer in
N|n|'') return 0;;
*) return 1;;
esac;;
esac
}
proceed_dialog() {
local DEFAULT=
case $1 in
y) "$DIALOG" --yesno "$2" 0 0
return $?;;
n) ! "$DIALOG" --defaultno --yesno "$2" 0 0
return $?;;
esac
}
proceed() {
if [ -x "$DIALOG" ]; then
proceed_dialog "$1" "$2"
else
proceed_sh "$1" "$2"
fi
}
downloader() {
if [ -f /usr/bin/axel ]; then
axel $1
elif [ -f /usr/bin/curl ]; then
curl -LO $1
else
wget $1
fi
}
#
# Main
#
echo -e "${colorB}***********************************************************************${reset}"
echo -e " Enemy Teritorry: Legacy - ${colorG}Wolf:ET assets${reset} Linux installer"
echo -e "${colorB}***********************************************************************${reset}"
echo
# license
note i "W:ET assets are covered by the original EULA"
note i ""
note i "See EULA_Wolfenstein_Enemy_Territory.txt at"
note i "https://github.com/etlegacy/etlegacy-tools/"
echo
# download
note i $"Preparing extraction..."
if [ ! -f "$ET_FILE" ]; then
if [ ! -w . ]; then
note w $"Changing working directory to "/var/tmp"..."
cd /var/tmp
fi
note i $"Fetching W:ET assets data files..."
downloader "http://ftp.gwdg.de/pub/misc/ftp.idsoftware.com/idstuff/et/linux/$ET_FILE"
fi
# checksum
note i "Checking downloaded file..."
sha256sum -c $checksums || note e "Integrity check failed"
# installation
note i $"Extracting license..."
sh "$ET_FILE" --noexec --tar xf 'Docs/EULA_*.txt'
more Docs/EULA_*.txt
if ! proceed "y" $"Do you agree with the EULA?"; then
# User does not agree license, remove downloaded file
rm -f "$ET_FILE"
note e $"Installation exited"
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_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
# cleaning
echo
if ! proceed "n" $"Remove downloaded file archive?"; then
rm -f "$ET_FILE"
fi
# end
echo
echo -e "${colorB}***********************************************************************${reset}"
echo -e " You'll find the assets files in ${colorG}$DSTDIR/etmain${reset}"
echo -e "${colorB}***********************************************************************${reset}"
echo -e " Visit us on ${colorY}www.etlegacy.com${reset} and ${colorY}IRC #etlegacy@freenode.net${reset}"
echo -e "${colorB}***********************************************************************${reset}"

81
linux/etl-launcher Executable file
View file

@ -0,0 +1,81 @@
#!/bin/sh
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Authors: 2021 Petr Menšík <pemensik@fedoraproject.org>
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"
}
# First option argument is variant. Others are passed to the executable
start_game() {
local VARIANT="${1:-}"
[ "$#" -gt 0 ] && shift
exec /usr/bin/etl${VARIANT} "$@"
}
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
[ -L "$ETHOME/$PAK" ] && rm "$ETHOME/$PAK"
for DIR in /usr{,/local}{,/games}/enemy-territory/ $ETHOME
do
[ "$DEBUG" = y ] && echo "Checking $DIR/$PAK"
if [ -f "$DIR/$PAK" ] && ! [ -L "$DIR/$PAK" ]; then
FOUNDPAK=Y
echo "Found $DIR/$PAK"
(cd $ETMAIN && ln -vs "$DIR/$PAK")
fi
done
else
FOUNDPAK=Y
fi
done
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
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>