dfhack/travis/download-df.sh

47 lines
1.0 KiB
Bash

2018-02-03 21:01:15 -07:00
#!/bin/sh
tardest="df.tar.bz2"
2018-02-03 21:56:44 -07:00
which md5sum && alias md5=md5sum
selfmd5=$(openssl md5 < "$0")
echo $selfmd5
2018-02-03 21:01:15 -07:00
cd "$(dirname "$0")"
echo "DF_VERSION: $DF_VERSION"
echo "DF_FOLDER: $DF_FOLDER"
mkdir -p "$DF_FOLDER"
# back out of df_linux
2019-01-02 17:15:19 -07:00
cd "$DF_FOLDER/.."
2018-02-03 21:01:15 -07:00
2018-02-04 00:13:20 -07:00
if [ -f receipt ]; then
if [ "$selfmd5" != "$(cat receipt)" ]; then
2018-02-03 21:56:44 -07:00
echo "download-df.sh changed; removing DF"
2018-12-30 15:47:10 -07:00
rm receipt
2018-02-03 21:56:44 -07:00
else
echo "Already downloaded $DF_VERSION"
fi
2018-02-03 21:01:15 -07:00
fi
2018-12-30 15:47:10 -07:00
if [ ! -f receipt ]; then
rm -f "$tardest"
minor=$(echo "$DF_VERSION" | cut -d. -f2)
patch=$(echo "$DF_VERSION" | cut -d. -f3)
url="http://www.bay12games.com/dwarves/df_${minor}_${patch}_linux.tar.bz2"
echo Downloading
wget "$url" -O "$tardest"
fi
2018-02-03 21:01:15 -07:00
2018-12-30 15:47:10 -07:00
rm -rf df_linux
mkdir df_linux
2018-02-03 21:01:15 -07:00
echo Extracting
2018-12-30 15:47:10 -07:00
tar xf "$tardest" --strip-components=1 -C df_linux
2018-02-03 21:56:44 -07:00
echo Changing settings
echo '' >> "df_linux/data/init/init.txt"
echo '[PRINT_MODE:TEXT]' >> "df_linux/data/init/init.txt"
echo '[SOUND:NO]' >> "df_linux/data/init/init.txt"
2018-02-03 21:01:15 -07:00
echo Done
2018-02-03 21:56:44 -07:00
echo "$selfmd5" > receipt
2018-12-30 15:47:10 -07:00
ls