1SUMMARY = "Tiny versions of many common UNIX utilities in a single small executable" 2DESCRIPTION = "BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides minimalist replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete POSIX environment for any small or embedded system." 3HOMEPAGE = "http://www.busybox.net" 4BUGTRACKER = "https://bugs.busybox.net/" 5 6DEPENDS += "kern-tools-native virtual/crypt" 7 8# bzip2 applet in busybox is based on lightly-modified bzip2 source 9# the GPL is version 2 only 10LICENSE = "GPLv2 & bzip2" 11LIC_FILES_CHKSUM = "file://LICENSE;md5=de10de48642ab74318e893a61105afbb" 12 13SECTION = "base" 14 15# Whether to split the suid apps into a seperate binary 16BUSYBOX_SPLIT_SUID ?= "1" 17 18export EXTRA_CFLAGS = "${CFLAGS}" 19export EXTRA_LDFLAGS = "${LDFLAGS}" 20 21EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y HOSTCC='${BUILD_CC}' HOSTCPP='${BUILD_CPP}'" 22 23PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}-hwclock" 24 25FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www" 26FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_unitdir}/system/syslog.service ${sysconfdir}/default/busybox-syslog" 27FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*" 28FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd" 29FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc" 30FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh" 31 32INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-mdev ${PN}-hwclock" 33 34INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd" 35INITSCRIPT_NAME_${PN}-hwclock = "hwclock.sh" 36INITSCRIPT_NAME_${PN}-mdev = "mdev" 37INITSCRIPT_PARAMS_${PN}-mdev = "start 04 S ." 38INITSCRIPT_NAME_${PN}-syslog = "syslog" 39INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd" 40 41SYSTEMD_PACKAGES = "${PN}-syslog" 42SYSTEMD_SERVICE_${PN}-syslog = "${@bb.utils.contains('SRC_URI', 'file://syslog.cfg', 'busybox-syslog.service', '', d)}" 43 44RDEPENDS_${PN}-syslog = "busybox" 45CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf" 46RCONFLICTS_${PN}-syslog = "rsyslog sysklogd syslog-ng" 47 48CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf" 49 50RRECOMMENDS_${PN} = "${PN}-udhcpc" 51 52RDEPENDS_${PN} = "${@["", "busybox-inittab"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]}" 53 54inherit cml1 systemd update-rc.d ptest 55 56# busybox's unzip test case needs zip command, which busybox itself does not provide 57RDEPENDS_${PN}-ptest = "zip" 58 59# internal helper 60def busybox_cfg(feature, tokens, cnf, rem): 61 if type(tokens) == type(""): 62 tokens = [tokens] 63 rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens]) 64 if feature: 65 cnf.extend([token + '=y' for token in tokens]) 66 else: 67 cnf.extend(['# ' + token + ' is not set' for token in tokens]) 68 69# Map distro features to config settings 70def features_to_busybox_settings(d): 71 cnf, rem = ([], []) 72 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IPV6', cnf, rem) 73 busybox_cfg(True, 'CONFIG_LFS', cnf, rem) 74 busybox_cfg(True, 'CONFIG_FDISK_SUPPORT_LARGE_DISKS', cnf, rem) 75 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'nls', True, False, d), 'CONFIG_LOCALE_SUPPORT', cnf, rem) 76 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV4', cnf, rem) 77 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV6', cnf, rem) 78 busybox_cfg(bb.utils.contains_any('DISTRO_FEATURES', 'bluetooth wifi', True, False, d), 'CONFIG_RFKILL', cnf, rem) 79 return "\n".join(cnf), "\n".join(rem) 80 81# X, Y = ${@features_to_busybox_settings(d)} 82# unfortunately doesn't seem to work with bitbake, workaround: 83def features_to_busybox_conf(d): 84 cnf, rem = features_to_busybox_settings(d) 85 return cnf 86def features_to_busybox_del(d): 87 cnf, rem = features_to_busybox_settings(d) 88 return rem 89 90configmangle = '/CONFIG_EXTRA_CFLAGS/d; \ 91 ' 92OE_FEATURES := "${@features_to_busybox_conf(d)}" 93OE_DEL := "${@features_to_busybox_del(d)}" 94DO_IPv4 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv4', 1, 0, d)}" 95DO_IPv6 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 1, 0, d)}" 96 97python () { 98 if "${OE_DEL}": 99 d.setVar('configmangle_append', "${OE_DEL}" + "\n") 100 if "${OE_FEATURES}": 101 d.setVar('configmangle_append', 102 "/^### DISTRO FEATURES$/a\\\n%s\n\n" % 103 ("\\n".join((d.expand("${OE_FEATURES}").split("\n"))))) 104 d.setVar('configmangle_append', 105 "/^### CROSS$/a\\\n%s\n" % 106 ("\\n".join(["CONFIG_EXTRA_CFLAGS=\"${CFLAGS} ${HOST_CC_ARCH}\"" 107 ]) 108 )) 109} 110 111do_prepare_config () { 112 if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then 113 export KCONFIG_NOTIMESTAMP=1 114 fi 115 sed -e '/CONFIG_STATIC/d' \ 116 < ${WORKDIR}/defconfig > ${S}/.config 117 echo "# CONFIG_STATIC is not set" >> .config 118 for i in 'CROSS' 'DISTRO FEATURES'; do echo "### $i"; done >> \ 119 ${S}/.config 120 sed -i -e '${configmangle}' ${S}/.config 121 if test ${DO_IPv4} -eq 0 && test ${DO_IPv6} -eq 0; then 122 # disable networking applets 123 mv ${S}/.config ${S}/.config.oe-tmp 124 awk 'BEGIN{net=0} 125 /^# Networking Utilities/{net=1} 126 /^#$/{if(net){net=net+1}} 127 {if(net==2&&$0 !~ /^#/&&$1){print("# "$1" is not set")}else{print}}' \ 128 ${S}/.config.oe-tmp > ${S}/.config 129 fi 130 sed -i 's/CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"/CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -b"/' ${S}/.config 131 sed -i 's|${DEBUG_PREFIX_MAP}||g' ${S}/.config 132} 133 134# returns all the elements from the src uri that are .cfg files 135def find_cfgs(d): 136 sources=src_patches(d, True) 137 sources_list=[] 138 for s in sources: 139 if s.endswith('.cfg'): 140 sources_list.append(s) 141 142 return sources_list 143 144do_configure () { 145 do_prepare_config 146 merge_config.sh -m .config ${@" ".join(find_cfgs(d))} 147 cml1_do_configure 148} 149 150do_compile() { 151 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS 152 if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then 153 export KCONFIG_NOTIMESTAMP=1 154 fi 155 if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then 156 # split the .config into two parts, and make two busybox binaries 157 if [ -e .config.orig ]; then 158 # Need to guard again an interrupted do_compile - restore any backup 159 cp .config.orig .config 160 fi 161 cp .config .config.orig 162 oe_runmake busybox.cfg.suid 163 oe_runmake busybox.cfg.nosuid 164 165 # workaround for suid bug 10346 166 if ! grep -q "CONFIG_SH_IS_NONE" busybox.cfg.nosuid; then 167 echo "CONFIG_SH_IS_NONE" >> busybox.cfg.suid 168 fi 169 170 for i in `cat busybox.cfg.suid busybox.cfg.nosuid`; do 171 echo "# $i is not set" >> .config.disable.apps 172 done 173 merge_config.sh -m .config.orig .config.disable.apps 174 cp .config .config.nonapps 175 for s in suid nosuid; do 176 cat busybox.cfg.$s | while read item; do 177 grep -w "$item" .config.orig 178 done > .config.app.$s 179 180 # workaround for suid bug 10346 181 if [ "$s" = "suid" ] ; then 182 sed "s/.*CONFIG_SH_IS_NONE.*$/CONFIG_SH_IS_NONE=y/" -i .config.app.suid 183 fi 184 185 merge_config.sh -m .config.nonapps .config.app.$s 186 oe_runmake busybox_unstripped 187 mv busybox_unstripped busybox.$s 188 oe_runmake busybox.links 189 sort busybox.links > busybox.links.$s 190 rm busybox.links 191 done 192 193 # hard fail if sh is being linked to the suid busybox (detects bug 10346) 194 if grep -q -x "/bin/sh" busybox.links.suid; then 195 bbfatal "busybox suid binary incorrectly provides /bin/sh" 196 fi 197 198 # copy .config.orig back to .config, because the install process may check this file 199 cp .config.orig .config 200 # cleanup 201 rm .config.orig .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps 202 else 203 oe_runmake busybox_unstripped 204 cp busybox_unstripped busybox 205 oe_runmake busybox.links 206 fi 207} 208 209do_install () { 210 sed -i "s:^/bin/:BASE_BINDIR/:" busybox.links* 211 sed -i "s:^/sbin/:BASE_SBINDIR/:" busybox.links* 212 sed -i "s:^/usr/bin/:BINDIR/:" busybox.links* 213 sed -i "s:^/usr/sbin/:SBINDIR/:" busybox.links* 214 215 # Move arch/link to BINDIR to match coreutils 216 sed -i "s:^BASE_BINDIR/arch:BINDIR/arch:" busybox.links* 217 sed -i "s:^BASE_BINDIR/link:BINDIR/link:" busybox.links* 218 219 sed -i "s:^BASE_BINDIR/:${base_bindir}/:" busybox.links* 220 sed -i "s:^BASE_SBINDIR/:${base_sbindir}/:" busybox.links* 221 sed -i "s:^BINDIR/:${bindir}/:" busybox.links* 222 sed -i "s:^SBINDIR/:${sbindir}/:" busybox.links* 223 224 install -d ${D}${sysconfdir}/init.d 225 226 if ! grep -q "CONFIG_FEATURE_INDIVIDUAL=y" ${B}/.config; then 227 # Install ${base_bindir}/busybox, and the ${base_bindir}/sh link so the postinst script 228 # can run. Let update-alternatives handle the rest. 229 install -d ${D}${base_bindir} 230 if [ "${BUSYBOX_SPLIT_SUID}" = "1" ]; then 231 install -m 4755 ${B}/busybox.suid ${D}${base_bindir} 232 install -m 0755 ${B}/busybox.nosuid ${D}${base_bindir} 233 install -m 0644 ${S}/busybox.links.suid ${D}${sysconfdir} 234 install -m 0644 ${S}/busybox.links.nosuid ${D}${sysconfdir} 235 if grep -q "CONFIG_SH_IS_ASH=y" ${B}/.config; then 236 ln -sf busybox.nosuid ${D}${base_bindir}/sh 237 fi 238 # Keep a default busybox for people who want to invoke busybox directly. 239 # This is also useful for the on device upgrade. Because we want 240 # to use the busybox command in postinst. 241 ln -sf busybox.nosuid ${D}${base_bindir}/busybox 242 else 243 if grep -q "CONFIG_FEATURE_SUID=y" ${B}/.config; then 244 install -m 4755 ${B}/busybox ${D}${base_bindir} 245 else 246 install -m 0755 ${B}/busybox ${D}${base_bindir} 247 fi 248 install -m 0644 ${S}/busybox.links ${D}${sysconfdir} 249 if grep -q "CONFIG_SH_IS_ASH=y" ${B}/.config; then 250 ln -sf busybox ${D}${base_bindir}/sh 251 fi 252 # We make this symlink here to eliminate the error when upgrading together 253 # with busybox-syslog. Without this symlink, the opkg may think of the 254 # busybox.nosuid as obsolete and remove it, resulting in dead links like 255 # ${base_bindir}/sed -> ${base_bindir}/busybox.nosuid. This will make upgrading busybox-syslog fail. 256 # This symlink will be safely deleted in postinst, thus no negative effect. 257 ln -sf busybox ${D}${base_bindir}/busybox.nosuid 258 fi 259 else 260 install -d ${D}${base_bindir} ${D}${bindir} ${D}${libdir} 261 cat busybox.links | while read FILE; do 262 NAME=`basename "$FILE"` 263 install -m 0755 "0_lib/$NAME" "${D}$FILE.${BPN}" 264 done 265 # add suid bit where needed 266 for i in `grep -E "APPLET.*BB_SUID_((MAYBE|REQUIRE))" include/applets.h | grep -v _BB_SUID_DROP | cut -f 3 -d '(' | cut -f 1 -d ','`; do 267 find ${D} -name $i.${BPN} -exec chmod a+s {} \; 268 done 269 install -m 0755 0_lib/libbusybox.so.${PV} ${D}${libdir}/libbusybox.so.${PV} 270 ln -sf sh.${BPN} ${D}${base_bindir}/sh 271 ln -sf ln.${BPN} ${D}${base_bindir}/ln 272 ln -sf test.${BPN} ${D}${bindir}/test 273 if [ -f ${D}/linuxrc.${BPN} ]; then 274 mv ${D}/linuxrc.${BPN} ${D}/linuxrc 275 fi 276 install -m 0644 ${S}/busybox.links ${D}${sysconfdir} 277 fi 278 279 if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then 280 install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog 281 install -m 644 ${WORKDIR}/syslog-startup.conf ${D}${sysconfdir}/syslog-startup.conf 282 install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf 283 fi 284 if grep -q "CONFIG_CROND=y" ${B}/.config; then 285 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/ 286 fi 287 if grep -q "CONFIG_HTTPD=y" ${B}/.config; then 288 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/ 289 install -d ${D}/srv/www 290 fi 291 if grep -q "CONFIG_UDHCPD=y" ${B}/.config; then 292 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/ 293 fi 294 if grep -q "CONFIG_HWCLOCK=y" ${B}/.config; then 295 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/ 296 fi 297 if grep -q "CONFIG_UDHCPC=y" ${B}/.config; then 298 install -d ${D}${sysconfdir}/udhcpc.d 299 install -d ${D}${datadir}/udhcpc 300 install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default 301 sed -i "s:/SBIN_DIR/:${base_sbindir}/:" ${D}${sysconfdir}/udhcpc.d/50default 302 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script 303 fi 304 if grep -q "CONFIG_INETD=y" ${B}/.config; then 305 install -m 0755 ${WORKDIR}/inetd ${D}${sysconfdir}/init.d/inetd.${BPN} 306 sed -i "s:/usr/sbin/:${sbindir}/:" ${D}${sysconfdir}/init.d/inetd.${BPN} 307 install -m 0644 ${WORKDIR}/inetd.conf ${D}${sysconfdir}/ 308 fi 309 if grep -q "CONFIG_MDEV=y" ${B}/.config; then 310 install -m 0755 ${WORKDIR}/mdev ${D}${sysconfdir}/init.d/mdev 311 if grep "CONFIG_FEATURE_MDEV_CONF=y" ${B}/.config; then 312 install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf 313 install -d ${D}${sysconfdir}/mdev 314 install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev 315 install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev 316 fi 317 fi 318 if grep -q "CONFIG_INIT=y" ${B}/.config; then 319 install -D -m 0777 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS 320 install -D -m 0777 ${WORKDIR}/rcK ${D}${sysconfdir}/init.d/rcK 321 fi 322 323 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then 324 if grep -q "CONFIG_KLOGD=y" ${B}/.config; then 325 install -d ${D}${systemd_unitdir}/system 326 sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-klogd.service.in \ 327 > ${D}${systemd_unitdir}/system/busybox-klogd.service 328 fi 329 330 if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then 331 install -d ${D}${systemd_unitdir}/system 332 sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-syslog.service.in \ 333 > ${D}${systemd_unitdir}/system/busybox-syslog.service 334 if [ ! -e ${D}${systemd_unitdir}/system/busybox-klogd.service ] ; then 335 sed -i '/klog/d' ${D}${systemd_unitdir}/system/busybox-syslog.service 336 fi 337 if [ -f ${WORKDIR}/busybox-syslog.default ] ; then 338 install -d ${D}${sysconfdir}/default 339 install -m 0644 ${WORKDIR}/busybox-syslog.default ${D}${sysconfdir}/default/busybox-syslog 340 fi 341 fi 342 fi 343 344 # Remove the sysvinit specific configuration file for systemd systems to avoid confusion 345 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then 346 rm -f ${D}${sysconfdir}/syslog-startup.conf 347 fi 348} 349 350do_install_ptest () { 351 cp -r ${B}/testsuite ${D}${PTEST_PATH}/ 352 cp ${B}/.config ${D}${PTEST_PATH}/ 353 ln -s /bin/busybox ${D}${PTEST_PATH}/busybox 354 355 mkdir ${D}${PTEST_PATH}/bin 356 if [ "${BUSYBOX_SPLIT_SUID}" = "1" ]; then 357 while read link; do 358 ln -s ${base_bindir}/busybox.suid ${D}${PTEST_PATH}/bin/$(basename $link) 359 done <${D}${sysconfdir}/busybox.links.suid 360 while read link; do 361 ln -s ${base_bindir}/busybox.nosuid ${D}${PTEST_PATH}/bin/$(basename $link) 362 done <${D}${sysconfdir}/busybox.links.nosuid 363 else 364 while read link; do 365 ln -s ${base_bindir}/busybox ${D}${PTEST_PATH}/bin/$(basename $link) 366 done <${D}${sysconfdir}/busybox.links 367 fi 368} 369 370inherit update-alternatives 371 372ALTERNATIVE_PRIORITY = "50" 373 374python do_package_prepend () { 375 # We need to load the full set of busybox provides from the /etc/busybox.links 376 # Use this to see the update-alternatives with the right information 377 378 dvar = d.getVar('D') 379 pn = d.getVar('PN') 380 def set_alternative_vars(links, target): 381 links = d.expand(links) 382 target = d.expand(target) 383 f = open('%s%s' % (dvar, links), 'r') 384 for alt_link_name in f: 385 alt_link_name = alt_link_name.strip() 386 alt_name = os.path.basename(alt_link_name) 387 # Match coreutils 388 if alt_name == '[': 389 alt_name = 'lbracket' 390 if alt_name == 'klogd' or alt_name == 'syslogd': 391 d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' ' + alt_name) 392 else: 393 d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name) 394 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name) 395 if os.path.exists('%s%s' % (dvar, target)): 396 d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target) 397 f.close() 398 return 399 400 if os.path.exists('%s/etc/busybox.links' % (dvar)): 401 set_alternative_vars("${sysconfdir}/busybox.links", "${base_bindir}/busybox") 402 else: 403 set_alternative_vars("${sysconfdir}/busybox.links.nosuid", "${base_bindir}/busybox.nosuid") 404 set_alternative_vars("${sysconfdir}/busybox.links.suid", "${base_bindir}/busybox.suid") 405} 406 407pkg_postinst_${PN} () { 408 # This part of code is dedicated to the on target upgrade problem. 409 # It's known that if we don't make appropriate symlinks before update-alternatives calls, 410 # there will be errors indicating missing commands such as 'sed'. 411 # These symlinks will later be updated by update-alternatives calls. 412 test -n 2 > /dev/null || alias test='busybox test' 413 if test "x$D" = "x"; then 414 # Remove busybox.nosuid if it's a symlink, because this situation indicates 415 # that we're installing or upgrading to a one-binary busybox. 416 if test -h ${base_bindir}/busybox.nosuid; then 417 rm -f ${base_bindir}/busybox.nosuid 418 fi 419 for suffix in "" ".nosuid" ".suid"; do 420 if test -e ${sysconfdir}/busybox.links$suffix; then 421 while read link; do 422 if test ! -e "$link"; then 423 # we can use busybox here because even if we are using splitted busybox 424 # we've made a symlink from /bin/busybox to /bin/busybox.nosuid. 425 busybox rm -f $link 426 busybox ln -s "${base_bindir}/busybox$suffix" $link 427 fi 428 done < ${sysconfdir}/busybox.links$suffix 429 fi 430 done 431 fi 432 if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links*; then 433 grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells 434 fi 435} 436 437pkg_prerm_${PN} () { 438 # This is so you can make busybox commit suicide - removing busybox with no other packages 439 # providing its files, this will make update-alternatives work, but the update-rc.d part 440 # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh 441 tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX` 442 ln -s ${base_bindir}/busybox $tmpdir/[ 443 ln -s ${base_bindir}/busybox $tmpdir/test 444 ln -s ${base_bindir}/busybox $tmpdir/head 445 ln -s ${base_bindir}/busybox $tmpdir/sh 446 ln -s ${base_bindir}/busybox $tmpdir/basename 447 ln -s ${base_bindir}/busybox $tmpdir/echo 448 ln -s ${base_bindir}/busybox $tmpdir/mv 449 ln -s ${base_bindir}/busybox $tmpdir/ln 450 ln -s ${base_bindir}/busybox $tmpdir/dirname 451 ln -s ${base_bindir}/busybox $tmpdir/rm 452 ln -s ${base_bindir}/busybox $tmpdir/sed 453 ln -s ${base_bindir}/busybox $tmpdir/sort 454 ln -s ${base_bindir}/busybox $tmpdir/grep 455 ln -s ${base_bindir}/busybox $tmpdir/tail 456 export PATH=$PATH:$tmpdir 457} 458 459pkg_postrm_${PN} () { 460 if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links* && [ ! -e $D${base_bindir}/bash ]; then 461 printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells 462 fi 463} 464 465pkg_prerm_${PN}-syslog () { 466 # remove syslog 467 if test "x$D" = "x"; then 468 if test "$1" = "upgrade" -o "$1" = "remove"; then 469 ${sysconfdir}/init.d/syslog stop || : 470 fi 471 fi 472} 473 474RPROVIDES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/ash', '', d)}" 475