From e246be3e140fdf48aa59940c994430c731deeace Mon Sep 17 00:00:00 2001 From: "Vance M. Allen" Date: Fri, 1 Oct 2021 21:52:51 -0600 Subject: Add support for Webmin-1.981 Signed-off-by: Vance M. Allen --- app-admin/webmin/Manifest | 6 +- app-admin/webmin/webmin-1.981.ebuild | 309 +++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+), 3 deletions(-) create mode 100644 app-admin/webmin/webmin-1.981.ebuild diff --git a/app-admin/webmin/Manifest b/app-admin/webmin/Manifest index cf2c4d7..3a6d107 100644 --- a/app-admin/webmin/Manifest +++ b/app-admin/webmin/Manifest @@ -1,6 +1,6 @@ AUX gentoo-setup 13727 BLAKE2B dca9dadd5775006f5bfbeee870723db8806a2236c984e2b4cec70031101f97fc5d4e1e1fd9219f27cdaa31ee860d247f71a01180b392154c16ca6554b1f73483 SHA512 fa6fde84eb9a16fea5d019fd920aed2a2f5dd51e5f32fa407fd1c424a0627eaafab7cd3b572a57e4f97e06ce5b6b5a7373ac377776a474a8512e077130eadc6e AUX init.d.webmin 2167 BLAKE2B b90957ca4273ccc6deb35837704523361c3ed8b61034cb067919dffeabd7a8e6153ab2deceffc7745b209ffe8c6b52ad8fd391aa76591a9870c5f8f60223fb64 SHA512 deedded42854f4b29b28f24afec5171c4ee0f3301c4a0f4f9442f1c39b2aac39490315049641ed0b60182bdeb88d3f8d34672a707f95ecfa755d03d7f4dff49b AUX webmin.service 416 BLAKE2B aef00b0f948286c54736613e37f114e6ffd90453cc6eadc3afffe7fa114df4e6a8b91e4f02da6fdfaa3eb2f57254e5e6785b201d0461f28839742cc13d883816 SHA512 7cf86342db3d34cbe39b62fa768660ba7dd160d9c0d113ef6a3a176187fa0c72531bed38e3203cf627ab05c1ac4d9a8b9e829d1baa9739d63dfa74f09c445f1e -DIST webmin-1.953-minimal.tar.gz 3599434 BLAKE2B b15266213400a9ed53d4f96b0cc5ea52b4749caa2f34b8c7deb7ffb08e605450d10aa58f813fe79fa06d64fb18abfde1a6c07ba5d859ca7716f3f1649f80ca8f SHA512 cd82b6173200f635b28a3bf12af62c620a267b335c11ddb893f35847ac446d8705f0857f1cb6109c93075948d078456fbf0363d6d4abdee856cdf59186f881e1 -DIST webmin-1.953.tar.gz 46898438 BLAKE2B 86ec3ffd8485f4ddadff91385fc939aad50de2b1a0f15e9942ee057f15702443f8c131e06c408690d9b7d3b37bcbf5462a1a51056a8f89e409ce972631be25cb SHA512 b992acdfda74ac75661f1cddeca2637a7382832d3669ed4a5220297ded264e2e12244f73f9fc580a78feec7221c0c68e725f528bec0433706478bf637ff072aa -EBUILD webmin-1.953.ebuild 10394 BLAKE2B a7ebd0d6711d6039ce53d87ca058cff0a05929db64e3465a2368336d0f8b5fc7a5b14a5998cf3179146bce1f2ad5e2a83a467d1a930b1206ad33a0c6a5b29c07 SHA512 83c2b148b128158c7c0eba6b6888c063fed4316e9ca5afad4e0c14f52778582da41711970f3fb748fcf25a00d7a448c85289f80e1cd33f14e71a1209735b8410 +DIST webmin-1.981-minimal.tar.gz 634793 BLAKE2B 97e5317bd0aeeda4a679992d7e6220a9f91387357af1a445c68c995267f263d0e31f35eb4edba2deb815c8b40d31d9e316e4be713f2a63fdff0018a3538b643c SHA512 369fdf0aae6f57f0e6c74b46eb464622066ecc03b70c0350adec11daa4669321a72dea6dc3102ae88b82b8fc2bbb813ab92bf8f45c72aee53d1d9bd0d63d331d +DIST webmin-1.981.tar.gz 634793 BLAKE2B 97e5317bd0aeeda4a679992d7e6220a9f91387357af1a445c68c995267f263d0e31f35eb4edba2deb815c8b40d31d9e316e4be713f2a63fdff0018a3538b643c SHA512 369fdf0aae6f57f0e6c74b46eb464622066ecc03b70c0350adec11daa4669321a72dea6dc3102ae88b82b8fc2bbb813ab92bf8f45c72aee53d1d9bd0d63d331d +EBUILD webmin-1.981.ebuild 10394 BLAKE2B 21e8c470433112bf4b2087eb55ba4f8ff93459a01941f3c1fa5a9c0b63fd153c4c5e46d068d807d6202068033c553923460c638b237a6826d3dc4fe614227a36 SHA512 4eea6efd869581a515ed7403e25dca0a08b79c2f05c80b10af4ba5df24fb7208bf5a88f2ca98b9794fdc2f806a44f83c5a0452f245a75061c22366386efd692b diff --git a/app-admin/webmin/webmin-1.981.ebuild b/app-admin/webmin/webmin-1.981.ebuild new file mode 100644 index 0000000..111d0a9 --- /dev/null +++ b/app-admin/webmin/webmin-1.981.ebuild @@ -0,0 +1,309 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="7" + +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