Skip to contentSkip to conversation

Dunfell :: Recipe fixes to install Webmin 1.962 and fix Perl CGI

DISCUSSION [email protected] 1 participant 1 message Dec 5, 2020

lore
Share & tools
lore
#0 lore raw

Hello all:

Just a quick email to submit to the group. I needed to build a distro to include Webmin. The version that comes with OpenEmbedded (webmin 1.850) in meta-webserver/recipes-webadmin/webmin is kind of an old release, and there were issues with the build.

Below is a new recipe: webmin_1.962.bb (Attached MD5:
301394DDA264C712C1BF9496D409D3CF)

Just add "webmin" to your local.conf to add it to your distro. You can also override the default username and password in local.conf if desired. One issue...the "do_package" for Webmin takes around 25 minutes on my machine. Almost as long as the kernel. :) I'm not sure why. It's one of the things I need to look into.

Once built, you can go into the configuration and add any additional modules you wish. The utility will list them for you and download them from the Webmin site.

This recipe builds on the previous work, adds basic modules and themes to the build, and updates some of the build dependencies.

Also...in order to build this package, another recipe needs modification. I have not created a patch file for this yet. I'm not sure it would be appropriate as this library is kind of in limbo...but I did update the recipe to download the latest version of the file:
libcgi-perl_4.51.bb (OpenEmbedded > meta-perl-recipes-perl/libcgi) (Attached MD5: 0126F5119E9AA358C461ABC5BF777450)

Basically this recipe downloads the latest version of the library as Webmin depends on it.

Hope these help. I will get patches made up and submitted soon.

-Joe
Warped Electronics

DESCRIPTION = "CGI.pm is a stable, complete and mature solution for processing and preparing \
HTTP requests and responses. Major features including processing form \
submissions, file uploads, reading and writing cookies, query string generation \
and manipulation, and processing and preparing HTTP headers."
HOMEPAGE = "https://metacpan.org/pod/CGI"
SECTION = "libs"
LICENSE = "Artistic-2.0 | GPL-2.0"

LIC_FILES_CHKSUM = "file://LICENSE;md5=415fc49abed2728f9480cd32c8d67beb"

SRC_URI = "https://cpan.metacpan.org/authors/id/L/LE/LEEJO/CGI-${PV}.tar.gz"

SRC_URI[md5sum] = "87b6cf5bc68739c9310ca501adad998e"
SRC_URI[sha256sum] = "0bd215e7012f9f52e6a7d3fe695ee30ef959d796e8e53472fa0ed8c53fba600a"

S = "${WORKDIR}/CGI-${PV}"

inherit cpan ptest-perl

RDEPENDS_${PN} += "\
    libhtml-parser-perl \
    perl-module-base \
    perl-module-deprecate \
    perl-module-if \

"

do_install_prepend() {
    # requires "-T" (taint) command line option
    rm -rf ${B}/t/push.t
    rm -rf ${B}/t/utf8.t
    # tests building of docs
    rm -rf ${B}/t/compiles_pod.t
}
RDEPENDS_${PN}-ptest += " \
    libtest-deep-perl \
    libtest-warn-perl \
    perl-module-bytes \
    perl-module-file-find \
    perl-module-filehandle \
    perl-module-findbin \
    perl-module-lib \
    perl-module-perlio \
    perl-module-perlio-scalar \
    perl-module-test-more \
    perl-module-utf8 \

"

RPROVIDES_${PN} += "perl-module-cgi"

BBCLASSEXTEND = "native"

SUMMARY = "Web-based administration interface"
HOMEPAGE = "http://www.webmin.com"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENCE;md5=0a6446108c96d0819d21e40b48109507"

SRC_URI = "${SOURCEFORGE_MIRROR}/webadmin/webmin-${PV}.tar.gz \
           file://setup.sh \
           file://init-exclude.patch \
           file://remove-startup-option.patch \
           file://nfs-export.patch \
           file://exports-lib.pl.patch \
           file://mount-excludefs.patch \
           file://samba-config-fix.patch \
           file://proftpd-config-fix.patch \
           file://media-tomb.patch \
           file://remove-python2.3.patch \
           file://mysql-config-fix.patch \
           file://webmin.service \
          "

