forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostinst
More file actions
executable file
·66 lines (52 loc) · 1.72 KB
/
postinst
File metadata and controls
executable file
·66 lines (52 loc) · 1.72 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
#!/bin/bash
set -e
if [ "$1" != "configure" ]; then
exit 0
fi
# Run triggers only on updates
if [ ! -e "/usr/local/hestia/data/users/" ]; then
exit
fi
# Prevent running and causes issues with outdated hestia version
if ! id "hestiaweb" &> /dev/null; then
exit
fi
# Touch and set permisions on default log files on installation
update-rc.d hestia defaults > /dev/null
invoke-rc.d hestia start || true
# Adapt Port Listing in HESTIA NGINX Backend
source /usr/local/hestia/func/syshealth.sh # Load syshealth functions
# Check if the function syshealth_adapt_hestia_nginx_listen_ports exists
if ! declare -f syshealth_adapt_hestia_nginx_listen_ports > /dev/null; then
exit
fi
syshealth_adapt_hestia_nginx_listen_ports # Adapt port listing
syshealth_adapt_nginx_resolver
###############################################################
# Initialize functions/variables #
###############################################################
if [ -z "$HESTIA" ]; then
export HESTIA='/usr/local/hestia'
PATH=$PATH:/usr/local/hestia/bin
export PATH
fi
# Check if preinstall hook exists
if [ -e "/etc/hestiacp/hooks/nginx/pre_install.sh" ]; then
/etc/hestiacp/hooks/nginx/pre_install.sh
fi
# Load upgrade functions and variables
source /usr/local/hestia/func/main.sh
source /usr/local/hestia/func/upgrade.sh
source /usr/local/hestia/conf/hestia.conf
source /usr/local/hestia/install/upgrade/upgrade.conf
# Reset backend port
if [ -n "$BACKEND_PORT" ]; then
/usr/local/hestia/bin/v-change-sys-port $BACKEND_PORT
fi
if [ -e "/etc/hestiacp/hooks/nginx/post_install.sh" ]; then
/etc/hestiacp/hooks/nginx/post_install.sh
fi
# Restart hestia service
if [ -f "/etc/init.d/hestia" ]; then
systemctl restart hestia > /dev/null 2>&1
fi