blob: da03200b2d0f57d2e5eb77d1dcdb282b67da66fd [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "Toybox combines common utilities together into a single executable."
2HOMEPAGE = "http://www.landley.net/toybox/"
3
4SRC_URI = "http://www.landley.net/toybox/downloads/${BPN}-${PV}.tar.gz"
5
6SRC_URI[md5sum] = "7f4a6c89e56c48e3350e611f5b36c2cf"
7SRC_URI[sha256sum] = "b6e2694d19ac08f1c3416d5b2a02a31d445db2ed98dec89761430cdff2c9710d"
8
9
10LICENSE = "BSD-0-Clause"
11LIC_FILES_CHKSUM = "file://LICENSE;md5=f0b8b3dd6431bcaa245da0a08bd0d511"
12
13SECTION = "base"
14
15do_configure() {
16 oe_runmake defconfig
17
18 # Disable killall5 as it isn't managed by update-alternatives
19 sed -e 's/CONFIG_KILLALL5=y/# CONFIG_KILLALL5 is not set/' -i .config
20}
21
22do_compile() {
23 oe_runmake toybox_unstripped
24
25 # Create a list of links needed
26 oe_runmake generated/instlist
27 ./generated/instlist long | sed -e 's#^#/#' > toybox.links
28}
29
30do_install() {
31 # Install manually instead of using 'make install'
32 install -d ${D}${base_bindir}
33 if grep -q "CONFIG_TOYBOX_SUID=y" ${B}/.config; then
34 install -m 4755 ${B}/toybox_unstripped ${D}${base_bindir}/toybox
35 else
36 install -m 0755 ${B}/toybox_unstripped ${D}${base_bindir}/toybox
37 fi
38
39 install -d ${D}${sysconfdir}
40 install -m 0644 ${B}/toybox.links ${D}${sysconfdir}
41}
42
43inherit update-alternatives
44
45# If you've chosen to install toybox you probably want it to take precedence
46# over busybox where possible but not over other packages
47ALTERNATIVE_PRIORITY = "60"
48
49python do_package_prepend () {
50 # Read links from /etc/toybox.links and create appropriate
51 # update-alternatives variables
52
53 dvar = d.getVar('D', True)
54 pn = d.getVar('PN', True)
55 target = "/bin/toybox"
56
57 f = open('%s/etc/toybox.links' % (dvar), 'r')
58 for alt_link_name in f:
59 alt_link_name = alt_link_name.strip()
60 alt_name = os.path.basename(alt_link_name)
61 d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name)
62 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name)
63 d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target)
64 f.close()
65}