This repository has been archived by the owner on Feb 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·83 lines (69 loc) · 1.77 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
FILE='bf2-linuxded-1.5.3153.0-installer.sh';
URL='http://media1.gamefront.com/patches_scrolls/Battlefield2/bf2-linuxded-1.5.3153.0-installer.sh';
SHA256="b5afe6602280b99797b46389f3cd582bbfe212e7402c8b009b72e6ae41e8d435 $FILE";
ALTEREDSHA256="3ee58e4f490f3bd81f15796e6364441a16ebd3b03ad78b42649ddc6f397bdd08 $FILE";
ALREADYALTERED='n';
echo -e "Installing the unlock patched Battlefield 2 Dedicated Server."
if [ -f $FILE ];
then
FILESIZE=$(stat -c%s "$FILE")
if [[ $FILESIZE -lt '330900000' ]];
then
echo -e "Partially installed file found. Attempting redownload.";
wget -c $URL;
fi
fi
if [ ! -f $FILE ];
then
echo -e "Server installer not found, downloading.";
wget $URL;
fi
if [ ! -f $FILE ];
then
echo -e "File download failed. Exiting.";
exit 1;
fi
SHA256SUM=$(sha256sum $FILE);
if [[ $SHA256SUM != $SHA256 ]];
then
if [[ $SHA256SUM != $ALTEREDSHA256 ]];
then
echo -e "SHA256 sums mismatch! Delete the one you have, and rerun this script.";
exit 1;
fi
fi
if [[ $SHA256SUM == $ALTEREDSHA256 ]];
then
ALREADYALTERED='y'
fi
echo -e "Installer located and verified. Patching installer.";
if [[ $ALREADYALTERED == 'n' ]];
then
patch -u $FILE data/installer.patch
fi
/bin/bash $FILE
if [[ $? != 0 ]];
then
echo "Installation failed. Exiting.";
exit 1;
fi
echo -e "Need sudo rights to add entry into /etc/hosts. You need this for the unlock server to work.\nDo you want the entry? [y/n]"
while true;
do
read yn
if [[ $yn == 'y' ]];
then
sudo sh -c "/bin/echo -e '127.0.0.1\tbf2web.gamespy.com' >> /etc/hosts";
echo -e 'Entry added.';
echo -e 'Installation completed.';
exit 0
fi;
if [[ $yn == 'n' ]];
then
echo -e 'Installation completed.';
exit 0
fi;
echo -e 'Try again [y/n]:'
done
exit 0;