--- /usr/local/portage/app-admin/webmin/webmin-1.680.ebuild 2014-05-01 19:30:09.000000000 +0300 +++ /usr/portage/app-admin/webmin/webmin-1.690.ebuild 2014-06-01 00:09:28.872791168 +0300 @@ -1,10 +1,10 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-admin/webmin/webmin-1.680.ebuild,v 1.1 2014/05/01 16:30:09 hwoarang Exp $ +# $Header: $ -EAPI="3" +EAPI="4" -inherit eutils pam ssl-cert +inherit eutils pam ssl-cert systemd DESCRIPTION="A web-based Unix systems administration interface" HOMEPAGE="http://www.webmin.com/" @@ -18,7 +18,7 @@ # NOTE: The ssl flag auto added by ssl-cert eclass is not used actually # because openssl is forced by dev-perl/Net-SSLeay -IUSE="minimal +ssl mysql postgres ldap" +IUSE="minimal +ssl mysql postgres ldap systemd" # All the required perl modules can be found easily using (in Webmin's root src dir): # find . -name cpan_modules.pl -exec grep "::" {} \; @@ -42,7 +42,8 @@ ldap? ( dev-perl/perl-ldap ) dev-perl/XML-Generator dev-perl/XML-Parser - )" + ) + systemd? ( sys-apps/systemd )" RDEPEND="${DEPEND}" src_prepare() { @@ -114,10 +115,24 @@ -e "s:%exe%:${EROOT}usr/libexec/webmin/miniserv.pl:" \ -e "s:%pid%:${EROOT}var/run/webmin.pid:" \ -e "s:%conf%:${EROOT}etc/webmin/miniserv.conf:" \ + -e "s:%config%:${EROOT}etc/webmin/config:" \ -e "s:%perllib%:${EROOT}usr/libexec/webmin:" \ "${ED}etc/init.d/webmin" \ || die "Failed to patch the webmin init file" + if use systemd ; then + # Create the systemd service file and put the neccessary variables there + systemd_newunit "${FILESDIR}"/webmin.service webmin.service + sed -i \ + -e "s:%exe%:${EROOT}usr/libexec/webmin/miniserv.pl:" \ + -e "s:%pid%:${EROOT}var/run/webmin.pid:" \ + -e "s:%conf%:${EROOT}etc/webmin/miniserv.conf:" \ + -e "s:%config%:${EROOT}etc/webmin/config:" \ + -e "s:%perllib%:${EROOT}usr/libexec/webmin:" \ + "${ED}$(_systemd_get_unitdir)/webmin.service" \ + || die "Failed to patch the webmin systemd service file" + fi + # Setup pam pamd_mimic system-auth webmin auth account session @@ -130,7 +145,11 @@ pkg_preinst() { # First stop service if running so Webmin to not messup our config ebegin "Stopping any running Webmin instance prior merging" - rc-service --ifexists -- webmin --ifstarted stop + if systemd_is_booted ; then + systemctl stop webmin.service 2>/dev/null + else + rc-service --ifexists -- webmin --ifstarted stop + fi eend $? } @@ -147,7 +166,11 @@ ewarn "To avoid problems, please before using any module, look at its configuration options first." ewarn "(Usually there is a link at top in the right pane of Webmin for configuring the module.)" ewarn - elog "- To make Webmin start at boot time, run: 'rc-update add webmin default'" + if systemd_is_booted || use systemd ; then + elog "- To make Webmin start at boot time, run: 'systemctl enable webmin.service'" + else + elog "- To make Webmin start at boot time, run: 'rc-update add webmin default'" + fi elog "- The default URL to connect to Webmin is: https://localhost:10000" elog "- The default user that can login is: root" elog "- To reconfigure Webmin in case of problems run 'emerge --config app-admin/webmin'" @@ -156,23 +179,34 @@ pkg_prerm() { # First stop service if running - we do not want Webmin to mess up config ebegin "Stopping any running Webmin instance prior unmerging" - rc-service --ifexists -- webmin --ifstarted stop + if systemd_is_booted ; then + systemctl stop webmin.service 2>/dev/null + else + rc-service --ifexists -- webmin --ifstarted stop + fi eend $? } pkg_postrm() { - ewarn - ewarn "You have uninstalled Webmin, so have in mind that all cron jobs scheduled" - ewarn "by Webmin for its own modules, are left active and they will fail when Webmin is missing." - ewarn "To fix this just disable them if you intend to use Webmin again," - ewarn "OR delete them if not." - ewarn + # If removing webmin completely, remind the user for the Webmin's own cron jobs. + if [[ ! ${REPLACED_BY_VERSION} ]]; then + ewarn + ewarn "You have uninstalled Webmin, so have in mind that all cron jobs scheduled" + ewarn "by Webmin for its own modules, are left active and they will fail when Webmin is missing." + ewarn "To fix this just disable them if you intend to use Webmin again," + ewarn "OR delete them if not." + ewarn + fi } pkg_config(){ # First stop service if running ebegin "Stopping any running Webmin instance" - rc-service --ifexists -- webmin --ifstarted stop + if systemd_is_booted ; then + systemctl stop webmin.service 2>/dev/null + else + rc-service --ifexists -- webmin --ifstarted stop + fi eend $? # Next set the default reset variable to 'none'