forked from devryan/GamePanelX-V3-Remote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·86 lines (72 loc) · 2.35 KB
/
update.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
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
#!/bin/bash
#
# GamePanelX
# Remote Scripts v3.0.14
#
# Update Script
#
# Licensed under the GPL (GNU General Public License V3)
#
echo -e "\e[00;34m##################################################################"
echo "## ##"
echo "## GamePanelX ##"
echo "## ##"
echo "## Welcome to the Remote Update Script (v3.0.14) ##"
echo "## ##"
echo -e "##################################################################\e[00m"
echo
remote_version="3.0.14"
if [ "$UID" -ne "0" ]
then
echo "ERROR: You must be the root user to run this script. Exiting."
exit
fi
echo
read -p "This will update the remote scripts to the latest. Continue? (y/n): " sure_upd
if [[ "$sure_upd" == "y" || "$sure_upd" == "yes" || "$sure_upd" == "Y" ]]
then
if [ ! -f ./gpx-remote-latest.tar.gz ]; then
echo "No file ./gpx-remote-latest.tar.gz found, exiting."
exit
fi
tar -zxf ./gpx-remote-latest.tar.gz -C /usr/local/gpx bin/*
else
echo "Not updating, exiting."
exit
fi
sleep 1
##################################################################
# Stop manager
if [ "$(ps -ef | grep 'GPXManager' | grep -v grep)" ]; then
killall GPXManager
fi
# Start manager
/usr/local/gpx/bin/GPXManager
##################################################################
# Set permissions
if [ -f .gpx_lastuser ]
then
gpx_user="$(cat /usr/local/gpx/.gpx_lastuser)"
else
# Get last system GPX user in /etc/passwd
gpx_user="$(grep ':GamePanelX:' /etc/passwd | tail -1 | awk -F: '{print $1}')"
fi
if [ "$gpx_user" == "" ]; then
echo "No gpx user found, exiting."
exit
fi
#chown $gpx_user: /usr/local/gpx -R
#chown root:$gpx_user /usr/local/gpx/users -R
chown root: /usr/local/gpx/ftpd -R
#chmod 0660 /usr/local/gpx/users -R
chmod 0750 /usr/local/gpx/{logs,templates} -R
chmod 0660 /usr/local/gpx/logs/*
#chmod 0700 /usr/local/gpx/{addons,queue,tmp,etc,uploads,users} -R
chmod 0700 /usr/local/gpx/{addons,queue,tmp,etc,uploads} -R
chmod 0760 /usr/local/gpx/queue /usr/local/gpx/tmp
chmod 0774 /usr/local/gpx/users
chmod 0555 /usr/local/gpx/bin
chmod 0754 /usr/local/gpx/bin/*
##################################################################
echo
echo "...done"