-
Notifications
You must be signed in to change notification settings - Fork 4
/
install-remote.sh
executable file
·247 lines (214 loc) · 7.87 KB
/
install-remote.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#!/bin/bash
PACKSRC=`pwd`
source ${PACKSRC}/config.ini
#################################################
# CommuniGate Specific #
#################################################
#################################################
# cPanel Specific #
#################################################
# iPhone provisioning using default httpd
mkdir -p /usr/local/apache/htdocs/iOS
chmod 777 /usr/local/apache/htdocs/iOS
# Install the WHM plugins
cp -rf ${PACKSRC}/whm/cgi/* /usr/local/cpanel/whostmgr/docroot/cgi/
cp ${PACKSRC}/whm/templates/* /usr/local/cpanel/whostmgr/docroot/templates/
if [ -f /usr/local/cpanel/bin/register_appconfig ]
then
chmod +x ${PACKSRC}/scripts/register_apps.sh
${PACKSRC}/scripts/register_apps.sh
fi
# Install CGP Logo
cp ${PACKSRC}/whm/communigate.gif /usr/local/cpanel/whostmgr/docroot/images/communigate.gif
# Install cPanel CommuniGate Custom Module
cp ${PACKSRC}/module/CommuniGate.pm /usr/local/cpanel/Cpanel/
# Lets add CGPro perl lib
if [ ! -d /usr/local/cpanel/perl/ ]
then
mkdir -p /usr/local/cpanel/perl/
fi
cp ${PACKSRC}/library/CLI.pm /usr/local/cpanel/perl/
ln -s /usr/local/cpanel/perl/CLI.pm /usr/local/cpanel
PERL_VERSION=`perl -v | grep 'This is perl' | perl -pe 's/^.*?v(\d+\.\d+\.\d+).*?$/$1/g'`
MY_PERL_PATHS="/usr/local/lib/perl5/$PERL_VERSION /usr/local/lib/perl/$PERL_VERSION /usr/local/share/perl/$PERL_VERSION /usr/local/share/perl5"
DEFAULT_PERL_PATHS=`perl -e "print join ' ', @INC"`
PERL_PATH=""
found=
for i in ${MY_PERL_PATHS[@]}; do
for j in ${DEFAULT_PERL_PATHS[@]}; do
[[ $i == $j ]] && { PERL_PATH=$i; found=1; break; }
done
[[ -n $skip ]] && { break; }
done
if [ ! -d $PERL_PATH ]
then
mkdir -p $PERL_PATH
fi
ln -s /usr/local/cpanel/perl/CLI.pm $PERL_PATH/
cp ${PACKSRC}/library/XIMSS.pm /usr/local/cpanel/
# CGPro cPanel Wrapper
cp ${PACKSRC}/cpwrap/ccaadmin /usr/local/cpanel/bin/
cp ${PACKSRC}/cpwrap/ccawrap /usr/local/cpanel/bin/
cp -r ${PACKSRC}/cpwrap/CGPro /usr/local/cpanel/bin/admin/
# install Perl dependencies
if [ `perldoc -l YAML::Syck | wc -l` == 0 ]
then
/usr/local/cpanel/bin/cpanm -f -q YAML::Syck
fi
if [ `perldoc -l JSON::XS | wc -l` == 0 ]
then
/usr/local/cpanel/bin/cpanm -f -q JSON::XS
fi
chmod +x ${PACKSRC}/scripts/install_cpanel_module.pl
${PACKSRC}/scripts/install_cpanel_module.pl MIME::QuotedPrint::Perl
${PACKSRC}/scripts/install_cpanel_module.pl XML::SAX
${PACKSRC}/scripts/install_cpanel_module.pl GD::Barcode::QRcode
# Install cPanel Function hooks
if [ ! -d /var/cpanel/perl5/lib/ ]
then
mkdir -p /var/cpanel/perl5/lib/
fi
cp -rf ${PACKSRC}/hooks/CGPro /var/cpanel/perl5/lib/
# Register installed hooks
/usr/local/cpanel/bin/manage_hooks add module CGPro::Hooks
#Install config files
cp ${PACKSRC}/etc/cpanel_cgpro.conf /var/cpanel/communigate.yaml
chmod 600 /var/cpanel/communigate.yaml
if [ ! -d /var/cpanel/cgpro/ ]
then
mkdir -p /var/cpanel/cgpro/
fi
if [ ! -f /var/cpanel/cgpro/classes.yaml ]
then
cp ${PACKSRC}/etc/classes.yaml /var/cpanel/cgpro/classes.yaml
fi
# Install CommuniGate Webmail in cPanel
# cp ${PACKSRC}/cgpro-webmail/webmail_communigate.yaml /var/cpanel/webmail/
# cp ${PACKSRC}/cgpro-webmail/webmail_communigatepronto.yaml /var/cpanel/webmail/
cp -r ${PACKSRC}/cgpro-webmail/CommuniGate /usr/local/cpanel/base/3rdparty/
cp -r ${PACKSRC}/cgpro-webmail/CommuniGatePronto /usr/local/cpanel/base/3rdparty/
# Check the scripts have executable flag
chmod +x /usr/local/cpanel/whostmgr/docroot/cgi/addon_cgpro*
chmod +x /usr/local/cpanel/Cpanel/CommuniGate.pm
chmod +x /usr/local/cpanel/bin/ccaadmin
chmod +s+x /usr/local/cpanel/bin/ccawrap
chmod +x /usr/local/cpanel/bin/admin/CGPro/cca
# Install CommuniGate Plugin
BASEDIR='/usr/local/cpanel/base/frontend';
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
LOCALES=($(find ${PACKSRC}/locale -maxdepth 1 -mindepth 1))
IFS=$OLDIFS
lLen=${#LOCALES[@]}
cp ${PACKSRC}/module/*.pm /usr/local/cpanel/Cpanel/
# Start x3
if [ ! -d ${BASEDIR}/x3/cgpro ]
then
mkdir -p ${BASEDIR}/x3/cgpro
fi
if [ ! -d ${BASEDIR}/x3/branding ]
then
mkdir -p ${BASEDIR}/x3/branding
fi
if [ ! -d ${BASEDIR}/x3/dynamicui ]
then
mkdir -p ${BASEDIR}/x3/dynamicui
fi
cp -r ${PACKSRC}/theme/cgpro/* ${BASEDIR}/x3/cgpro
cp ${PACKSRC}/icons/* ${BASEDIR}/x3/branding
cp ${PACKSRC}/plugin/*.conf ${BASEDIR}/x3/dynamicui
if [ ! -d ${BASEDIR}/x3/js2-min/cgpro ]
then
mkdir -p ${BASEDIR}/x3/js2-min/cgpro
fi
if [ ! -L ${BASEDIR}/x3/js2-min/cgpro/mail ]
then
ln -s ${BASEDIR}/x3/js2-min/mail ${BASEDIR}/x3/js2-min/cgpro/
fi
if [ ! -d ${BASEDIR}/x3/css2-min/cgpro ]
then
mkdir -p ${BASEDIR}/x3/css2-min/cgpro
fi
if [ ! -L ${BASEDIR}/x3/css2-min/cgpro/mail ]
then
ln -s ${BASEDIR}/x3/css2-min/mail ${BASEDIR}/x3/css2-min/cgpro/
fi
chmod +x ${BASEDIR}/x3/cgpro/backup/getaccbackup.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/backup/getaliasesbackup.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/backup/getfiltersbackup.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/mail/checkDomainSettings.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/mail/getDomainAccounts.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/mail/getVCARD.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/mail/getQR.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/mail/contactsimport.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/getXmppHistory.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/playwav.live.cgi
chmod +x ${BASEDIR}/x3/cgpro/getwav.live.cgi
# END x3
# START paper_lantern
if [ ! -d ${BASEDIR}/paper_lantern/cgpro ]
then
mkdir -p ${BASEDIR}/paper_lantern/cgpro
fi
if [ ! -d ${BASEDIR}/paper_lantern/styled/basic/icons/ ]
then
mkdir -p ${BASEDIR}/paper_lantern/styled/basic/icons/
fi
if [ ! -d ${BASEDIR}/paper_lantern/dynamicui ]
then
mkdir -p ${BASEDIR}/paper_lantern/dynamicui
fi
cp -a ${PACKSRC}/icons_paper_lantern/* ${BASEDIR}/paper_lantern/styled/basic/icons/
cp -a ${PACKSRC}/paper_lantern/cgpro/* ${BASEDIR}/paper_lantern/cgpro/
cp ${PACKSRC}/plugin_paper_lantern/*.conf ${BASEDIR}/paper_lantern/dynamicui/
if [ ! -d ${BASEDIR}/paper_lantern/js2-min/cgpro ]
then
mkdir -p ${BASEDIR}/paper_lantern/js2-min/cgpro
fi
if [ ! -L ${BASEDIR}/paper_lantern/js2-min/cgpro/mail ]
then
ln -s ${BASEDIR}/paper_lantern/js2-min/mail ${BASEDIR}/paper_lantern/js2-min/cgpro/
fi
if [ ! -d ${BASEDIR}/paper_lantern/css2-min/cgpro ]
then
mkdir -p ${BASEDIR}/paper_lantern/css2-min/cgpro
fi
if [ ! -L ${BASEDIR}/paper_lantern/css2-min/cgpro/mail ]
then
ln -s ${BASEDIR}/paper_lantern/css2-min/mail ${BASEDIR}/paper_lantern/css2-min/cgpro/
fi
chmod +x ${BASEDIR}/paper_lantern/cgpro/backup/getaccbackup.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/backup/getaliasesbackup.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/backup/getfiltersbackup.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/mail/checkDomainSettings.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/mail/getDomainAccounts.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/mail/getVCARD.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/mail/getQR.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/mail/contactsimport.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/getXmppHistory.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/playwav.live.cgi
chmod +x ${BASEDIR}/paper_lantern/cgpro/getwav.live.cgi
/usr/local/cpanel/bin/sprite_generator --all
# END paper_lantern
# Install CommuniGate Plugin Webmail
BASEDIR='/usr/local/cpanel/base/webmail';
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
THEMES=($(find ${BASEDIR} -maxdepth 1 -mindepth 1 -type d))
IFS=$OLDIFS
tLen=${#THEMES[@]}
for (( i=0; i<${tLen}; i++ ));
do
cp -r "${PACKSRC}/theme_webmail/cgpro" "${THEMES[$i]}/"
chmod +x ${THEMES[$i]}/cgpro/energy.live.cgi
chmod +x ${THEMES[$i]}/cgpro/pronto.live.cgi
done
# Update Feature List
cp ${PACKSRC}/featurelists/cgpro /usr/local/cpanel/whostmgr/addonfeatures/
chmod +x ${PACKSRC}/scripts/*
${PACKSRC}/scripts/migrate_groupware.pl
# ${PACKSRC}/scripts/modify_features.pl $1
/usr/local/cpanel/bin/rebuild_sprites
/usr/local/cpanel/bin/build_locale_databases
chmod +x ${PACKSRC}/scripts/editconfig.pl
${PACKSRC}/scripts/editconfig.pl