/
postinst
117 lines (85 loc) · 3.27 KB
/
postinst
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
#!/bin/bash
if [ ! -e "/usr/local/hestia/data/users/admin" ]; then
exit
fi
###############################################################
# Initialize functions/variables #
###############################################################
source /etc/hestiacp/hestia.conf
# Load upgrade functions and variables
# shellcheck source=/usr/local/hestia/func/main.sh
source $HESTIA/func/main.sh
# shellcheck source=/usr/local/hestia/func/upgrade.sh
source $HESTIA/func/upgrade.sh
source_conf "$HESTIA/conf/hestia.conf"
###############################################################
# Set new version numbers for packages #
###############################################################
# Hestia Control Panel
new_version=$(dpkg -l | awk '$2=="hestia" { print $3 }')
###############################################################
# Begin standard upgrade routines #
###############################################################
# Set default verbose output based on release branch
is_debug_build
# Detect operating system version
detect_os
# Initialize upgrade
prepare_upgrade_config
# Initialize backup directories
upgrade_init_backup
# Initialize logging
upgrade_init_logging
# Check if preinstall hook exists
if [ -e "/etc/hestiacp/hooks/pre_install.sh" ]; then
/etc/hestiacp/hooks/pre_install.sh
fi
# Set up console display and welcome message
upgrade_welcome_message_log >> $LOG
upgrade_welcome_message
# Back up existing configuration files and templates
upgrade_start_backup | tee -a $LOG
# Perform upgrade health check and refresh configuration before upgrading
upgrade_health_check | tee -a $LOG
upgrade_replace_default_config | tee -a $LOG
upgrade_refresh_config | tee -a $LOG
# Execute version-specific upgrade scripts
upgrade_start_routine | tee -a $LOG
# Run upgrades of dependencies
source_conf "$HESTIA_BACKUP/upgrade.conf"
# Update Web domain templates
upgrade_rebuild_web_templates | tee -a $LOG
# Update Mail domain templates
upgrade_rebuild_mail_templates | tee -a $LOG
# Update DNS zone templates
upgrade_rebuild_dns_templates | tee -a $LOG
# Upgrade File Manager and update configuration
upgrade_filemanager | tee -a $LOG
# Upgrade Rainloop if applicable
upgrade_rainloop | tee -a $LOG
# Upgrade Roundcube if applicable
upgrade_roundcube | tee -a $LOG
# Upgrade PHP php dependencies
upgrade_dependencies | tee -a $LOG
# Upgrade phpMyAdmin if applicable
upgrade_phpmyadmin | tee -a $LOG
# Upgrade blackblaze-cli-took if applicable
upgrade_b2_tool | tee -a $LOG
# Set new version number in hestia.conf
upgrade_set_version $new_version
upgrade_set_branch $new_version
# Perform upgrade clean-up tasks (rebuild domains and users, restart services, delete temporary files)
upgrade_cleanup_message | tee -a $LOG
upgrade_rebuild_users | tee -a $LOG
upgrade_restart_services | tee -a $LOG
# Add upgrade notification to admin user's panel and display completion message
upgrade_complete_message_log >> $LOG
upgrade_complete_message
# If setting variables are set to true in hestia.conf, send notifications and email output.
upgrade_send_notification_to_panel
upgrade_send_notification_to_email
upgrade_send_log_to_email
if [ -e "/etc/hestiacp/hooks/post_install.sh" ]; then
/etc/hestiacp/hooks/post_install.sh
fi
exit 0