forked from metal0/catbot-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-catbots
More file actions
executable file
·165 lines (143 loc) · 5.3 KB
/
install-catbots
File metadata and controls
executable file
·165 lines (143 loc) · 5.3 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env bash
set -e
if [ $EUID == 0 ]; then
echo "This script must not be run as root"
exit
fi
if ! [ -e "/opt/cathook/" ]; then
echo "Please install Cathook on your main TF2, first."
echo "https://github.com/nullworks/cathook"
exit
fi
if [ ! -x "$(command -v touch)" ]; then
echo "Touch doesn't exist. Please install it."
exit
fi
if [ ! -x "$(command -v npm)" ]; then
echo "NPM doesn't exist. Please install it."
exit
fi
if [ ! -d "./cathook" ]; then
git clone --recursive https://github.com/nullworks/cathook
fi
if [ ! -f ./kisak ]; then
echo Generating username and adding groups!
name=$(cat /dev/urandom | tr -dc 'a-z' | fold -w 6 | head -n 1)
echo $name > kisak
sudo groupadd `cat kisak`s
sudo usermod -a -G `cat kisak`s $USER
fi
if ! [ -e "/opt/steamapps" ]; then
steamapps="/home/$USER/.steam/steam/steamapps/"
while true; do
read -p "Is $steamapps your steamapps directory? y/n " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
touch link
sudo ln -s "$steamapps" "/opt/steamapps"
# fuck permissions!!!
sudo chown -h $USER:`cat kisak`s "/opt/steamapps"
sudo chown -R $USER:`cat kisak`s "/opt/steamapps"
sudo chmod -R g+rwx "/opt/steamapps"
sudo chmod +x "/opt"
sudo chmod +x "/opt/steamapps"
sudo chmod -R go+X "$steamapps"
cd $(realpath /opt/steamapps) ; while [ $(pwd) != "/" ]; do echo $(pwd); sudo chmod +x .; cd ..; done
fi
if [ ! -f ./users ]; then
while true; do
re='^[0-9]+$'
read -p "How many bots would you like to host? " yournumber
if [[ $yournumber =~ $re ]] ; then
echo $yournumber > ./users
for i in $(seq 1 $yournumber)
do
if [ -d "/home/`cat kisak`-$i" ]; then
echo "`cat kisak`-$i already exists"
continue
fi
echo "Creating user `cat kisak`-$i"
sudo useradd -m `cat kisak`-$i
sudo usermod -g `cat kisak`s `cat kisak`-$i
sudo mkdir -p /home/`cat kisak`-$i
sudo chown `cat kisak`-$i:`cat kisak`s /home/`cat kisak`-$i
sudo -H -u `cat kisak`-$i bash -c "mkdir -p /home/`cat kisak`-$i/.local/share/Steam"
sudo -H -u `cat kisak`-$i bash -c "ln -s \"/opt/steamapps\" \"/home/`cat kisak`-$i/.local/share/Steam/steamapps\""
sudo -H -u `cat kisak`-$i bash -c "mkdir -p ~/.steam"
sudo -H -u `cat kisak`-$i bash -c "touch ~/.steam/steam_install_agreement.txt"
done
break
fi
echo "Error: Not a number" >&2
done
fi
if [ -f ./users ] && [ ! -f ./steams ]; then
if [ ! -x "$(command -v xhost)" ]; then
echo "XHost doesn't exist. Please install it."
exit
fi
xhost + >/dev/null
for i in $(seq 1 $(cat ./users))
do
echo "Starting Steam for `cat kisak` $i"
sudo su - `cat kisak`-$i -c "DISPLAY=:0 steam &>/tmp/steam-`cat kisak`-$i.log 2>&1 &"
done
read -p "Press enter if all steams have reached the login screen. (This will kill ALL steams) "
touch ./steams
sudo killall steam | true
fi
if [ ! -f /opt/cathook/bin/libcathook-textmode.so ]; then
numcpu=$(grep -c ^processor /proc/cpuinfo)
mkdir -p build
pushd build
cmake -DCMAKE_BUILD_TYPE=Release -DVisuals_DrawType="No Visuals" -DVACBypass=1 -DTextmode=1 -DEnableWarnings=0 -DEnableOnlineFeatures=0 ../cathook/
make -j$numcpu
if ! [ -e "bin/libcathook.so" ]; then
echo "FATAL: Build failed"
exit
fi
popd
sudo mkdir -p "/opt/cathook/bin/"
sudo cp "build/bin/libcathook.so" "/opt/cathook/bin/libcathook-textmode.so"
sudo chmod -R 0755 /opt/cathook/data/configs/
fi
if [ ! -d "./just-disable-vac" ]; then
git clone https://gitlab.com/nullworks/cathook/just-disable-vac
pushd just-disable-vac
mkdir -p build && pushd build
cmake .. && make
popd; popd
fi
if [ ! -d "./account-generator" ]; then
git clone --recursive https://github.com/nullworks/account-generator
pushd account-generator
./install.sh
popd
fi
if [ ! -d "./cathook-ipc-server" ]; then
git clone --recursive https://github.com/nullworks/cathook-ipc-server
pushd cathook-ipc-server
./install.sh
popd
fi
if [ ! -d "./cathook-ipc-web-panel" ]; then
git clone --recursive https://github.com/nullworks/cathook-ipc-web-panel
pushd cathook-ipc-web-panel
./install.sh
popd
fi
if [ ! -d "./cathook-ipc-web-panel/logs" ]; then
mkdir -p ./cathook-ipc-web-panel/logs
touch ./cathook-ipc-web-panel/logs/main.log
fi
echo "Installation finished. Please ensure that all navmashes are inside your map folder (https://github.com/nullworks/catbot-database)."
echo
echo "The web-panel and account storage can be started with ./start"
echo
echo "Accgen is broken due to recent recaptcha updates, as well as us running out of accounts to provide. You must create your own list of accounts to use for catbots."
echo "Create a list of steam accounts, and save them to catbot-setup/accounts.txt in username:password format."
echo "Then use \"node convert.js\" to to format it. Rename the resulting file to accounts.cg.json, and copy it to the account-generator folder."