xref: /OK3568_Linux_fs/yocto/meta-openembedded/meta-webserver/recipes-webadmin/webmin/webmin_1.850.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1SUMMARY = "Web-based administration interface"
2HOMEPAGE = "http://www.webmin.com"
3LICENSE = "BSD-3-Clause"
4LIC_FILES_CHKSUM = "file://LICENCE;md5=0373ac9f611e542ddebe1ec6394afc3c"
5
6SRC_URI = "${SOURCEFORGE_MIRROR}/webadmin/webmin-${PV}.tar.gz \
7           file://setup.sh \
8           file://init-exclude.patch \
9           file://net-generic.patch \
10           file://remove-startup-option.patch \
11           file://disable-version-check.patch \
12           file://nfs-export.patch \
13           file://exports-lib.pl.patch \
14           file://mount-excludefs.patch \
15           file://samba-config-fix.patch \
16           file://proftpd-config-fix.patch \
17           file://net-lib.pl.patch \
18           file://media-tomb.patch \
19           file://remove-python2.3.patch \
20           file://mysql-config-fix.patch \
21           file://webmin.service \
22            "
23
24SRC_URI[md5sum] = "cd6ee98f73f9418562197675b952d81b"
25SRC_URI[sha256sum] = "c66caa9e4cb50d5447bc8aceb7989d2284dde060278f404b13e171c7ce1690e1"
26
27UPSTREAM_CHECK_URI = "http://www.webmin.com/download.html"
28UPSTREAM_CHECK_REGEX = "webmin-(?P<pver>\d+(\.\d+)+).tar.gz"
29
30inherit perlnative update-rc.d systemd
31
32do_configure() {
33    # Remove binaries and plugins for other platforms
34    rm -rf acl/Authen-SolarisRBAC-0.1*
35    rm -rf format bsdexports hpuxexports sgiexports
36    rm -rf zones rbac smf ipfw ipfilter dfsadmin
37    rm -f mount/freebsd-mounts* mount/netbsd-mounts*
38    rm -f mount/openbsd-mounts* mount/macos-mounts*
39
40    # Remove some plugins for the moment
41    rm -rf lilo frox wuftpd telnet pserver cpan shorewall webalizer cfengine fsdump pap
42    rm -rf majordomo fetchmail sendmail mailboxes procmail filter mailcap dovecot exim spam qmailadmin postfix
43    rm -rf stunnel squid sarg pptp-client pptp-server jabber openslp sentry cluster-* vgetty burner heartbeat
44
45    # Adjust configs
46    [ -f init/config-debian-linux ] && mv init/config-debian-linux init/config-generic-linux
47    sed -i "s/shutdown_command=.*/shutdown_command=poweroff/" init/config-generic-linux
48    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
49    echo "excludefs=devpts,devtmpfs,usbdevfs,proc,tmpfs,sysfs,debugfs" >> mount/config-generic-linux
50
51    [ -f exports/config-debian-linux ] && mv exports/config-debian-linux exports/config-generic-linux
52    sed -i "s/killall -HUP rpc.nfsd && //" exports/config-generic-linux
53    sed -i "s/netstd_nfs/nfsserver/g" exports/config-generic-linux
54
55    # Fix insane naming that causes problems at packaging time (must be done before deleting below)
56    find . -name "*\**" | while read from
57    do
58        to=`echo "$from" | sed "s/*/ALL/"`
59        mv "$from" "$to"
60    done
61
62    # Remove some other files we don't need
63    find . -name "config-*" -a \! -name "config-generic-linux" -a \! -name "config-ALL-linux" -a \! -name "*.pl" -delete
64    find . -regextype posix-extended -regex ".*/(openserver|aix|osf1|osf|openbsd|netbsd|freebsd|unixware|solaris|macos|irix|hpux|cygwin|windows)-lib\.pl" -delete
65    rm -f webmin-gentoo-init webmin-caldera-init webmin-debian-pam webmin-pam
66
67    # Don't need these at runtime (and we have our own setup script)
68    rm -f setup.sh
69    rm -f setup.pl
70
71    # Use pidof for finding PIDs
72    sed -i "s/find_pid_command=.*/find_pid_command=pidof NAME/" config-generic-linux
73}
74
75WEBMIN_LOGIN ?= "admin"
76WEBMIN_PASSWORD ?= "password"
77
78do_install() {
79    install -d ${D}${sysconfdir}
80    install -d ${D}${sysconfdir}/webmin
81    install -d ${D}${sysconfdir}/init.d
82    install -m 0755 webmin-init ${D}${sysconfdir}/init.d/webmin
83
84    install -d ${D}${systemd_unitdir}/system
85    install -m 0644 ${WORKDIR}/webmin.service ${D}${systemd_unitdir}/system
86    sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
87           ${D}${systemd_unitdir}/system/webmin.service
88
89    install -d ${D}${localstatedir}
90    install -d ${D}${localstatedir}/webmin
91
92    install -d ${D}${libexecdir}/webmin
93    cd ${S} || exit 1
94    tar --no-same-owner --exclude='./patches' --exclude='./.pc' -cpf - . \
95        | tar --no-same-owner -xpf - -C ${D}${libexecdir}/webmin
96
97    rm -f ${D}${libexecdir}/webmin/webmin-init
98    rm -f ${D}${libexecdir}/webmin/ajaxterm/ajaxterm/configure.initd.gentoo
99    rm -rf ${D}${libexecdir}/webmin/patches
100
101    # Run setup script
102    export perl=perl
103    export perl_runtime=${bindir}/perl
104    export prefix=${D}
105    export tempdir=${S}/install_tmp
106    export wadir=${libexecdir}/webmin
107    export config_dir=${sysconfdir}/webmin
108    export var_dir=${localstatedir}/webmin
109    export os_type=generic-linux
110    export os_version=0
111    export real_os_type="${DISTRO_NAME}"
112    export real_os_version="${DISTRO_VERSION}"
113    export port=10000
114    export login=${WEBMIN_LOGIN}
115    export password=${WEBMIN_PASSWORD}
116    export ssl=0
117    export atboot=1
118    export no_pam=1
119    mkdir -p $tempdir
120    ${S}/../setup.sh
121
122    # Ensure correct PERLLIB path
123    sed -i -e 's#${D}##g' ${D}${sysconfdir}/webmin/start
124}
125
126INITSCRIPT_NAME = "webmin"
127INITSCRIPT_PARAMS = "start 99 5 3 2 . stop 10 0 1 6 ."
128
129SYSTEMD_SERVICE:${PN} = "webmin.service"
130SYSTEMD_AUTO_ENABLE:${PN} = "disable"
131
132# FIXME: some of this should be figured out automatically
133RDEPENDS:${PN} += "perl perl-module-socket perl-module-exporter perl-module-exporter-heavy perl-module-carp perl-module-strict"
134RDEPENDS:${PN} += "perl-module-warnings perl-module-xsloader perl-module-posix perl-module-autoloader"
135RDEPENDS:${PN} += "perl-module-fcntl perl-module-tie-hash perl-module-vars perl-module-time-local perl-module-config perl-module-constant"
136RDEPENDS:${PN} += "perl-module-file-glob perl-module-file-copy perl-module-sdbm-file perl-module-feature"
137
138PACKAGES_DYNAMIC += "webmin-module-* webmin-theme-*"
139RRECOMMENDS:${PN} += "webmin-module-system-status"
140
141PACKAGES += "${PN}-module-proc ${PN}-module-raid ${PN}-module-exports ${PN}-module-fdisk ${PN}-module-lvm"
142RDEPENDS:${PN}-module-proc = "procps"
143RDEPENDS:${PN}-module-raid = "mdadm"
144RDEPENDS:${PN}-module-exports = "perl-module-file-basename perl-module-file-path perl-module-cwd perl-module-file-spec perl-module-file-spec-unix"
145RRECOMMENDS:${PN}-module-fdisk = "parted"
146RRECOMMENDS:${PN}-module-lvm = "lvm2"
147
148python populate_packages:prepend() {
149    import os, os.path
150
151    wadir = bb.data.expand('${libexecdir}/webmin', d)
152    wadir_image = bb.data.expand('${D}', d) + wadir
153    modules = []
154    themes = []
155    for mod in os.listdir(wadir_image):
156        modinfo = os.path.join(wadir_image, mod, "module.info")
157        themeinfo = os.path.join(wadir_image, mod, "theme.info")
158        if os.path.exists(modinfo):
159            modules.append(mod)
160        elif os.path.exists(themeinfo):
161            themes.append(mod)
162
163    do_split_packages(d, wadir, '^(%s)$' % "|".join(modules), 'webmin-module-%s', 'Webmin module for %s', extra_depends='perl', allow_dirs=True, prepend=True)
164    do_split_packages(d, wadir, '^(%s)$' % "|".join(themes), 'webmin-theme-%s', 'Webmin theme for %s', extra_depends='perl', allow_dirs=True, prepend=True)
165}
166
167# Time-savers
168package_do_pkgconfig() {
169    :
170}
171