From d9f2c5a0feb21a9c918df7de792f09fcde729a42 Mon Sep 17 00:00:00 2001 From: "Vance M. Allen" Date: Mon, 15 Jan 2018 23:36:49 -0700 Subject: Add support for app-admin/webmin-1.870 --- app-admin/webmin/Manifest | 6 +- app-admin/webmin/webmin-1.860.ebuild | 309 ----------------------------------- app-admin/webmin/webmin-1.870.ebuild | 309 +++++++++++++++++++++++++++++++++++ 3 files changed, 312 insertions(+), 312 deletions(-) delete mode 100644 app-admin/webmin/webmin-1.860.ebuild create mode 100644 app-admin/webmin/webmin-1.870.ebuild diff --git a/app-admin/webmin/Manifest b/app-admin/webmin/Manifest index ccf099d..069fd7b 100644 --- a/app-admin/webmin/Manifest +++ b/app-admin/webmin/Manifest @@ -1,6 +1,6 @@ AUX gentoo-setup 13727 SHA256 91e011867005dcea7cf971c36e93f6eb3a3d7626a5ecee07ce2fa4525e3ebdff SHA512 fa6fde84eb9a16fea5d019fd920aed2a2f5dd51e5f32fa407fd1c424a0627eaafab7cd3b572a57e4f97e06ce5b6b5a7373ac377776a474a8512e077130eadc6e WHIRLPOOL 93eca248ba35d30ca9e00d7f9a9b5d1ac4d71c97bef7002fd745121c4c2e061322f980efd6674b0817368154d47096d8b810a7d17cf8514493e1635d7310a701 AUX init.d.webmin 2167 SHA256 570c9ff892566d2a4b8ea597d4ce5225c1e6a8429306dd8dd99fceca67d1c401 SHA512 deedded42854f4b29b28f24afec5171c4ee0f3301c4a0f4f9442f1c39b2aac39490315049641ed0b60182bdeb88d3f8d34672a707f95ecfa755d03d7f4dff49b WHIRLPOOL f7b2184cab033bb39a69fc8c113ddeca352ba4e356d752b122f590a4fce8ae0481692e58a51bc197a2e9065e6b2a3be6ddb7389ddbbe4c079029a7958aded207 AUX webmin.service 416 SHA256 f5e9301ad853929e15cb4c4860f8d3da5a27036bcaebce38a32ec81da798b8ef SHA512 7cf86342db3d34cbe39b62fa768660ba7dd160d9c0d113ef6a3a176187fa0c72531bed38e3203cf627ab05c1ac4d9a8b9e829d1baa9739d63dfa74f09c445f1e WHIRLPOOL 9d4fbe570364a94516cf5f66eb968209f9731b6a1f3083071f3c299d65c28559e35dd76ca7e2ac2f3e5381b854cb8b5a561c48388b761c3dbb4d57829c59520b -DIST webmin-1.860-minimal.tar.gz 2690361 SHA256 7555a4942d9480f577e0d6ffd1d81c1ab2a8d73fecfe1588271e07c4cfe30f09 SHA512 4029fc84a4bcb3470a5fe4c7ea5c4ff69fdb3cf195f28ad5ed269987272331377f960f2c20dad07f6b089f80db3b2665f69fe9fa378c44dcb8adf337a0fb8ad8 WHIRLPOOL 17a79076017cac91918b00bbd54ac64e5c6cd161b4c992f41a7b089c277ea8a3e1ccacf8708677efffc78baed42018edb78e754396e043e635ea9b0748df64d3 -DIST webmin-1.860.tar.gz 28996693 SHA256 5668e9543b38941fe843efa9add6594621530eb386a97af01c980f67a7601af0 SHA512 c0e0e629e8cffda2f26f27526a516e4972c1d9c6e75f1473de9ddd0c3f2c21e2a51d396d8add8ee46efd1ac253eda0b3185cc8bf6665fe89602334233c062949 WHIRLPOOL 6aa5289602fabb6ab081a08abfc25812157f2dc19f885c093e5187bed9ffec848135ccfe181590e3445e5d5ed81b87322fe83abe817ea7779bc6cf0846058979 -EBUILD webmin-1.860.ebuild 10394 SHA256 ed09536d68271b7d5ad010dd00b11010024c10dd611863c490c06985e5b58d80 SHA512 83c2b148b128158c7c0eba6b6888c063fed4316e9ca5afad4e0c14f52778582da41711970f3fb748fcf25a00d7a448c85289f80e1cd33f14e71a1209735b8410 WHIRLPOOL 4309f2489510407112d64065419773144a1ffb869c2f735556e9404455899c2a57f0b3d9020a5f68bb80bfa92160f53bf54070b64e2736d0201eb8884d990e55 +DIST webmin-1.870-minimal.tar.gz 2806464 SHA256 78bf689250d895543a891782418a6aa274c09f652d9d1c37de065bf54a8e8fc0 SHA512 2e3dd0b9978a8a602155775191d9bb35145e82092b7618f2c7a45de290129bbd1d02d3095329e10a2964d0b7e1560df6eec8cbef6e44803f3e5567a57332ebaa WHIRLPOOL 6a9a69d83f4c4e5f1828f633feedd4515996c0513cc10aaf747325a52af5ba7299bdd66bd7eb2f5d37fbfb0d0c199a9d83308648edd360a1f754c8415bf7baa5 +DIST webmin-1.870.tar.gz 29083674 SHA256 ab3c3c5aa50dcdb660479560e8bd4cd211fe40d4ccac12fa5c14093177baa8d6 SHA512 25f385d8689d3f4bfa8b29d7d89583627efdd6184b7b0a774cc8df9b4de496faeff230c510dbb0e3110a804c768f49513c211af37a3e7121eafa87ad1b4a7c88 WHIRLPOOL 7d3ef00a63a924a303632d504fd20fd22d95c2f89d2d92e55aa307f5d33ec4a21521964ad9d4ce22af6af06306f5da3cb2ed2b4da1d2a32a5919f738e47f8d04 +EBUILD webmin-1.870.ebuild 10394 SHA256 ed09536d68271b7d5ad010dd00b11010024c10dd611863c490c06985e5b58d80 SHA512 83c2b148b128158c7c0eba6b6888c063fed4316e9ca5afad4e0c14f52778582da41711970f3fb748fcf25a00d7a448c85289f80e1cd33f14e71a1209735b8410 WHIRLPOOL 4309f2489510407112d64065419773144a1ffb869c2f735556e9404455899c2a57f0b3d9020a5f68bb80bfa92160f53bf54070b64e2736d0201eb8884d990e55 diff --git a/app-admin/webmin/webmin-1.860.ebuild b/app-admin/webmin/webmin-1.860.ebuild deleted file mode 100644 index 6d02e04..0000000 --- a/app-admin/webmin/webmin-1.860.ebuild +++ /dev/null @@ -1,309 +0,0 @@ -# Copyright 1999-2016 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -EAPI="5" - -inherit eutils pam ssl-cert systemd - -DESCRIPTION="A web-based Unix systems administration interface" -HOMEPAGE="http://www.webmin.com/" -SRC_URI="minimal? ( mirror://sourceforge/webadmin/${P}-minimal.tar.gz ) - !minimal? ( mirror://sourceforge/webadmin/${P}.tar.gz )" - -LICENSE="BSD GPL-2" -SLOT="0" - -KEYWORDS="amd64 x86" - -# 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" -REQUIRED_USE="minimal? ( !mysql !postgres !ldap )" - -# All the required perl modules can be found easily using (in Webmin's root src dir): -# find . -name cpan_modules.pl -exec grep "::" {} \; -# NOTE: If Webmin doesn't find the required perl modules, it offers(runtime) the user -# to install them using the in-built cpan module, and this will mess up perl on the system -# That's why some modules are forced without a use flag -# NOTE: pam, ssl and dnssec-tools deps are forced for security and Gentoo compliance installation reasons -DEPEND="virtual/perl-MIME-Base64 - virtual/perl-Socket - virtual/perl-Sys-Syslog - virtual/perl-Time-HiRes - virtual/perl-Time-Local - dev-perl/Authen-Libwrap - dev-perl/IO-Tty - dev-perl/MD5 - dev-perl/Net-SSLeay - dev-perl/Authen-PAM - dev-perl/Sys-Hostname-Long - >=net-dns/dnssec-tools-1.13 - !minimal? ( - mysql? ( dev-perl/DBD-mysql ) - postgres? ( dev-perl/DBD-Pg ) - ldap? ( dev-perl/perl-ldap ) - dev-perl/XML-Generator - dev-perl/XML-Parser - )" -RDEPEND="${DEPEND}" - -src_prepare() { - local perl="$( which perl )" - - # Remove the unnecessary and incompatible files - rm -rf acl/Authen-SolarisRBAC-0.1* - if ! use minimal ; then - rm -rf {format,{bsd,hpux,sgi}exports,zones,rbac} - rm -f mount/{free,net,open}bsd-mounts* - rm -f mount/macos-mounts* - fi - - # For security reasons remove the SSL certificate that comes with Webmin - # We will create our own later - rm -f miniserv.pem - - # Remove the Webmin setup scripts to avoid Webmin in runtime to mess up config - # We will use our own later - rm -f setup.{sh,pl} - - # Set the installation type/mode to Gentoo - echo "gentoo" > install-type - - # Fix the permissions of the install files - chmod -R og-w "${S}" - - # Since we should not modify any files after install - # we set the perl path in all cgi and pl files here using Webmin's routines - # The pl file is Prefix safe and works only on provided input, no other filesystem files - ebegin "Fixing perl path in source files" - (find "${S}" -name '*.cgi' -print ; find "${S}" -name '*.pl' -print) | $perl "${S}"/perlpath.pl $perl - - eend $? -} - -src_install() { - # Create config dir and keep - diropts -m0755 - dodir /etc/webmin - keepdir /etc/webmin - - # Create install dir - # Third party modules installed through Webmin go here too, so keep - dodir /usr/libexec/webmin - keepdir /usr/libexec/webmin - - # Copy our own setup script to installation folder - insinto /usr/libexec/webmin - newins "${FILESDIR}"/gentoo-setup gentoo-setup.sh - fperms 0744 /usr/libexec/webmin/gentoo-setup.sh - - # This is here if we ever want in future ebuilds to add some specific - # config values in the /etc/webmin/miniserv.conf - # The format of this file should be the same as the one of miniserv.conf: - # var=value - # - # Uncomment it if you use such file. Before that check if upstream - # has this file in root dir too. - #newins "${FILESDIR}/miniserv-conf" miniserv-conf - - # Create the log dir and keep - diropts -m0700 - dodir /var/log/webmin - keepdir /var/log/webmin - - # Create the init.d file and put the neccessary variables there - newinitd "${FILESDIR}"/init.d.webmin webmin - 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}etc/init.d/webmin" \ - || die "Failed to patch the webmin init file" - - # 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_systemunitdir)/webmin.service" \ - || die "Failed to patch the webmin systemd service file" - - # Setup pam - pamd_mimic system-auth webmin auth account session - - # Copy files to installation folder - ebegin "Copying install files to destination" - cp -pPR "${S}"/* "${ED}usr/libexec/webmin" - eend $? -} - -pkg_preinst() { - # First stop service if running so Webmin to not messup our config - ebegin "Stopping any running Webmin instance prior merging" - if systemd_is_booted ; then - systemctl stop webmin.service 2>/dev/null - else - rc-service --ifexists -- webmin --ifstarted stop - fi - eend $? -} - -pkg_postinst() { - # Run pkg_config phase first - non interactively - export INTERACTIVE="no" - pkg_config - # Every next time pkg_config should be interactive - INTERACTIVE="yes" - - ewarn - ewarn "Bare in mind that not all Webmin modules are Gentoo tweaked and may have some issues." - ewarn "Always be careful when using modules that modify init entries, do update of webmin, install CPAN modules etc." - 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 - if systemd_is_booted ; 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'" -} - -pkg_prerm() { - # First stop service if running - we do not want Webmin to mess up config - ebegin "Stopping any running Webmin instance prior unmerging" - if systemd_is_booted ; then - systemctl stop webmin.service 2>/dev/null - else - rc-service --ifexists -- webmin --ifstarted stop - fi - eend $? -} - -pkg_postrm() { - # 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" - 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' - # reset/_reset can be: - # 'none' - does not reset anything, just upgrades if a conf is present - # OR installs new conf if a conf is missing - # 'soft' - deletes only $config_dir/config file and thus resetting most - # conf values to their defaults. Keeps the specific Webmin cron jobs - # 'hard' - deletes all files in $config_dir (keeping the .keep_* Gentoo file) - # and thus resetting all Webmin. Deletes the specific Webmin cron jobs too. - local _reset="none" - - # If in interactive mode ask user what should we do - if [[ "${INTERACTIVE}" = "yes" ]]; then - einfo - einfo "Please enter the number of the action you would like to perform?" - einfo - einfo "1. Update configuration" - einfo " (keeps old config options and adds the new ones)" - einfo "2. Soft reset configuration" - einfo " (keeps some old config options, the other options are set to default)" - ewarn " All Webmin users will be reset" - einfo "3. Hard reset configuration" - einfo " (all options including module options are set to default)" - ewarn " You will lose all Webmin configuration options you have done till now" - einfo "4. Exit this configuration utility (default)" - while [ "$correct" != "true" ] ; do - read answer - if [[ "$answer" = "1" ]] ; then - _reset="none" - correct="true" - elif [[ "$answer" = "2" ]] ; then - _reset="soft" - correct="true" - elif [[ "$answer" = "3" ]] ; then - _reset="hard" - correct="true" - elif [ "$answer" = "4" -o "$answer" = "" ] ; then - die "User aborted configuration." - else - echo "Answer not recognized. Enter a number from 1 to 4" - fi - done - - if [[ "$_reset" = "hard" ]]; then - while [ "$sure" != "true" ] ; do - ewarn "You will lose all Webmin configuration options you have done till now." - ewarn "Are you sure you want to do this? (y/n)" - read answer - if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then - sure="true" - elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then - die "User aborted configuration." - else - echo "Answer not recognized. Enter 'y' or 'n'" - fi - done - fi - fi - - export reset=$_reset - - # Create ssl certificate for Webmin if there is not one in the proper place - if [[ ! -e "${EROOT}etc/ssl/webmin/server.pem" ]]; then - SSL_ORGANIZATION="${SSL_ORGANIZATION:-Webmin Server}" - SSL_COMMONNAME="${SSL_COMMONNAME:-*}" - install_cert "${EROOT}/etc/ssl/webmin/server" - fi - - # Ensure all paths passed to the setup script use EROOT - export wadir="${EROOT}usr/libexec/webmin" - export config_dir="${EROOT}etc/webmin" - export var_dir="${EROOT}var/log/webmin" - export tempdir="${T}" - export pidfile="${EROOT}var/run/webmin.pid" - export perl="$( which perl )" - export os_type='gentoo-linux' - export os_version='*' - export real_os_type='Gentoo Linux' - export real_os_version='Any version' - # Forcing 'ssl', 'no_ssl2', 'no_ssl3', 'ssl_redirect', 'no_sslcompression', - # 'ssl_honorcipherorder', 'no_tls1' and 'no_tls1_1' for tightening security - export ssl=1 - export no_ssl2=1 - export no_ssl3=1 - export ssl_redirect=1 - export ssl_honorcipherorder=1 - export no_sslcompression=1 - export no_tls1=1 - export no_tls1_1=1 - export keyfile="${EROOT}etc/ssl/webmin/server.pem" - export port=10000 - - export atboot=0 - - einfo "Executing Webmin's configure script" - $wadir/gentoo-setup.sh - - einfo "Configuration of Webmin done" -} diff --git a/app-admin/webmin/webmin-1.870.ebuild b/app-admin/webmin/webmin-1.870.ebuild new file mode 100644 index 0000000..6d02e04 --- /dev/null +++ b/app-admin/webmin/webmin-1.870.ebuild @@ -0,0 +1,309 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +inherit eutils pam ssl-cert systemd + +DESCRIPTION="A web-based Unix systems administration interface" +HOMEPAGE="http://www.webmin.com/" +SRC_URI="minimal? ( mirror://sourceforge/webadmin/${P}-minimal.tar.gz ) + !minimal? ( mirror://sourceforge/webadmin/${P}.tar.gz )" + +LICENSE="BSD GPL-2" +SLOT="0" + +KEYWORDS="amd64 x86" + +# 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" +REQUIRED_USE="minimal? ( !mysql !postgres !ldap )" + +# All the required perl modules can be found easily using (in Webmin's root src dir): +# find . -name cpan_modules.pl -exec grep "::" {} \; +# NOTE: If Webmin doesn't find the required perl modules, it offers(runtime) the user +# to install them using the in-built cpan module, and this will mess up perl on the system +# That's why some modules are forced without a use flag +# NOTE: pam, ssl and dnssec-tools deps are forced for security and Gentoo compliance installation reasons +DEPEND="virtual/perl-MIME-Base64 + virtual/perl-Socket + virtual/perl-Sys-Syslog + virtual/perl-Time-HiRes + virtual/perl-Time-Local + dev-perl/Authen-Libwrap + dev-perl/IO-Tty + dev-perl/MD5 + dev-perl/Net-SSLeay + dev-perl/Authen-PAM + dev-perl/Sys-Hostname-Long + >=net-dns/dnssec-tools-1.13 + !minimal? ( + mysql? ( dev-perl/DBD-mysql ) + postgres? ( dev-perl/DBD-Pg ) + ldap? ( dev-perl/perl-ldap ) + dev-perl/XML-Generator + dev-perl/XML-Parser + )" +RDEPEND="${DEPEND}" + +src_prepare() { + local perl="$( which perl )" + + # Remove the unnecessary and incompatible files + rm -rf acl/Authen-SolarisRBAC-0.1* + if ! use minimal ; then + rm -rf {format,{bsd,hpux,sgi}exports,zones,rbac} + rm -f mount/{free,net,open}bsd-mounts* + rm -f mount/macos-mounts* + fi + + # For security reasons remove the SSL certificate that comes with Webmin + # We will create our own later + rm -f miniserv.pem + + # Remove the Webmin setup scripts to avoid Webmin in runtime to mess up config + # We will use our own later + rm -f setup.{sh,pl} + + # Set the installation type/mode to Gentoo + echo "gentoo" > install-type + + # Fix the permissions of the install files + chmod -R og-w "${S}" + + # Since we should not modify any files after install + # we set the perl path in all cgi and pl files here using Webmin's routines + # The pl file is Prefix safe and works only on provided input, no other filesystem files + ebegin "Fixing perl path in source files" + (find "${S}" -name '*.cgi' -print ; find "${S}" -name '*.pl' -print) | $perl "${S}"/perlpath.pl $perl - + eend $? +} + +src_install() { + # Create config dir and keep + diropts -m0755 + dodir /etc/webmin + keepdir /etc/webmin + + # Create install dir + # Third party modules installed through Webmin go here too, so keep + dodir /usr/libexec/webmin + keepdir /usr/libexec/webmin + + # Copy our own setup script to installation folder + insinto /usr/libexec/webmin + newins "${FILESDIR}"/gentoo-setup gentoo-setup.sh + fperms 0744 /usr/libexec/webmin/gentoo-setup.sh + + # This is here if we ever want in future ebuilds to add some specific + # config values in the /etc/webmin/miniserv.conf + # The format of this file should be the same as the one of miniserv.conf: + # var=value + # + # Uncomment it if you use such file. Before that check if upstream + # has this file in root dir too. + #newins "${FILESDIR}/miniserv-conf" miniserv-conf + + # Create the log dir and keep + diropts -m0700 + dodir /var/log/webmin + keepdir /var/log/webmin + + # Create the init.d file and put the neccessary variables there + newinitd "${FILESDIR}"/init.d.webmin webmin + 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}etc/init.d/webmin" \ + || die "Failed to patch the webmin init file" + + # 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_systemunitdir)/webmin.service" \ + || die "Failed to patch the webmin systemd service file" + + # Setup pam + pamd_mimic system-auth webmin auth account session + + # Copy files to installation folder + ebegin "Copying install files to destination" + cp -pPR "${S}"/* "${ED}usr/libexec/webmin" + eend $? +} + +pkg_preinst() { + # First stop service if running so Webmin to not messup our config + ebegin "Stopping any running Webmin instance prior merging" + if systemd_is_booted ; then + systemctl stop webmin.service 2>/dev/null + else + rc-service --ifexists -- webmin --ifstarted stop + fi + eend $? +} + +pkg_postinst() { + # Run pkg_config phase first - non interactively + export INTERACTIVE="no" + pkg_config + # Every next time pkg_config should be interactive + INTERACTIVE="yes" + + ewarn + ewarn "Bare in mind that not all Webmin modules are Gentoo tweaked and may have some issues." + ewarn "Always be careful when using modules that modify init entries, do update of webmin, install CPAN modules etc." + 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 + if systemd_is_booted ; 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'" +} + +pkg_prerm() { + # First stop service if running - we do not want Webmin to mess up config + ebegin "Stopping any running Webmin instance prior unmerging" + if systemd_is_booted ; then + systemctl stop webmin.service 2>/dev/null + else + rc-service --ifexists -- webmin --ifstarted stop + fi + eend $? +} + +pkg_postrm() { + # 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" + 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' + # reset/_reset can be: + # 'none' - does not reset anything, just upgrades if a conf is present + # OR installs new conf if a conf is missing + # 'soft' - deletes only $config_dir/config file and thus resetting most + # conf values to their defaults. Keeps the specific Webmin cron jobs + # 'hard' - deletes all files in $config_dir (keeping the .keep_* Gentoo file) + # and thus resetting all Webmin. Deletes the specific Webmin cron jobs too. + local _reset="none" + + # If in interactive mode ask user what should we do + if [[ "${INTERACTIVE}" = "yes" ]]; then + einfo + einfo "Please enter the number of the action you would like to perform?" + einfo + einfo "1. Update configuration" + einfo " (keeps old config options and adds the new ones)" + einfo "2. Soft reset configuration" + einfo " (keeps some old config options, the other options are set to default)" + ewarn " All Webmin users will be reset" + einfo "3. Hard reset configuration" + einfo " (all options including module options are set to default)" + ewarn " You will lose all Webmin configuration options you have done till now" + einfo "4. Exit this configuration utility (default)" + while [ "$correct" != "true" ] ; do + read answer + if [[ "$answer" = "1" ]] ; then + _reset="none" + correct="true" + elif [[ "$answer" = "2" ]] ; then + _reset="soft" + correct="true" + elif [[ "$answer" = "3" ]] ; then + _reset="hard" + correct="true" + elif [ "$answer" = "4" -o "$answer" = "" ] ; then + die "User aborted configuration." + else + echo "Answer not recognized. Enter a number from 1 to 4" + fi + done + + if [[ "$_reset" = "hard" ]]; then + while [ "$sure" != "true" ] ; do + ewarn "You will lose all Webmin configuration options you have done till now." + ewarn "Are you sure you want to do this? (y/n)" + read answer + if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then + sure="true" + elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then + die "User aborted configuration." + else + echo "Answer not recognized. Enter 'y' or 'n'" + fi + done + fi + fi + + export reset=$_reset + + # Create ssl certificate for Webmin if there is not one in the proper place + if [[ ! -e "${EROOT}etc/ssl/webmin/server.pem" ]]; then + SSL_ORGANIZATION="${SSL_ORGANIZATION:-Webmin Server}" + SSL_COMMONNAME="${SSL_COMMONNAME:-*}" + install_cert "${EROOT}/etc/ssl/webmin/server" + fi + + # Ensure all paths passed to the setup script use EROOT + export wadir="${EROOT}usr/libexec/webmin" + export config_dir="${EROOT}etc/webmin" + export var_dir="${EROOT}var/log/webmin" + export tempdir="${T}" + export pidfile="${EROOT}var/run/webmin.pid" + export perl="$( which perl )" + export os_type='gentoo-linux' + export os_version='*' + export real_os_type='Gentoo Linux' + export real_os_version='Any version' + # Forcing 'ssl', 'no_ssl2', 'no_ssl3', 'ssl_redirect', 'no_sslcompression', + # 'ssl_honorcipherorder', 'no_tls1' and 'no_tls1_1' for tightening security + export ssl=1 + export no_ssl2=1 + export no_ssl3=1 + export ssl_redirect=1 + export ssl_honorcipherorder=1 + export no_sslcompression=1 + export no_tls1=1 + export no_tls1_1=1 + export keyfile="${EROOT}etc/ssl/webmin/server.pem" + export port=10000 + + export atboot=0 + + einfo "Executing Webmin's configure script" + $wadir/gentoo-setup.sh + + einfo "Configuration of Webmin done" +} -- cgit v1.2.3-65-gdbad