blob: 308582398db18d27720163dc4242d8407f960856 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001DESCRIPTION = "netkit-rwho includes, ruptime rwho and rwhod (Daemon to maintain data for rwho/ruptime)"
2HOMEPAGE = "ftp://ftp.uk.linux.org/pub/linux/Networking/netkit"
3SECTION = "net"
Brad Bishop2d39a062019-10-28 08:33:36 -04004LICENSE = "BSD-4-Clause"
Patrick Williamsb48b7b42016-08-17 15:04:38 -05005LIC_FILES_CHKSUM = "file://rwho/rwho.c;beginline=2;endline=3;md5=5a85f13c0142d72fc378e00f15da5b9e"
6
7SRC_URI = "${DEBIAN_MIRROR}/main/n/netkit-rwho/netkit-rwho_${PV}.orig.tar.gz;name=archive \
Andrew Geissler82c905d2020-04-13 13:39:40 -05008 ${DEBIAN_MIRROR}/main/n/netkit-rwho/netkit-rwho_${PV}-13.debian.tar.gz;subdir=${BP};name=patch13 \
Patrick Williamsb48b7b42016-08-17 15:04:38 -05009 file://rwhod \
10 file://rwhod.default \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011 file://0001-Add-missing-include-path-to-I-options.patch \
12 file://0002-Fix-build-issues-found-with-musl.patch \
13 "
Patrick Williamsb48b7b42016-08-17 15:04:38 -050014SRC_URI[archive.md5sum] = "0f71620d45d472f89134ba0d74242e75"
15SRC_URI[archive.sha256sum] = "0409e2ce4bfdb2dacb2c193d0fedfc49bb975cb057c5c6b0ffcca603a1188da7"
16SRC_URI[patch13.md5sum] = "82ed5a3c6b0bbf00b36508b9787963b9"
17SRC_URI[patch13.sha256sum] = "53aefa27d98b565bf756db57120c03bd224a238e45699d92076420272a6eba8e"
18
19inherit autotools-brokensep useradd update-rc.d update-alternatives
20
21CFLAGS += " -D_GNU_SOURCE"
22
Andrew Geissler82c905d2020-04-13 13:39:40 -050023# Unlike other Debian packages, net-tools *.diff.gz contains another series of
24# patches maintained by quilt. So manually apply them before applying other local
25# patches. Also remove all temp files before leaving, because do_patch() will pop
26# up all previously applied patches in the start
27do_patch[depends] += "quilt-native:do_populate_sysroot"
28netkit_do_patch() {
29 cd ${S}
30 # it's important that we only pop the existing patches when they've
31 # been applied, otherwise quilt will climb the directory tree
32 # and reverse out some completely different set of patches
33 if [ -d ${S}/patches ]; then
34 # whilst this is the default directory, doing it like this
35 # defeats the directory climbing that quilt will otherwise
36 # do; note the directory must exist to defeat this, hence
37 # the test inside which we operate
38 QUILT_PATCHES=${S}/patches quilt pop -a
39 fi
40 if [ -d ${S}/.pc-${BPN} ]; then
41 rm -rf ${S}/.pc
42 mv ${S}/.pc-${BPN} ${S}/.pc
43 QUILT_PATCHES=${S}/debian/patches quilt pop -a
44 rm -rf ${S}/.pc ${S}/debian
45 fi
46 QUILT_PATCHES=${S}/debian/patches quilt push -a
47 mv ${S}/.pc ${S}/.pc-${BPN}
Patrick Williamsb48b7b42016-08-17 15:04:38 -050048}
49
Andrew Geissler82c905d2020-04-13 13:39:40 -050050do_unpack[cleandirs] += "${S}"
51
Patrick Williamsb48b7b42016-08-17 15:04:38 -050052python do_patch() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050053 bb.build.exec_func('netkit_do_patch', d)
Patrick Williamsb48b7b42016-08-17 15:04:38 -050054 bb.build.exec_func('patch_do_patch', d)
55}
56
57do_configure () {
58 ./configure --prefix=${prefix}
59 echo "LDFLAGS=${LDFLAGS}" >> MCONFIG
60}
61
62do_install () {
63 # rwho & ruptime
64 install -d ${D}${bindir}
65 install -d ${D}${mandir}/man1
66 #rwhod
67 install -d ${D}${sbindir}
68 install -d ${D}${mandir}/man8
69 install -d ${D}${sysconfdir}/init.d
70 install -d ${D}${sysconfdir}/default
71 sed -i 's/install -s/install/' rwho/Makefile
72 sed -i 's/install -s/install/' ruptime/Makefile
73 sed -i 's/install -s/install/' rwhod/Makefile
74 oe_runmake 'INSTALLROOT=${D}' 'BINMODE=0755' \
75 'DAEMONMODE=0755' 'MANMODE=0644' \
76 'BINDIR=${bindir}' 'SBINDIR=${sbindir}' \
77 'MANDIR=${mandir}' install
78
79 install -m 0644 ${WORKDIR}/rwhod.default ${D}${sysconfdir}/default/rwhod
80 install -m 755 ${WORKDIR}/rwhod ${D}${sysconfdir}/init.d
81
82 mkdir -p -m 755 ${D}${localstatedir}/spool/rwho
83 chown -R rwhod ${D}${localstatedir}/spool/rwho
84}
Andrew Geisslerd688a012020-09-18 13:36:00 -050085pkg_postinst_ontarget_${PN}-server() {
Patrick Williamsb48b7b42016-08-17 15:04:38 -050086 ${sysconfdir}/init.d/rwhod start
87}
88
89pkg_postrm_${PN}-server() {
90 ${sysconfdir}/init.d/rwhod stop
91}
92
93INITSCRIPT_NAME = "rwhod"
94INITSCRIPT_PARAM = "defaults 85 15"
95
96USERADD_PACKAGES = "${PN}-server"
97GROUPADD_PARAM_${PN}-server = "--system rwhod"
98USERADD_PARAM_${PN}-server = "--system -g rwhod --home-dir ${localstatedir}/spool/rwho \
99 --no-create-home --shell /bin/false rwhod"
100
101INSANE_SKIP_${PN} = "already-stripped"
102
103PACKAGES = "${PN}-client ${PN}-server ${PN}-doc ${BPN}-dbg"
104FILES_${PN}-client = "${bindir}/*"
105FILES_${PN}-server = "${sbindir}/* ${localstatedir} ${sysconfdir}/default/* ${sysconfdir}/init.d/*"
106FILES_${PN}-doc = "${mandir}"
107FILES_${PN}-dbg = "${prefix}/src/debug \
108 ${bindir}/.debug ${sbindir}/.debug"