SRC_URI[md5sum] = "d74d14ee5467fc95d283b1578b0ef622"
SRC_URI[sha256sum] = "357642af9d753435e999adfe40772b998bfcb21852993081239948e9216bc6fd"

UPSTREAM_CHECK_URI = "http://www.webmin.com/download.html" UPSTREAM_CHECK_REGEX = "webmin-(?P<pver>\d+(\.\d+)+).tar.gz"

inherit perlnative update-rc.d systemd

do_configure() {
# Remove binaries and plugins for other platforms rm -rf acl/Authen-SolarisRBAC-0.1*
rm -rf format bsdexports hpuxexports sgiexports rm -rf zones rbac smf ipfw ipfilter dfsadmin rm -f mount/freebsd-mounts* mount/netbsd-mounts* rm -f mount/openbsd-mounts* mount/macos-mounts*

# Remove some plugins for the moment
rm -rf lilo frox wuftpd telnet pserver cpan shorewall webalizer cfengine fsdump pap
rm -rf majordomo fetchmail sendmail mailboxes procmail filter mailcap dovecot exim spam qmailadmin postfix rm -rf stunnel squid sarg pptp-client pptp-server jabber openslp sentry cluster-* vgetty burner heartbeat

# Adjust configs
[ -f init/config-debian-linux ] && mv init/config-debian-linux init/config-generic-linux
sed -i "s/shutdown_command=.*/shutdown_command=poweroff/" init/config-generic-linux
echo "exclude=bootmisc.sh,single,halt,reboot,hostname.sh,modutils.sh,mountall.sh,mountnfs.sh,networking,populate-volatile.sh,rmnologin.sh,save-rtc.sh,umountfs,umountnfs.sh,hwclock.sh,checkroot.sh,banner.sh,udev,udev-cache,devpts.sh,psplash.sh,sendsigs,fbsetup,bootlogd,stop-bootlogd,sysfs.sh,syslog,syslog.busybox,urandom,webmin,functions.initscripts,read-only-rootfs-hook.sh" >> init/config-generic-linux echo "excludefs=devpts,devtmpfs,usbdevfs,proc,tmpfs,sysfs,debugfs" >> mount/config-generic-linux

[ -f exports/config-debian-linux ] && mv exports/config-debian-linux exports/config-generic-linux sed -i "s/killall -HUP rpc.nfsd && //" exports/config-generic-linux
sed -i "s/netstd_nfs/nfsserver/g" exports/config-generic-linux

# Fix insane naming that causes problems at packaging time (must be done before deleting below) find . -name "*\**" | while read from
do
to=echo "$from" | sed "s/*/ALL/"
mv "$from" "$to"
done

# Remove some other files we don't need
find . -name "config-*" -a \! -name "config-generic-linux" -a \! -name "config-ALL-linux" -a \! -name "*.pl" -delete
find . -regextype posix-extended -regex ".*/(openserver|aix|osf1|osf|openbsd|netbsd|freebsd|unixware|solaris|macos|irix|hpux|cygwin|windows)-lib\.pl" -delete rm -f webmin-gentoo-init webmin-caldera-init webmin-debian-pam webmin-pam

# Don't need these at runtime (and we have our own setup script) rm -f setup.sh
rm -f setup.pl

# Use pidof for finding PIDs
sed -i "s/find_pid_command=.*/find_pid_command=pidof NAME/" config-generic-linux
}

WEBMIN_LOGIN ?= "admin"
WEBMIN_PASSWORD ?= "password"

