diff options
Diffstat (limited to 'recipes-core/busybox')
-rw-r--r-- | recipes-core/busybox/busybox_%.bbappend | 58 |
1 files changed, 5 insertions, 53 deletions
diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend index 1c6ab1c..3c3d7f0 100644 --- a/recipes-core/busybox/busybox_%.bbappend +++ b/recipes-core/busybox/busybox_%.bbappend @@ -128,36 +128,6 @@ do_install () { fi } -python do_package_prepend () { - # We need to load the full set of busybox provides from the /etc/busybox.links - # Use this to see the update-alternatives with the right information - - dvar = d.getVar('D', True) - pn = d.getVar('PN', True) - def set_alternative_vars(links, target): - f = open('%s%s' % (dvar, links), 'r') - for alt_link_name in f: - alt_link_name = alt_link_name.strip() - alt_name = os.path.basename(alt_link_name) - # Match coreutils - if alt_name == '[': - alt_name = 'lbracket' - d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name) - d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name) - if os.path.exists('%s%s' % (dvar, target)): - d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target) - f.close() - return - - base_bindir = d.getVar('base_bindir', True) - - if os.path.exists('%s/etc/busybox.links' % (dvar)): - set_alternative_vars("/etc/busybox.links", base_bindir + "/busybox") - else: - set_alternative_vars("/etc/busybox.links.nosuid", base_bindir + "/busybox.nosuid") - set_alternative_vars("/etc/busybox.links.suid", base_bindir + "/busybox.suid") -} - pkg_postinst_${PN} () { # This part of code is dedicated to the on target upgrade problem. # It's known that if we don't make appropriate symlinks before update-alternatives calls, @@ -175,33 +145,15 @@ pkg_postinst_${PN} () { while read link; do if test ! -e "$link"; then # we can use busybox here because even if we are using splitted busybox - # we've made a symlink from ${base_bindir}/busybox to ${base_bindir}/busybox.nosuid. + # we've made a symlink from /bin/busybox to /bin/busybox.nosuid. + # The sed expression will fail if ${base_bindir}, ${base_sbindir}, ${bindir} or + # ${sbindir} contains . or .., so don't do that! + to="$(echo -n "$link" | busybox sed -r -e 's@^/[^/]+/@@' -e 's@[^/]+@..@g')${base_bindir}/busybox$suffix" busybox rm -f $link - busybox ln -s ${base_bindir}/busybox$suffix $link + busybox ln -s $to $link fi done < /etc/busybox.links$suffix fi done fi } - -pkg_prerm_${PN} () { - # This is so you can make busybox commit suicide - removing busybox with no other packages - # providing its files, this will make update-alternatives work, but the update-rc.d part - # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh - tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX` - ln -s ${base_bindir}/busybox $tmpdir/[ - ln -s ${base_bindir}/busybox $tmpdir/test - ln -s ${base_bindir}/busybox $tmpdir/head - ln -s ${base_bindir}/busybox $tmpdir/sh - ln -s ${base_bindir}/busybox $tmpdir/basename - ln -s ${base_bindir}/busybox $tmpdir/echo - ln -s ${base_bindir}/busybox $tmpdir/mv - ln -s ${base_bindir}/busybox $tmpdir/ln - ln -s ${base_bindir}/busybox $tmpdir/dirname - ln -s ${base_bindir}/busybox $tmpdir/rm - ln -s ${base_bindir}/busybox $tmpdir/sed - ln -s ${base_bindir}/busybox $tmpdir/sort - ln -s ${base_bindir}/busybox $tmpdir/grep - export PATH=$PATH:$tmpdir -} |