1SUMMARY = "The GNU inetutils are a collection of common networking utilities and servers."
2DESCRIPTION = "The GNU inetutils are a collection of common \
3networking utilities and servers including ftp, ftpd, rcp, \
4rexec, rlogin, rlogind, rsh, rshd, syslog, syslogd, talk, \
5talkd, telnet, telnetd, tftp, tftpd, and uucpd."
6HOMEPAGE = "http://www.gnu.org/software/inetutils"
7SECTION = "net"
8DEPENDS = "ncurses netbase readline virtual/crypt"
9
10LICENSE = "GPL-3.0-only"
11
12LIC_FILES_CHKSUM = "file://COPYING;md5=0c7051aef9219dc7237f206c5c4179a7"
13
14SRC_URI[sha256sum] = "87697d60a31e10b5cb86a9f0651e1ec7bee98320d048c0739431aac3d5764fb6"
15SRC_URI = "${GNU_MIRROR}/inetutils/inetutils-${PV}.tar.xz \
16           file://rexec.xinetd.inetutils \
17           file://rlogin.xinetd.inetutils \
18           file://rsh.xinetd.inetutils \
19           file://telnet.xinetd.inetutils \
20           file://tftpd.xinetd.inetutils \
21           "
22
23inherit autotools gettext update-alternatives texinfo
24
25acpaths = "-I ./m4"
26
27PACKAGECONFIG ??= "ftp uucpd \
28                   ${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
29                   ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6 ping6', '', d)} \
30                  "
31PACKAGECONFIG[ftp] = "--enable-ftp,--disable-ftp,readline"
32PACKAGECONFIG[uucpd] = "--enable-uucpd,--disable-uucpd,readline"
33PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam"
34PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6 gl_cv_socket_ipv6=no,"
35PACKAGECONFIG[ping6] = "--enable-ping6,--disable-ping6,"
36
37EXTRA_OECONF = "--with-ncurses-include-dir=${STAGING_INCDIR} \
38        --with-libreadline-prefix=${STAGING_LIBDIR} \
39        --enable-rpath=no \
40        --with-path-login=${base_bindir}/login \
41        --with-path-cp=${base_bindir}/cp \
42        --with-path-uucico=${libexecdir}/uuico \
43        --with-path-procnet-dev=/proc/net/dev \
44        "
45
46EXTRA_OECONF:append:libc-musl = " --with-path-utmpx=/dev/null/utmpx --with-path-wtmpx=/dev/null/wtmpx"
47
48# These are horrible for security, disable them
49EXTRA_OECONF:append = " --disable-rsh --disable-rshd --disable-rcp \
50        --disable-rlogin --disable-rlogind --disable-rexec --disable-rexecd"
51
52# The configure script guesses many paths in cross builds, check for this happening
53do_configure_cross_check() {
54    if grep "may be incorrect because of cross-compilation" ${B}/config.log; then
55        bberror Default path values used, these must be set explicitly
56    fi
57}
58do_configure[postfuncs] += "do_configure_cross_check"
59
60# The --with-path options are not actually options, so this check needs to be silenced
61ERROR_QA:remove = "unknown-configure-option"
62
63do_configure:prepend () {
64    export HELP2MAN='true'
65}
66
67do_install:append () {
68    install -m 0755 -d ${D}${base_sbindir}
69    install -m 0755 -d ${D}${sbindir}
70    install -m 0755 -d ${D}${sysconfdir}/xinetd.d
71    if [ "${base_bindir}" != "${bindir}" ] ; then
72         install -m 0755 -d ${D}${base_bindir}
73         mv ${D}${bindir}/ping* ${D}${base_bindir}/
74         mv ${D}${bindir}/hostname ${D}${base_bindir}/
75         mv ${D}${bindir}/dnsdomainname ${D}${base_bindir}/
76    fi
77    mv ${D}${bindir}/ifconfig ${D}${base_sbindir}/
78    mv ${D}${libexecdir}/syslogd ${D}${base_sbindir}/
79    mv ${D}${libexecdir}/tftpd ${D}${sbindir}/in.tftpd
80    mv ${D}${libexecdir}/telnetd ${D}${sbindir}/in.telnetd
81    if [ -e ${D}${libexecdir}/rexecd ]; then
82        mv ${D}${libexecdir}/rexecd ${D}${sbindir}/in.rexecd
83        cp ${WORKDIR}/rexec.xinetd.inetutils ${D}/${sysconfdir}/xinetd.d/rexec
84    fi
85    if [ -e ${D}${libexecdir}/rlogind ]; then
86        mv ${D}${libexecdir}/rlogind ${D}${sbindir}/in.rlogind
87        cp ${WORKDIR}/rlogin.xinetd.inetutils ${D}/${sysconfdir}/xinetd.d/rlogin
88    fi
89    if [ -e ${D}${libexecdir}/rshd ]; then
90        mv ${D}${libexecdir}/rshd ${D}${sbindir}/in.rshd
91        cp ${WORKDIR}/rsh.xinetd.inetutils ${D}/${sysconfdir}/xinetd.d/rsh
92    fi
93    if [ -e ${D}${libexecdir}/talkd ]; then
94        mv ${D}${libexecdir}/talkd ${D}${sbindir}/in.talkd
95    fi
96    mv ${D}${libexecdir}/uucpd ${D}${sbindir}/in.uucpd
97    mv ${D}${libexecdir}/* ${D}${bindir}/
98    cp ${WORKDIR}/telnet.xinetd.inetutils  ${D}/${sysconfdir}/xinetd.d/telnet
99    cp ${WORKDIR}/tftpd.xinetd.inetutils  ${D}/${sysconfdir}/xinetd.d/tftpd
100
101    sed -e 's,@SBINDIR@,${sbindir},g' -i ${D}/${sysconfdir}/xinetd.d/*
102    if [ -e ${D}${libdir}/charset.alias ]; then
103        rm -rf ${D}${libdir}/charset.alias
104    fi
105    rm -rf ${D}${libexecdir}/
106    # remove usr/lib if empty
107    rmdir ${D}${libdir} || true
108}
109
110PACKAGES =+ "${PN}-ping ${PN}-ping6 ${PN}-hostname ${PN}-ifconfig \
111${PN}-tftp ${PN}-logger ${PN}-traceroute ${PN}-syslogd \
112${PN}-ftp ${PN}-ftpd ${PN}-tftpd ${PN}-telnet ${PN}-telnetd ${PN}-inetd \
113${PN}-rsh ${PN}-rshd"
114
115# The packages tftpd, telnetd and rshd conflict with the ones
116# provided by netkit, so add the corresponding -dbg packages
117# for them to avoid the confliction between the dbg package
118# of inetutils and netkit.
119PACKAGES =+ "${PN}-tftpd-dbg ${PN}-telnetd-dbg ${PN}-rshd-dbg"
120NOAUTOPACKAGEDEBUG = "1"
121
122ALTERNATIVE_PRIORITY = "79"
123ALTERNATIVE:${PN} = "whois dnsdomainname"
124ALTERNATIVE_LINK_NAME[uucpd]  = "${sbindir}/in.uucpd"
125ALTERNATIVE_LINK_NAME[dnsdomainname]  = "${base_bindir}/dnsdomainname"
126
127ALTERNATIVE_PRIORITY_${PN}-logger = "60"
128ALTERNATIVE:${PN}-logger = "logger"
129ALTERNATIVE:${PN}-syslogd = "syslogd"
130ALTERNATIVE_LINK_NAME[syslogd]  = "${base_sbindir}/syslogd"
131
132ALTERNATIVE:${PN}-ftp = "ftp"
133ALTERNATIVE:${PN}-ftpd = "ftpd"
134ALTERNATIVE:${PN}-tftp = "tftp"
135ALTERNATIVE:${PN}-tftpd = "tftpd"
136ALTERNATIVE_LINK_NAME[tftpd] = "${sbindir}/tftpd"
137ALTERNATIVE_TARGET[tftpd]  = "${sbindir}/in.tftpd"
138
139ALTERNATIVE:${PN}-telnet = "telnet"
140ALTERNATIVE:${PN}-telnetd = "telnetd"
141ALTERNATIVE_LINK_NAME[telnetd] = "${sbindir}/telnetd"
142ALTERNATIVE_TARGET[telnetd] = "${sbindir}/in.telnetd"
143
144ALTERNATIVE:${PN}-inetd= "inetd"
145ALTERNATIVE:${PN}-traceroute = "traceroute"
146
147ALTERNATIVE:${PN}-hostname = "hostname"
148ALTERNATIVE_LINK_NAME[hostname]  = "${base_bindir}/hostname"
149
150ALTERNATIVE:${PN}-doc = "hostname.1 dnsdomainname.1 logger.1 syslogd.8 \
151                         tftpd.8 tftp.1 telnetd.8"
152ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
153ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1"
154ALTERNATIVE_LINK_NAME[logger.1] = "${mandir}/man1/logger.1"
155ALTERNATIVE_LINK_NAME[syslogd.8] = "${mandir}/man8/syslogd.8"
156ALTERNATIVE_LINK_NAME[telnetd.8] = "${mandir}/man8/telnetd.8"
157ALTERNATIVE_LINK_NAME[tftpd.8] = "${mandir}/man8/tftpd.8"
158ALTERNATIVE_LINK_NAME[tftp.1] = "${mandir}/man1/tftp.1"
159
160ALTERNATIVE:${PN}-ifconfig = "ifconfig"
161ALTERNATIVE_LINK_NAME[ifconfig]  = "${base_sbindir}/ifconfig"
162
163ALTERNATIVE:${PN}-ping = "ping"
164ALTERNATIVE_LINK_NAME[ping]   = "${base_bindir}/ping"
165
166ALTERNATIVE:${PN}-ping6 = "${@bb.utils.filter('PACKAGECONFIG', 'ping6', d)}"
167ALTERNATIVE_LINK_NAME[ping6]  = "${base_bindir}/ping6"
168
169
170FILES:${PN}-dbg += "${base_bindir}/.debug ${base_sbindir}/.debug ${bindir}/.debug ${sbindir}/.debug"
171FILES:${PN}-ping = "${base_bindir}/ping.${BPN}"
172FILES:${PN}-ping6 = "${base_bindir}/ping6.${BPN}"
173FILES:${PN}-hostname = "${base_bindir}/hostname.${BPN}"
174FILES:${PN}-ifconfig = "${base_sbindir}/ifconfig.${BPN}"
175FILES:${PN}-traceroute = "${bindir}/traceroute.${BPN}"
176FILES:${PN}-logger = "${bindir}/logger.${BPN}"
177
178FILES:${PN}-syslogd = "${base_sbindir}/syslogd.${BPN}"
179RCONFLICTS:${PN}-syslogd = "rsyslog busybox-syslog sysklogd syslog-ng"
180
181FILES:${PN}-ftp = "${bindir}/ftp.${BPN}"
182
183FILES:${PN}-tftp = "${bindir}/tftp.${BPN}"
184FILES:${PN}-telnet = "${bindir}/telnet.${BPN}"
185
186# We make us of RCONFLICTS / RPROVIDES here rather than using the normal
187# alternatives method as this leads to packaging QA issues when using
188# musl as that library does not provide what these applications need to
189# build.
190FILES:${PN}-rsh = "${bindir}/rsh ${bindir}/rlogin ${bindir}/rexec ${bindir}/rcp"
191RCONFLICTS:${PN}-rsh += "netkit-rsh-client"
192RPROVIDES:${PN}-rsh = "rsh"
193
194FILES:${PN}-rshd = "${sbindir}/in.rshd ${sbindir}/in.rlogind ${sbindir}/in.rexecd \
195                    ${sysconfdir}/xinetd.d/rsh ${sysconfdir}/xinetd.d/rlogin ${sysconfdir}/xinetd.d/rexec"
196FILES:${PN}-rshd-dbg = "${sbindir}/.debug/in.rshd ${sbindir}/.debug/in.rlogind ${sbindir}/.debug/in.rexecd"
197RDEPENDS:${PN}-rshd += "xinetd tcp-wrappers"
198RCONFLICTS:${PN}-rshd += "netkit-rshd-server"
199RPROVIDES:${PN}-rshd = "rshd"
200
201FILES:${PN}-ftpd = "${bindir}/ftpd.${BPN}"
202FILES:${PN}-ftpd-dbg = "${bindir}/.debug/ftpd.${BPN}"
203RDEPENDS:${PN}-ftpd += "xinetd"
204
205FILES:${PN}-tftpd = "${sbindir}/in.tftpd ${sysconfdir}/xinetd.d/tftpd"
206FILES:${PN}-tftpd-dbg = "${sbindir}/.debug/in.tftpd"
207RCONFLICTS:${PN}-tftpd += "netkit-tftpd"
208RDEPENDS:${PN}-tftpd += "xinetd"
209
210FILES:${PN}-telnetd = "${sbindir}/in.telnetd ${sysconfdir}/xinetd.d/telnet"
211FILES:${PN}-telnetd-dbg = "${sbindir}/.debug/in.telnetd"
212RCONFLICTS:${PN}-telnetd += "netkit-telnet"
213RPROVIDES:${PN}-telnetd = "telnetd"
214RDEPENDS:${PN}-telnetd += "xinetd"
215
216FILES:${PN}-inetd = "${bindir}/inetd.${BPN}"
217
218RDEPENDS:${PN} = "xinetd"
219