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
247
248
249
250
251
|
# Copyright 2022-2025 Liguros Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
RESTRICT="mirror"
DESCRIPTION="A PHP-based webhosting-oriented control panel for servers."
HOMEPAGE="https://froxlor.org/"
SRC_URI="https://files.froxlor.org/releases/${P}.tar.gz"
KEYWORDS="~amd64 ~x86"
LICENSE="GPL-2"
SLOT="0"
IUSE="awstats bind +dovecot fcgid fpm ftpquota libressl lighttpd +log mailquota nginx pdns proftpd pureftpd quota ssl"
DEPEND="
dev-db/mariadb
>=mail-mta/postfix-2.4[mariadb,ssl=]
virtual/cron
>=dev-lang/php-7.1:*[bcmath,cli,ctype,curl,filter,gd,json(+),mysql,nls,pcntl,pdo,posix,session,simplexml,ssl=,tokenizer,unicode,xml,xslt,zlib,zip]
pureftpd? (
net-ftp/pure-ftpd[mysql,ssl=]
)
proftpd? (
net-ftp/proftpd[mysql,ssl=]
ftpquota? ( net-ftp/proftpd[softquota] )
)
awstats? (
www-misc/awstats
)
!awstats? (
app-admin/webalizer
)
bind? ( net-dns/bind )
pdns? ( net-dns/pdns[mysql] )
ssl? (
!libressl? ( dev-libs/openssl )
libressl? ( dev-libs/libressl )
)
lighttpd? ( www-servers/lighttpd[php,ssl=] )
nginx? (
www-servers/nginx:*[ssl=]
)
!lighttpd? (
( !nginx? (
www-servers/apache[ssl=]
!fpm? (
dev-lang/php:*[apache2]
)
)
)
)
fcgid? ( dev-lang/php:*[cgi]
|| (
sys-auth/libnss-extrausers
sys-auth/libnss-mysql
)
( !lighttpd? (
!nginx? (
www-servers/apache[apache2_modules_proxy_fcgi]
)
)
)
)
fpm? ( dev-lang/php:*[fpm]
|| (
sys-auth/libnss-extrausers
sys-auth/libnss-mysql
)
( !lighttpd? (
!nginx? (
www-servers/apache[apache2_modules_proxy_fcgi]
)
)
)
)
dovecot? (
>=net-mail/dovecot-2.2.0[mariadb]
>=mail-mta/postfix-2.4[dovecot-sasl]
)
!dovecot? (
dev-libs/cyrus-sasl[mysql,ssl=]
net-libs/courier-authlib[mysql]
net-mail/courier-imap
>=mail-mta/postfix-2.4[sasl]
)
quota? ( sys-fs/quotatool )"
RDEPEND="${DEPEND}"
REQUIRED_USE="lighttpd? ( !nginx ) fcgid? ( !fpm ) pdns? ( !bind )"
S=${WORKDIR}/froxlor
# we need that to set the standardlanguage later
LANGS="cs de en fr it nl pt sv"
for X in ${LANGS} ; do
IUSE="${IUSE} l10n_${X}"
done
# lets check user defined variables
FROXLOR_DOCROOT="${FROXLOR_DOCROOT:-/var/www}"
FROXLOR_INSTALL_FILE="${S}/install/froxlor.sql.php"
src_install() {
# set default language
local MYLANG=""
if use l10n_de ; then
MYLANG="Deutsch"
elif use l10n_fr ; then
MYLANG="Français"
elif use l10n_it ; then
MYLANG="Italiano"
elif use l10n_nl ; then
MYLANG="Nederlands"
elif use l10n_pt ; then
MYLANG="Português"
elif use l10n_sv ; then
MYLANG="Svenska"
elif use l10n_cs ; then
MYLANG="Česká republika"
fi
if [[ ${MYLANG} != '' ]] ; then
einfo "Setting standardlanguage to '${MYLANG}'"
sed -e "s|'standardlanguage', 'English'|'standardlanguage', '${MYLANG}'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change default language"
fi
einfo "Setting 'lastguid' to '10000'"
sed -e "s|'lastguid', '9999'|'lastguid', '10000'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change lastguid"
# set correct webserver reload
if use lighttpd; then
einfo "Switching settings to fit 'lighttpd'"
sed -e "s|/etc/init.d/apache2 reload|/etc/init.d/lighttpd restart|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver restart-command"
sed -e "s|'webserver', 'apache2'|'webserver', 'lighttpd'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver version"
sed -e "s|'apacheconf_vhost', '/etc/apache2/sites-enabled/'|'apacheconf_vhost', '/etc/lighttpd/vj/'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver vhost directory"
sed -e "s|'apacheconf_diroptions', '/etc/apache2/sites-enabled/'|'apacheconf_diroptions', '/etc/lighttpd/diroptions.conf'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver diroptions file"
sed -e "s|'apacheconf_htpasswddir', '/etc/apache2/htpasswd/'|'apacheconf_htpasswddir', '/etc/lighttpd/htpasswd/'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver htpasswd directory"
sed -e "s|'httpuser', 'www-data'|'httpuser', 'lighttpd'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver user"
sed -e "s|'httpgroup', 'www-data'|'httpgroup', 'lighttpd'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver group"
sed -e "s|'fastcgi_ipcdir', '/var/lib/apache2/fastcgi/'|'fastcgi_ipcdir', '/var/run/lighttpd/'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change php-ipc directory"
elif use nginx; then
einfo "Switching settings to fit 'nginx'"
sed -e "s|/etc/init.d/apache2 reload|/etc/init.d/nginx restart|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver restart-command"
sed -e "s|'webserver', 'apache2'|'webserver', 'nginx'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver version"
sed -e "s|'apacheconf_vhost', '/etc/apache2/sites-enabled/'|'apacheconf_vhost', '/etc/nginx/vhosts.d/'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver vhost directory"
sed -e "s|'apacheconf_diroptions', '/etc/apache2/sites-enabled/'|'apacheconf_diroptions', '/etc/nginx/diroptions.conf'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver diroptions file"
sed -e "s|'apacheconf_htpasswddir', '/etc/apache2/htpasswd/'|'apacheconf_htpasswddir', '/etc/nginx/htpasswd/'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver htpasswd directory"
sed -e "s|'httpuser', 'www-data'|'httpuser', 'nginx'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver user"
sed -e "s|'httpgroup', 'www-data'|'httpgroup', 'nginx'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver group"
sed -e "s|'fastcgi_ipcdir', '/var/lib/apache2/fastcgi/'|'fastcgi_ipcdir', '/var/run/nginx/'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change php-ipc directory"
else
einfo "Switching settings to fit 'apache2'"
sed -e "s|'apacheconf_vhost', '/etc/apache2/sites-enabled/'|'apacheconf_vhost', '/etc/apache2/vhosts.d/'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver vhost directory"
sed -e "s|'apacheconf_diroptions', '/etc/apache2/sites-enabled/'|'apacheconf_diroptions', '/etc/apache2/vhosts.d/'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver diroptions file"
sed -e "s|'httpuser', 'www-data'|'httpuser', 'apache'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver user"
sed -e "s|'httpgroup', 'www-data'|'httpgroup', 'apache'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change webserver group"
fi
if use fcgid && ! use lighttpd && ! use nginx ; then
einfo "Switching 'fcgid' to 'On'"
sed -e "s|'mod_fcgid', '0'|'mod_fcgid', '1'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to set fcgid to 'On'"
einfo "Setting wrapper to FcgidWrapper"
sed -e "s|'mod_fcgid_wrapper', '0'|'mod_fcgid_wrapper', '1'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to set fcgi-wrapper to 'FCGIWrapper'"
fi
if use fpm ; then
einfo "Switching 'fpm' to 'On'"
sed -e "s|'phpfpm', 'enabled', '0'|'phpfpm', 'enabled', '1'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to set fpm to 'On'"
fi
# If Bind and pdns will not be used disable nameserver
if ! use bind && ! use pdns; then
einfo "Disabling nameserver"
sed -e 's|'bind_enable', '1'|'bind_enable', '0'|g' -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change binds enabled flag"
sed -e 's|/etc/init.d/bind9 reload|/bin/true|g' -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change reload path for Bind"
fi
if use bind ; then
einfo "Setting bind9 reload command"
sed -e 's|'bind_enable', '0'|'bind_enable', '1'|g' -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change binds enabled flag"
sed -e 's|/etc/init.d/bind9 reload|/etc/init.d/named reload|g' -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change reload path for Bind"
fi
if use pdns ; then
einfo "Switching from 'bind' to 'powerdns'"
sed -e 's|'bind_enable', '0'|'bind_enable', '1'|g' -i "${FROXLOR_INSTALL_FILE}" die "Unable to change binds enabled flag"
sed -e 's|/etc/init.d/bind9 reload|/etc/init.d/pdns restart|g' -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change reload path for pdns"
sed -e 's|'dns_server', 'bind'|'dns_server', 'pdns'|g' -i "${FROXLOR_INSTALL_FILE}" || die "Unable to change dns-server value from bind to pdns"
ewarn ""
ewarn "Note that you need to configure pdns and create a separate database for it, see:"
ewarn "https://doc.powerdns.com/3/authoritative/installation/#basic-setup-configuring-database-connectivity"
ewarn ""
fi
# default value is logging_enabled='1'
if ! use log ; then
einfo "Switching 'log' to 'Off'"
sed -e "s|'logger', 'enabled', '1'|'logger', 'enabled', '0'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to set logging to 'Off'"
fi
# default value is mailquota='0'
if use mailquota ; then
einfo "Switching 'mailquota' to 'On'"
sed -e "s|'mail_quota_enabled', '0'|'mail_quota_enabled', '1'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to set mailquota to 'On'"
fi
# default value is ssl_enabled='1'
if ! use ssl ; then
einfo "Switching 'SSL' to 'Off'"
sed -e "s|'use_ssl','1'|'use_ssl','0'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to set ssl to 'Off'"
fi
if use awstats ; then
einfo "Switching from 'Webalizer' to 'AWStats'"
sed -e "s|'webalizer_quiet', '2'|'webalizer_quiet', '0'|g" -i "${FROXLOR_INSTALL_FILE}"
sed -e "s|'awstats_enabled', '0'|'awstats_enabled', '1'|g" -i "${FROXLOR_INSTALL_FILE}" || die "Unable to enable AWStats"
fi
if use pureftpd ; then
einfo "Switching from 'ProFTPd' to 'Pure-FTPd'"
sed -e "s|'ftpserver', 'proftpd'|'ftpserver', 'pureftpd'|g" -i "${FROXLOR_INSTALL_FILE}"
fi
# Install the Froxlor files
einfo "Installing Froxlor files"
dodir ${FROXLOR_DOCROOT}
cp -R "${S}/" "${D}${FROXLOR_DOCROOT}/" || die "Installation of the Froxlor files failed"
}
pkg_postinst() {
# we need to check if this is going to be an update or a fresh install!
if [[ -f "${ROOT}${FROXLOR_DOCROOT}/froxlor/lib/userdata.inc.php" ]] ; then
elog "Froxlor is already installed on this system!"
elog
elog "Froxlor will update the database when you open"
elog "it in your browser the first time after the update-process"
elif [[ -f "${ROOT}${FROXLOR_DOCROOT}/syscp/lib/userdata.inc.php" ]] ; then
elog "This seems to be an upgrade from syscp"
elog "please move ${FROXLOR_DOCROOT}/syscp/lib/userdata.inc.php to"
elog "${FROXLOR_DOCROOT}/froxlor/lib/"
elog "and don't forget to copy "${ROOT}/usr/share/${PN}/froxlor.cron""
elog "to /etc/cron.d/froxlor and remove /etc/cron.d/syscp"
else
elog "Please open http://[ip]/froxlor in your browser to continue"
elog "with the basic setup of Froxlor."
elog
elog "Don't forget to setup your MariaDB databases root user and password"
fi
}
|