#!/bin/sh

__BITBAKE_LAST_LINE=0

# Emit a useful diagnostic if something fails:
bb_sh_exit_handler() {
    ret=$?
    if [ "$ret" != 0 ]; then
        echo "WARNING: exit code $ret from a shell command."
    fi
    exit $ret
}

bb_bash_exit_handler() {
    ret=$?
    { set +x; } > /dev/null
    trap "" DEBUG
    if [ "$ret" != 0 ]; then
        echo "WARNING: ${BASH_SOURCE[0]}:${__BITBAKE_LAST_LINE} exit $ret from '$1'"

        echo "WARNING: Backtrace (BB generated script): "
        for i in $(seq 1 $((${#FUNCNAME[@]} - 1))); do
            if [ "$i" -eq 1 ]; then
                echo -e "	#$((i)): ${FUNCNAME[$i]}, ${BASH_SOURCE[$((i-1))]}, line ${__BITBAKE_LAST_LINE}"
            else
                echo -e "	#$((i)): ${FUNCNAME[$i]}, ${BASH_SOURCE[$((i-1))]}, line ${BASH_LINENO[$((i-1))]}"
            fi
        done
    fi
    exit $ret
}

bb_bash_debug_handler() {
    local line=${BASH_LINENO[0]}
    # For some reason the DEBUG trap trips with lineno=1 when scripts exit; ignore it
    if [ "$line" -eq 1 ]; then
        return
    fi

    # Track the line number of commands as they execute. This is so we can have access to the failing line number
    # in the EXIT trap. See http://gnu-bash.2382.n7.nabble.com/trap-echo-quot-trap-exit-on-LINENO-quot-EXIT-gt-wrong-linenumber-td3666.html
    if [ "${FUNCNAME[1]}" != "bb_bash_exit_handler" ]; then
        __BITBAKE_LAST_LINE=$line
    fi
}

case $BASH_VERSION in
"") trap 'bb_sh_exit_handler' 0
    set -e
    ;;
*)  trap 'bb_bash_exit_handler "$BASH_COMMAND"' 0
    trap '{ bb_bash_debug_handler; } 2>/dev/null' DEBUG
    set -e
    shopt -s extdebug
    ;;
esac
export AR="aarch64-poky-linux-gcc-ar"
export AS="aarch64-poky-linux-as "
export BUILD_AR="ar"
export BUILD_AS="as "
export BUILD_CC="gcc "
export BUILD_CCLD="gcc "
export BUILD_CFLAGS="-isystem/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/usr/include -O2 -pipe"
export BUILD_CPP="gcc  -E"
export BUILD_CPPFLAGS="-isystem/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/usr/include"
export BUILD_CXX="g++ "
export BUILD_CXXFLAGS="-isystem/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/usr/include -O2 -pipe"
export BUILD_FC="gfortran "
export BUILD_LD="ld "
export BUILD_LDFLAGS="-L/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/usr/lib                         -L/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/lib                         -Wl,-rpath,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/lib                         -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/sim/yocto/scarthgap/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 -pthread"
export BUILD_NM="nm"
export BUILD_RANLIB="ranlib -D"
export BUILD_STRIP="strip"
export CC="aarch64-poky-linux-gcc  -mcpu=cortex-a72+crc -mbranch-protection=standard -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2  --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot"
export CCLD="aarch64-poky-linux-gcc  -mcpu=cortex-a72+crc -mbranch-protection=standard -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2  --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fcanon-prefix-map  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native= "
export CPP="aarch64-poky-linux-gcc -E --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot  -mcpu=cortex-a72+crc -mbranch-protection=standard -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 "
export CPPFLAGS=""
export CXX="aarch64-poky-linux-g++  -mcpu=cortex-a72+crc -mbranch-protection=standard -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2  --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot"
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fcanon-prefix-map  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native=  -fvisibility-inlines-hidden"
export EXTRA_CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fcanon-prefix-map  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native= "
export EXTRA_LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fcanon-prefix-map  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native=  -Wl,-z,relro,-z,now"
export FC="aarch64-poky-linux-gfortran  -mcpu=cortex-a72+crc -mbranch-protection=standard -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2  --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot"
export GIT_CEILING_DIRECTORIES="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1:/home/sim/yocto/scarthgap/build/tmp"
export HOME="/home/sim"
export LC_ALL="en_US.UTF-8"
export LD="aarch64-poky-linux-ld --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot "
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fcanon-prefix-map  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1=/usr/src/debug/busybox/1.36.1  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native=  -Wl,-z,relro,-z,now"
export LOGNAME="sim"
export MAKE="make"
export NM="aarch64-poky-linux-gcc-nm"
export OBJCOPY="aarch64-poky-linux-objcopy"
export OBJDUMP="aarch64-poky-linux-objdump"
export OMP_NUM_THREADS="8"
export PATH="/home/sim/yocto/scarthgap/build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/home/sim/yocto/scarthgap/poky/scripts:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/usr/bin/aarch64-poky-linux:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot/usr/bin/crossscripts:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/usr/sbin:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/usr/bin:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/sbin:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot-native/bin:/home/sim/yocto/scarthgap/poky/bitbake/bin:/home/sim/yocto/scarthgap/build/tmp/hosttools"
export PERL_HASH_SEED="0"
export PKG_CONFIG_DIR="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_DISABLE_UNINSTALLED="yes"
export PKG_CONFIG_LIBDIR="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_PATH="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot/usr/lib/pkgconfig:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot"
export PKG_CONFIG_SYSTEM_INCLUDE_PATH="/usr/include"
export PKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/lib:/usr/lib"
export PSEUDO_DISABLED="0"
export PSEUDO_IGNORE_PATHS="/usr/,/etc/,/usr/lib,/dev/,/run/,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/temp,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot,/home/sim/yocto/scarthgap/sstate-cache,/home/sim/yocto/scarthgap/build/tmp/stamps,/home/sim/yocto/scarthgap/build/tmp/sstate-control,/home/sim/yocto/scarthgap/build/tmp/buildstats,/home/sim/yocto/scarthgap/build/tmp/sysroots-components,/home/sim/yocto/scarthgap/build/tmp/pkgdata,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/deploy-,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/sstate-build-package_,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/sstate-install-package_,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/pkgdata-sysroot,/home/sim/yocto/scarthgap/build/tmp/deploy,/home/sim/yocto/scarthgap/build/cache,/home/sim/yocto/scarthgap/poky/scripts,/home/sim/yocto/scarthgap/poky/meta/files/common-licenses,/home/sim/yocto/scarthgap/poky/meta-openembedded/meta-multimedia/licenses,/home/sim/yocto/scarthgap/poky/meta-openembedded/meta-networking/licenses,/home/sim/yocto/scarthgap/poky/meta-openembedded/meta-oe/licenses,/home/sim/yocto/scarthgap/poky/meta-openembedded/meta-python/licenses,/home/sim/yocto/scarthgap/poky/meta-openembedded/meta-webserver/licenses,/home/sim/yocto/scarthgap/poky/meta-raspberrypi/files/custom-licenses,/home/sim/yocto/scarthgap/poky/meta-qt5/licenses,/home/sim/yocto/scarthgap/poky/meta/COPYING,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1"
export PSEUDO_LOCALSTATEDIR="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/pseudo/"
export PSEUDO_NOSYMLINKEXP="1"
export PSEUDO_PASSWD="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/recipe-sysroot:/home/sim/yocto/scarthgap/build/tmp/sysroots-components/x86_64/pseudo-native"
export PSEUDO_PREFIX="/home/sim/yocto/scarthgap/build/tmp/sysroots-components/x86_64/pseudo-native/usr"
export PYTHONHASHSEED="0"
export RANLIB="aarch64-poky-linux-gcc-ranlib"
export READELF="aarch64-poky-linux-readelf"
unset SHELL
export SOURCE_DATE_EPOCH="1684449060"
export STRINGS="aarch64-poky-linux-strings"
export STRIP="aarch64-poky-linux-strip"
export TZ="UTC"
export USER="sim"
export base_bindir="/usr/bin"
export base_libdir="/usr/lib"
export base_prefix=""
export base_sbindir="/usr/sbin"
export bindir="/usr/bin"
export datadir="/usr/share"
export docdir="/usr/share/doc"
export exec_prefix="/usr"
export includedir="/usr/include"
export infodir="/usr/share/info"
export libdir="/usr/lib"
export libexecdir="/usr/libexec"
export localstatedir="/var"
export mandir="/usr/share/man"
export nonarch_base_libdir="/usr/lib"
export nonarch_libdir="/usr/lib"
export prefix="/usr"
export sbindir="/usr/sbin"
export servicedir="/srv"
export sharedstatedir="/com"
export sysconfdir="/etc"
export systemd_system_unitdir="/usr/lib/systemd/system"
export systemd_unitdir="/usr/lib/systemd"
export systemd_user_unitdir="/usr/lib/systemd/user"

# line: 212, file: /home/sim/yocto/scarthgap/poky/meta/recipes-core/busybox/busybox.inc
do_install() {
	sed -i "s:^/bin/:BASE_BINDIR/:" busybox.links*
	sed -i "s:^/sbin/:BASE_SBINDIR/:" busybox.links*
	sed -i "s:^/usr/bin/:BINDIR/:" busybox.links*
	sed -i "s:^/usr/sbin/:SBINDIR/:" busybox.links*

	# Move arch/link to BINDIR to match coreutils
	sed -i "s:^BASE_BINDIR/arch:BINDIR/arch:" busybox.links*
	sed -i "s:^BASE_BINDIR/link:BINDIR/link:" busybox.links*

	sed -i "s:^BASE_BINDIR/:/usr/bin/:" busybox.links*
	sed -i "s:^BASE_SBINDIR/:/usr/sbin/:" busybox.links*
	sed -i "s:^BINDIR/:/usr/bin/:" busybox.links*
	sed -i "s:^SBINDIR/:/usr/sbin/:" busybox.links*

	install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d

	if ! grep -q "CONFIG_FEATURE_INDIVIDUAL=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
		# Install /usr/bin/busybox, and the /usr/bin/sh link so the postinst script
		# can run. Let update-alternatives handle the rest.
		install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin
		if [ "1" = "1" ]; then
			install -m 4755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/busybox.suid /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin
			install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/busybox.nosuid /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin
			install -m 0644 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/busybox.links.suid /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc
			install -m 0644 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/busybox.links.nosuid /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc
			if grep -q "CONFIG_SH_IS_ASH=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
				ln -sf busybox.nosuid /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin/sh
			fi
			# Keep a default busybox for people who want to invoke busybox directly.
			# This is also useful for the on device upgrade. Because we want
			# to use the busybox command in postinst.
			ln -sf busybox.nosuid /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin/busybox
		else
			if grep -q "CONFIG_FEATURE_SUID=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
				install -m 4755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/busybox /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin
			else
				install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/busybox /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin
			fi
			install -m 0644 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/busybox.links /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc
			if grep -q "CONFIG_SH_IS_ASH=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
				ln -sf busybox /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin/sh
			fi
			# We make this symlink here to eliminate the error when upgrading together
			# with busybox-syslog. Without this symlink, the opkg may think of the
			# busybox.nosuid as obsolete and remove it, resulting in dead links like
			# /usr/bin/sed -> /usr/bin/busybox.nosuid. This will make upgrading busybox-syslog fail.
			# This symlink will be safely deleted in postinst, thus no negative effect.
			ln -sf busybox /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin/busybox.nosuid
		fi
	else
		install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/lib
		cat busybox.links | while read FILE; do
			NAME=`basename "$FILE"`
			install -m 0755 "0_lib/$NAME" "/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image$FILE.busybox"
		done
		# add suid bit where needed
		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
			find /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image -name $i.busybox -exec chmod a+s {} \;
		done
		install -m 0755 0_lib/libbusybox.so.1.36.1 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/lib/libbusybox.so.1.36.1
		ln -sf sh.busybox /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin/sh
		ln -sf ln.busybox /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin/ln
		ln -sf test.busybox /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/bin/test
		if [ -f /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/linuxrc.busybox ]; then
			mv /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/linuxrc.busybox /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/linuxrc
		fi
		install -m 0644 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/busybox.links /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc
	fi

	if grep -q "CONFIG_SYSLOGD=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
		install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/syslog /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/syslog
		install -m 644 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/syslog-startup.conf /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/syslog-startup.conf
		install -m 644 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/syslog.conf /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/syslog.conf
	fi
	if grep -q "CONFIG_CROND=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
		install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-cron /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/
	fi
	if grep -q "CONFIG_HTTPD=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
		install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-httpd /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/
		install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/srv/www
	fi
	if grep -q "CONFIG_UDHCPD=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
		install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-udhcpd /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/
	fi
	if grep -q "CONFIG_HWCLOCK=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
		install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/hwclock.sh /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/
	fi
	if grep -q "CONFIG_UDHCPC=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
		install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/udhcpc.d
		install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/share/udhcpc
		install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/simple.script /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/udhcpc.d/50default
		sed -i "s:/SBIN_DIR/:/usr/sbin/:" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/udhcpc.d/50default
		install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/default.script /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/share/udhcpc/default.script
	fi
	if grep -q "CONFIG_INETD=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
		install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/inetd /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/inetd.busybox
		sed -i "s:/usr/sbin/:/usr/sbin/:" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/inetd.busybox
		install -m 0644 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/inetd.conf /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/
	fi
	if grep -q "CONFIG_MDEV=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
		install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/mdev /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/mdev
		if grep "CONFIG_FEATURE_MDEV_CONF=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
			install -m 644 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/mdev.conf /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/mdev.conf
			install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/mdev
			install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/find-touchscreen.sh /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/mdev
			install -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/mdev-mount.sh /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/mdev
		fi
	fi
	if grep -q "CONFIG_INIT=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config && false; then
		install -D -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/rcS /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/rcS
		install -D -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/rcK /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/init.d/rcK
		install -D -m 0755 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/rcS.default /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/default/rcS
	fi

	if true; then
		if grep -q "CONFIG_KLOGD=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
			install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/lib/systemd/system
			sed 's,@base_sbindir@,/usr/sbin,g' < /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-klogd.service.in \
			> /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/lib/systemd/system/busybox-klogd.service
		fi

		if grep -q "CONFIG_SYSLOGD=y" /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1/.config; then
			install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/lib/systemd/system
			sed 's,@base_sbindir@,/usr/sbin,g' < /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-syslog.service.in \
			> /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/lib/systemd/system/busybox-syslog.service
			if  [ ! -e /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/lib/systemd/system/busybox-klogd.service ] ; then
				sed -i '/klog/d' /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/usr/lib/systemd/system/busybox-syslog.service
			fi
			if [ -f /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-syslog.default ] ; then
				install -d /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/default
				install -m 0644 /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-syslog.default /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/default/busybox-syslog
			fi
		fi
	fi

	# Remove the sysvinit specific configuration file for systemd systems to avoid confusion
	if true; then
		rm -f /home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/image/etc/syslog-startup.conf
	fi
}

cd '/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1/busybox-1.36.1'
do_install

# cleanup
ret=$?
trap '' 0
exit $ret