do_install() {
    install -d ${D}${sysconfdir}
    install -d ${D}${sysconfdir}/webmin
    install -d ${D}${sysconfdir}/init.d
    install -m 0755 webmin-init ${D}${sysconfdir}/init.d/webmin

    install -d ${D}${systemd_unitdir}/system
    install -m 0644 ${WORKDIR}/webmin.service ${D}${systemd_unitdir}/system
    sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
           ${D}${systemd_unitdir}/system/webmin.service

    install -d ${D}${localstatedir}
    install -d ${D}${localstatedir}/webmin

    install -d ${D}${libexecdir}/webmin
    cd ${S} || exit 1
    tar --no-same-owner --exclude='./patches' --exclude='./.pc' -cpf - . \
        | tar --no-same-owner -xpf - -C ${D}${libexecdir}/webmin

    rm -f ${D}${libexecdir}/webmin/webmin-init
    rm -f ${D}${libexecdir}/webmin/ajaxterm/ajaxterm/configure.initd.gentoo
    rm -rf ${D}${libexecdir}/webmin/patches

    # Run setup script
    export perl=perl
    export perl_runtime=${bindir}/perl
    export prefix=${D}
    export tempdir=${S}/install_tmp
    export wadir=${libexecdir}/webmin
    export config_dir=${sysconfdir}/webmin
    export var_dir=${localstatedir}/webmin
    export os_type=generic-linux
    export os_version=0
    export real_os_type="${DISTRO_NAME}"
    export real_os_version="${DISTRO_VERSION}"
    export port=10000
    export login=${WEBMIN_LOGIN}
    export password=${WEBMIN_PASSWORD}
    export ssl=0
    export atboot=1
    export no_pam=1
    mkdir -p $tempdir
    ${S}/../setup.sh

    # Ensure correct PERLLIB path
    sed -i -e 's#${D}##g' ${D}${sysconfdir}/webmin/start
}

INITSCRIPT_NAME = "webmin"
INITSCRIPT_PARAMS = "start 99 5 3 2 . stop 10 0 1 6 ."

SYSTEMD_SERVICE_${PN} = "webmin.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"

#- Modules we want to install initially
PACKAGES += "${PN}-module-acl ${PN}-module-backup-config ${PN}-module-certmgr ${PN}-module-change-user ${PN}-module-cpan ${PN}-module-cron " PACKAGES += "${PN}-module-net ${PN}-module-passwd ${PN}-module-proc ${PN}-module-shell ${PN}-module-status ${PN}-module-system-status " PACKAGES += "${PN}-module-useradmin ${PN}-module-webmin ${PN}-theme-authentic-theme ${PN}-theme-blue-theme ${PN}-theme-gray-theme"

#- Known Perl modules requred for Webmin and installed modules
RDEPENDS_${PN} += "perl perl-module-socket perl-module-exporter perl-module-exporter-heavy perl-module-carp perl-module-strict perl-module-warnings" RDEPENDS_${PN} += "perl-module-xsloader perl-module-posix perl-module-autoloader perl-module-fcntl perl-module-tie-hash perl-module-vars perl-module-cgi" RDEPENDS_${PN} += "perl-module-time-local perl-module-config perl-module-constant perl-module-file-glob perl-module-file-copy perl-module-sdbm-file" RDEPENDS_${PN} += "perl-module-feature perl-module-file-basename perl-module-file-path perl-module-cwd perl-module-file-spec perl-module-file-spec-unix"

#- Known Linux requirementsf or Webmin Modules
RDEPENDS_${PN}-module-proc = "procps"

#- Additional requirements
DEPENDS += "libnet-ssleay-perl libcgi-perl openssl" PACKAGES_DYNAMIC += "webmin-module-* webmin-theme-*" RRECOMMENDS_${PN} += "webmin-module-system-status"

python populate_packages_prepend() {
    import os, os.path

    wadir = bb.data.expand('${libexecdir}/webmin', d)
    wadir_image = bb.data.expand('${D}', d) + wadir
    modules = []
    themes = []
    for mod in os.listdir(wadir_image):
        modinfo = os.path.join(wadir_image, mod, "module.info")
        themeinfo = os.path.join(wadir_image, mod, "theme.info")
        if os.path.exists(modinfo):
            modules.append(mod)
        elif os.path.exists(themeinfo):
            themes.append(mod)

    do_split_packages(d, wadir, '^(%s)$' % "|".join(modules), 'webmin-module-%s', 'Webmin module for %s', extra_depends='perl', allow_dirs=True, prepend=True)
    do_split_packages(d, wadir, '^(%s)$' % "|".join(themes), 'webmin-theme-%s', 'Webmin theme for %s', extra_depends='perl', allow_dirs=True, prepend=True)
}

# Time-savers

package_do_pkgconfig() {
    :
}