7 XINETD_PACKAGES ??= "${PN}-xinetd"
10 install -d ${D}${sysconfdir}/xinetd.d
11 for srcfile in ${WORKDIR}/*.xinetd.in; do
12 dstfile=`basename $srcfile .xinetd.in`
13 sed -e 's,@BINDIR@,${bindir},' \
14 -e 's,@SBINDIR@,${sbindir},' \
15 $srcfile > ${D}${sysconfdir}/xinetd.d/$dstfile
16 chmod 644 ${D}${sysconfdir}/xinetd.d/$dstfile
21 [ -z "$D" ] && PID=`pidof xinetd` && kill -HUP $PID || true
24 def xinetd_after_parse(d):
25 def xinetd_create_package(pkg):
26 packages = d.getVar('PACKAGES', True).split()
27 if not pkg in packages:
28 packages.insert(0, pkg)
29 d.setVar('PACKAGES', ' '.join(packages))
31 bpn = d.getVar('BPN', 1)
32 if bpn + "-native" != d.getVar('PN', 1) and \
33 bpn + "-cross" != d.getVar('PN', 1) and \
34 bpn + "-nativesdk" != d.getVar('PN', 1):
35 for pkg in d.getVar('XINETD_PACKAGES', True).split():
36 xinetd_create_package(pkg)
38 python __anonymous() {
42 python populate_packages_prepend () {
43 def xinetd_generate_package_scripts(pkg):
44 bb.note('adding xinetd postinst and postrm scripts to %s' % pkg)
46 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
48 postinst = '#!/bin/sh\n'
49 postinst += d.getVar('xinetd_reload', True)
50 d.setVar('pkg_postinst_%s' % pkg, postinst)
52 postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True)
54 postrm = '#!/bin/sh\n'
55 postrm += d.getVar('xinetd_reload', True)
56 d.setVar('pkg_postrm_%s' % pkg, postrm)
58 def xinetd_add_rdepends(pkg):
59 bb.note("adding xinetd dependency to %s" % pkg)
61 rdepends = (d.getVar('RDEPENDS_%s' % pkg, True) or "").split()
62 if pkg.endswith('-xinetd'):
63 basepkg = pkg[:-len('-xinetd')]
64 if not basepkg in rdepends:
65 rdepends.append(basepkg)
66 if not 'xinetd' in rdepends:
67 rdepends.append('xinetd')
68 d.setVar('RDEPENDS_%s' % pkg, ' '.join(rdepends))
70 def xinetd_add_rconflicts(pkg):
71 bb.note("adding xinetd conflicts to %s" % pkg)
73 if pkg.endswith('-xinetd'):
74 rconflicts = (d.getVar('RCONFLICTS_%s' % pkg, True) or "").split()
75 conflictpkg = pkg[:-len('-xinetd')] + '-systemd'
76 if not conflictpkg in rconflicts:
77 rconflicts.append(conflictpkg)
78 d.setVar('RCONFLICTS_%s' % pkg, ' '.join(rconflicts))
80 # run all modifications once when creating package
81 xinetd_dir = '%s/xinetd.d' % d.getVar('sysconfdir', True)
82 if os.path.exists('${D}' + xinetd_dir):
83 for pkg in d.getVar('XINETD_PACKAGES', True).split():
84 services = d.getVar('XINETD_SERVICE_%s' % pkg, True) or d.getVar('XINETD_SERVICE', True) or ""
86 xinetd_generate_package_scripts(pkg)
87 xinetd_add_rdepends(pkg)
88 xinetd_add_rconflicts(pkg)
90 for service in services.split():
91 file_append = '%s/%s' % (xinetd_dir, service)
92 if os.path.exists('${D}' + file_append):
93 var_name = 'FILES_%s' % pkg
94 files = (d.getVar(var_name, False) or "").split()
95 if file_append not in files:
96 files.append(file_append)
97 d.setVar(var_name, ' '.join(files))