Created
May 19, 2012 16:31
-
-
Save morsik/2731412 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Author: Konrad Mosoń <morsik@darkserver.it> | |
# Description: Simple Enemy Territory: Legacy installer | |
function m { | |
echo -e " \033[1;31m:\033[38;5;33m:\033[1;37m $1\033[0m" | |
} | |
if [ ! -n "$1" ]; then | |
m "usage: $0 <installdir>" | |
m "installdir - directory where you want to install et" | |
exit 1 | |
fi | |
# functions | |
progressfilt() { | |
local flag=false c count cr=$'\r' nl=$'\n' | |
while IFS='' read -d '' -rn 1 c | |
do | |
if $flag; then | |
printf '%c' "$c" | |
else | |
if [[ $c != $cr && $c != $nl ]]; then | |
count=0 | |
else | |
((count++)) | |
if ((count > 1)); then | |
flag=true | |
fi | |
fi | |
fi | |
done | |
} | |
dl() { | |
m "Downloading $1" | |
if [ -n "$2" ]; then | |
wget --progress=bar:force "$1" -O "$2" 2>&1 | progressfilt | |
else | |
wget --progress=bar:force "$1" 2>&1 | progressfilt | |
fi | |
} | |
#e=echo # debug? | |
# main code | |
$e mkdir $1 | |
$e cd $1 | |
m "downloading et i686..." | |
$e dl "http://files.et.darkserver.it/bin/etl" | |
$e dl "http://files.et.darkserver.it/bin/etlded" | |
m "downloading needed pk3 files..." | |
$e mkdir etmain | |
$e cd etmain | |
$e dl "http://files.gamestats.darkserver.it/etmain/pak0.pk3" | |
$e dl "http://files.gamestats.darkserver.it/etmain/pak1.pk3" | |
$e dl "http://files.gamestats.darkserver.it/etmain/pak2.pk3" | |
$e dl "http://files.gamestats.darkserver.it/etmain/mp_bin.pk3" | |
m "checking for etkey..." | |
$e mkdir -p ~/.etwolf/etmain | |
if [ -e ~/.etwolf/etmain/etkey ]; then | |
m " file already exists" | |
else | |
m " getting new etkey..." | |
$e dl http://etkey.org/etkey.php -O ~/.etwolf/etmain/etkey | |
fi | |
m "done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment