-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
install.sh
50 lines (41 loc) · 1.04 KB
/
install.sh
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
#!/bin/bash
repoitem="Joystick"
repopath=$(readlink -f "$0")
repopath=$(dirname "$repopath")
gmodpath=$(dirname "$repopath")
gmodpath=$(dirname "$gmodpath")
boolrvar=""
read -p "Install joystick module [y/N]?" boolrvar
if test "$boolrvar" == "y"
then
rm -rf "${gmodpath}/addons/${repoitem}"
cd "${gmodpath}/lua/bin/"
rm -f gmcl_joystick_*.dll
else
if test "$boolrvar" == "Y"
then
rm -rf "${gmodpath}/addons/${repoitem}"
cd "${gmodpath}/lua/bin/"
rm -f gmcl_joystick_*.dll
fi
fi
# Copy files relative to base /garrysmod/ folder
cd ${gmodpath}
[ ! -d "$gmodpath/lua" ] && mkdir -p "$gmodpath/lua"
[ ! -d "$gmodpath/lua/bin" ] && mkdir -p "$gmodpath/lua/bin"
cp -rfp $repopath/addons/. $gmodpath/addons
cp -rfp $repopath/lua/bin/. $gmodpath/lua/bin
echo "Joystick module has been installed!"
read -p "Remove the cloned repository [y/N]?" boolrvar
if test "$boolrvar" == "y"
then
rm -rf "$repopath"
else
if test "$boolrvar" == "Y"
then
rm -rf "$repopath"
else
echo "Please remove the cloned repo manually!"
fi
fi
exit 0