forked from levisjani/fufix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·139 lines (116 loc) · 5.06 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
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
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
cat includes/banner
source includes/versions
source includes/functions.sh
case ${1} in
"-u" | "--upgrade" | "-uu" | "--upgrade-unattended" )
[[ ${1} == "-uu" || ${1} == "--upgrade-unattended" ]] && inst_unattended="yes"
upgradetask
echo ${mailcow_version} > /etc/mailcow_version
echo --------------------------------- >> installer.log
echo UPGRADE to ${mailcow_version} on $(date) >> installer.log
echo --------------------------------- >> installer.log
echo Fail2ban version: ${fail2ban_version} >> installer.log
echo Roundcube version: ${roundcube_version} >> installer.log
echo FuGlu version: ${fuglu_version}
echo --------------------------------- >> installer.log
exit 0
;;
"-h" | "--help" )
usage
exit 0
;;
esac
source mailcow.config
checksystem
checkports
checkconfig
echo " $(textb "Hostname") ${sys_hostname}
$(textb "Domain") ${sys_domain}
$(textb "FQDN") ${sys_hostname}.${sys_domain}
$(textb "Timezone") ${sys_timezone}
$(textb "mailcow MySQL") ${my_mailcowuser}:${my_mailcowpass}@${my_dbhost}/${my_mailcowdb}
$(textb "Roundcube MySQL") ${my_rcuser}:${my_rcpass}@${my_dbhost}/${my_rcdb}
$(textb "mailcow admin user") ${mailcow_admin_user}
"
returnwait "Reading configuration" "System environment"
echo --------------------------------- > installer.log
echo MySQL database host: ${my_dbhost} >> installer.log
echo --------------------------------- >> installer.log
echo Use existing database: ${my_useexisting} >> installer.log
echo --------------------------------- >> installer.log
echo MySQL mailcow database: ${my_mailcowdb} >> installer.log
echo MySQL mailcow username: ${my_mailcowuser} >> installer.log
echo MySQL mailcow password: ${my_mailcowpass} >> installer.log
echo --------------------------------- >> installer.log
echo MySQL Roundcube database: ${my_rcdb} >> installer.log
echo MySQL Roundcube username: ${my_rcuser} >> installer.log
echo MySQL Roundcube password: ${my_rcpass} >> installer.log
echo --------------------------------- >> installer.log
echo Only set when MySQL was not available >> installer.log
echo MySQL root password: ${my_rootpw} >> installer.log
echo --------------------------------- >> installer.log
echo mailcow administrator >> installer.log
echo Username: ${mailcow_admin_user} >> installer.log
echo Password: ${mailcow_admin_pass} >> installer.log
echo --------------------------------- >> installer.log
echo FQDN: ${sys_hostname}.${sys_domain} >> installer.log
echo Timezone: ${sys_timezone} >> installer.log
echo --------------------------------- >> installer.log
echo Web root: https://${sys_hostname}.${sys_domain} >> installer.log
echo DAV web root: https://${httpd_dav_subdomain}.${sys_domain} >> installer.log
echo Autodiscover \(Z-Push\): https://autodiscover.${sys_domain} >> installer.log
echo --------------------------------- >> installer.log
echo Fail2ban version: $fail2ban_version >> installer.log
echo Roundcube version: $roundcube_version >> installer.log
echo FuGlu version: ${fuglu_version} >> installer.log
echo mailcow version: ${mailcow_version} >> installer.log
echo --------------------------------- >> installer.log
installtask environment
returnwait "System environment" "Package installation"
installtask installpackages
returnwait "Package installation" "Self-signed certificate"
installtask ssl
returnwait "Self-signed certificate" "MySQL configuration"
installtask mysql
returnwait "MySQL configuration" "Postfix configuration"
installtask postfix
returnwait "Postfix configuration" "Dovecot configuration"
installtask dovecot
returnwait "Dovecot configuration" "FuGlu configuration"
installtask fuglu
returnwait "FuGlu configuration" "ClamAV configuration"
installtask clamav
returnwait "ClamAV configuration" "Spamassassin configuration"
installtask spamassassin
returnwait "Spamassassin configuration" "Webserver configuration"
installtask webserver
returnwait "Webserver configuration" "Roundcube configuration"
installtask roundcube
returnwait "Roundcube configuration" "Rsyslogd configuration"
installtask rsyslogd
returnwait "Rsyslogd configuration" "Fail2ban configuration"
installtask fail2ban
returnwait "Fail2ban configuration" "OpenDKIM configuration"
installtask opendkim
returnwait "OpenDKIM configuration" "Restarting services"
installtask restartservices
returnwait "Restarting services" "Checking DNS settings"
installtask checkdns
returnwait "Checking DNS settings" "Finish installation"
echo ${mailcow_version} > /etc/mailcow_version
chmod 600 installer.log
echo
echo "`tput setaf 2`Finished installation`tput sgr0`"
echo "Logged credentials and further information to file `tput bold`installer.log`tput sgr0`."
echo
echo "Next steps:"
echo " * Backup installer.log to a safe place and delete it here"
echo " * Open \"https://$sys_hostname.$sys_domain\" and login to mailcow control center as $mailcow_admin_user to create a domain and a mailbox."
echo " * Please do not use port 25 in your mail client, use port 587 instead."
echo " * Setup SPF records!"
echo