#!/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 ARCH="arm64"
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/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/include -O2 -pipe"
export BUILD_CPP="gcc  -E"
export BUILD_CPPFLAGS="-isystem/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/include"
export BUILD_CXX="g++ "
export BUILD_CXXFLAGS="-isystem/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/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/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/lib                         -L/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/lib                         -Wl,-rpath,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/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 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot"
export CCLD="aarch64-poky-linux-gcc  -mcpu=cortex-a72+crc -mbranch-protection=standard -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fcanon-prefix-map  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native= "
export CPP="aarch64-poky-linux-gcc -E --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot  -mcpu=cortex-a72+crc -mbranch-protection=standard -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security"
export CPPFLAGS=""
export CXX="aarch64-poky-linux-g++  -mcpu=cortex-a72+crc -mbranch-protection=standard -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot"
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fcanon-prefix-map  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native=  -fvisibility-inlines-hidden"
export FC="aarch64-poky-linux-gfortran  -mcpu=cortex-a72+crc -mbranch-protection=standard -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot"
export GIT_CEILING_DIRECTORIES="/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0:/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/raspberrypi4_64-poky-linux/simos-image/1.0/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/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0=/usr/src/debug/simos-image/1.0  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/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 PACKAGE_INSTALL="apt base-passwd dpkg packagegroup-base-extended packagegroup-core-boot packagegroup-core-full-cmdline packagegroup-core-ssh-openssh packagegroup-simos psplash run-postinsts shadow"
export PATH="/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot/usr/bin/crossscripts:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot//usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/crossscripts:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot/usr/bin/crossscripts:/home/sim/yocto/scarthgap/build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/bin/python3-native:/home/sim/yocto/scarthgap/poky/scripts:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/bin/aarch64-poky-linux:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot/usr/bin/crossscripts:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/sbin:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/bin:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/sbin:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/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/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_DISABLE_UNINSTALLED="yes"
export PKG_CONFIG_LIBDIR="/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_PATH="/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot/usr/lib/pkgconfig:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/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/raspberrypi4_64-poky-linux/simos-image/1.0/temp,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/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/raspberrypi4_64-poky-linux/simos-image/1.0/deploy-,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/sstate-build-package_,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/sstate-install-package_,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/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/raspberrypi4_64-poky-linux/simos-image/1.0/x86_64-deploy-simos-image-populate-sdk,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/oe-sdk-repo,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/sstate-build-populate_sdk,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/intercept_scripts,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/oe-rootfs-repo,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/sstate-build-image_complete,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/build-wic,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0"
export PSEUDO_LOCALSTATEDIR="/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/pseudo/"
export PSEUDO_NOSYMLINKEXP="1"
export PSEUDO_PASSWD="/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-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"
export REPRODUCIBLE_TIMESTAMP_ROOTFS="1520598896"
unset SHELL
export SOURCE_DATE_EPOCH="1302044400"
export STRINGS="aarch64-poky-linux-strings"
export STRIP="aarch64-poky-linux-strip"
export TZ="UTC"
export UBOOT_ARCH="arm64"
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: 29, file: /home/sim/yocto/scarthgap/poky/meta/classes/extrausers.bbclass
set_user_group() {
	user_group_settings="     usermod -p '\$6\$9JyS25njyw4ZS6u.\$UQc3D2pKC1hkZzNdPNVmXBfuYa/vFCSMjrZu1LbMwqokjSqtPAHm0tbvBNQzZjqLq54xlmGDaoxUQOOr9.lrf/' root;     groupadd -f sudo;     useradd --create-home -G sudo -p '\$6\$rSJ/6W7K1P2RWm56\$OACdNzjkjTfKx701fivBJYrzg2e5ETfP8.ekSpXIPKSMZNP.SB6bgPpG59a77xyirlGPotlgW2j2SLoYWYq48/' sim; "
	export PSEUDO="PSEUDO_PREFIX=/home/sim/yocto/scarthgap/build/tmp/sysroots-components/x86_64/pseudo-native/usr PSEUDO_LOCALSTATEDIR=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/pseudo/ PSEUDO_PASSWD=/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs:/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native PSEUDO_NOSYMLINKEXP=1 PSEUDO_IGNORE_PATHS=/usr/,/etc/,/usr/lib,/dev/,/run/,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/temp,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/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/raspberrypi4_64-poky-linux/simos-image/1.0/deploy-,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/sstate-build-package_,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/sstate-install-package_,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/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/raspberrypi4_64-poky-linux/simos-image/1.0/x86_64-deploy-simos-image-populate-sdk,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/oe-sdk-repo,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/sstate-build-populate_sdk,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/intercept_scripts,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/oe-rootfs-repo,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/sstate-build-image_complete,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/build-wic,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0,/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/simos-image-1.0 PSEUDO_DISABLED=0 /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/recipe-sysroot-native/usr/bin/pseudo"
	setting=`echo $user_group_settings | cut -d ';' -f1`
	remaining=`echo $user_group_settings | cut -d ';' -f2-`
	while test "x$setting" != "x"; do
		cmd=`echo $setting | cut -d ' ' -f1`
		opts=`echo $setting | cut -d ' ' -f2-`
		# Different from useradd.bbclass, there's no file locking issue here, as
		# this setting is actually a serial process. So we only retry once.
		case $cmd in
			useradd)
				perform_useradd "/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs" "-R /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs $opts"
				;;
			groupadd)
				perform_groupadd "/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs" "-R /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs $opts"
				;;
			userdel)
				perform_userdel "/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs" "-R /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs $opts"
				;;
			groupdel)
				perform_groupdel "/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs" "-R /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs $opts"
				;;
			usermod)
				perform_usermod "/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs" "-R /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs $opts"
				;;
			passwd-expire)
				perform_passwd_expire "/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs" "$opts"
				;;
			groupmod)
				perform_groupmod "/home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs" "-R /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/rootfs $opts"
				;;
			*)
				bbfatal "Invalid command in EXTRA_USERS_PARAMS: $cmd"
				;;
		esac
		# Avoid infinite loop if the last parameter doesn't end with ';'
		if [ "$setting" = "$remaining" ]; then
			break
		fi
		# iterate to the next setting
		setting=`echo $remaining | cut -d ';' -f1`
		remaining=`echo $remaining | cut -d ';' -f2-`
	done
}

# line: 60, file: /home/sim/yocto/scarthgap/poky/meta/classes-global/logging.bbclass
bbfatal() {
	if [ -p /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/temp/fifo.1207825 ] ; then
		printf "%b\0" "bbfatal $*" > /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/temp/fifo.1207825
	else
		echo "ERROR: $*"
	fi
	exit 1
}

# line: 19, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_groupadd() {
	local rootdir="$1"
	local opts="$2"
	bbnote "simos-image: Performing groupadd with [$opts]"
	local groupname=`echo "$opts" | awk '{ print $NF }'`
	local group_exists="`grep "^$groupname:" $rootdir/etc/group || true`"
	if test "x$group_exists" = "x"; then
		eval flock -x $rootdir/etc -c \"$PSEUDO groupadd \$opts\" || true
		group_exists="`grep "^$groupname:" $rootdir/etc/group || true`"
		if test "x$group_exists" = "x"; then
			bbfatal "simos-image: groupadd command did not succeed."
		fi
	else
		bbnote "simos-image: group $groupname already exists, not re-creating it"
	fi
}

# line: 72, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_groupdel() {
	local rootdir="$1"
	local opts="$2"
	bbnote "simos-image: Performing groupdel with [$opts]"
	local groupname=`echo "$opts" | awk '{ print $NF }'`
	local group_exists="`grep "^$groupname:" $rootdir/etc/group || true`"

	if test "x$group_exists" != "x"; then
		local awk_input='BEGIN {FS=":"}; $1=="'$groupname'" { print $3 }'
		local groupid=`echo "$awk_input" | awk -f- $rootdir/etc/group`
		local awk_check_users='BEGIN {FS=":"}; $4=="'$groupid'" {print $1}'
		local other_users=`echo "$awk_check_users" | awk -f- $rootdir/etc/passwd`

		if test "x$other_users" = "x"; then
			eval flock -x $rootdir/etc -c \"$PSEUDO groupdel \$opts\" || true
			group_exists="`grep "^$groupname:" $rootdir/etc/group || true`"
			if test "x$group_exists" != "x"; then
				bbfatal "simos-image: groupdel command did not succeed."
			fi
		else
			bbnote "simos-image: '$groupname' is primary group for users '$other_users', not removing it"
		fi
	else
		bbnote "simos-image: group $groupname doesn't exist, not removing it"
	fi
}

# line: 116, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_groupmod() {
	# Other than the return value of groupmod, there's no simple way to judge whether the command
	# succeeds, so we disable -e option temporarily
	set +e
	local rootdir="$1"
	local opts="$2"
	bbnote "simos-image: Performing groupmod with [$opts]"
	local groupname=`echo "$opts" | awk '{ print $NF }'`
	local group_exists="`grep "^$groupname:" $rootdir/etc/group || true`"
	if test "x$group_exists" != "x"; then
		eval flock -x $rootdir/etc -c \"$PSEUDO groupmod \$opts\"
		if test $? != 0; then
			bbwarn "simos-image: groupmod command did not succeed."
		fi
	else
		bbwarn "simos-image: group $groupname doesn't exist, unable to modify it"
	fi
	set -e
}

# line: 155, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_passwd_expire() {
	local rootdir="$1"
	local opts="$2"
	bbnote "simos-image: Performing equivalent of passwd --expire with [$opts]"
	# Directly set sp_lstchg to 0 without using the passwd command: Only root can do that
	local username=`echo "$opts" | awk '{ print $NF }'`
	local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
	if test "x$user_exists" != "x"; then
		eval flock -x $rootdir/etc -c \"$PSEUDO sed --follow-symlinks -i \''s/^\('$username':[^:]*\):[^:]*:/\1:0:/'\' $rootdir/etc/shadow \" || true
		local passwd_lastchanged="`grep "^$username:" $rootdir/etc/shadow | cut -d: -f3`"
		if test "x$passwd_lastchanged" != "x0"; then
			bbfatal "simos-image: passwd --expire operation did not succeed."
		fi
	else
		bbnote "simos-image: user $username doesn't exist, not expiring its password"
	fi
}

# line: 36, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_useradd() {
	local rootdir="$1"
	local opts="$2"
	bbnote "simos-image: Performing useradd with [$opts]"
	local username=`echo "$opts" | awk '{ print $NF }'`
	local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
	if test "x$user_exists" = "x"; then
		eval flock -x $rootdir/etc -c  \"$PSEUDO useradd \$opts\" || true
		user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
		if test "x$user_exists" = "x"; then
			bbfatal "simos-image: useradd command did not succeed."
		fi
	else
		bbnote "simos-image: user $username already exists, not re-creating it"
	fi
}

# line: 99, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_userdel() {
	local rootdir="$1"
	local opts="$2"
	bbnote "simos-image: Performing userdel with [$opts]"
	local username=`echo "$opts" | awk '{ print $NF }'`
	local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
	if test "x$user_exists" != "x"; then
		eval flock -x $rootdir/etc -c \"$PSEUDO userdel \$opts\" || true
		user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
		if test "x$user_exists" != "x"; then
			bbfatal "simos-image: userdel command did not succeed."
		fi
	else
		bbnote "simos-image: user $username doesn't exist, not removing it"
	fi
}

# line: 136, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_usermod() {
	# Same reason with groupmod, temporarily disable -e option
	set +e
	local rootdir="$1"
	local opts="$2"
	bbnote "simos-image: Performing usermod with [$opts]"
	local username=`echo "$opts" | awk '{ print $NF }'`
	local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`"
	if test "x$user_exists" != "x"; then
		eval flock -x $rootdir/etc -c \"$PSEUDO usermod \$opts\"
		if test $? != 0; then
			bbfatal "simos-image: usermod command did not succeed."
		fi
	else
		bbwarn "simos-image: user $username doesn't exist, unable to modify it"
	fi
	set -e
}

# line: 27, file: /home/sim/yocto/scarthgap/poky/meta/classes-global/logging.bbclass
bbnote() {
	if [ -p /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/temp/fifo.1207825 ] ; then
		printf "%b\0" "bbnote $*" > /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/temp/fifo.1207825
	else
		echo "NOTE: $*"
	fi
}

# line: 38, file: /home/sim/yocto/scarthgap/poky/meta/classes-global/logging.bbclass
bbwarn() {
	if [ -p /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/temp/fifo.1207825 ] ; then
		printf "%b\0" "bbwarn $*" > /home/sim/yocto/scarthgap/build/tmp/work/raspberrypi4_64-poky-linux/simos-image/1.0/temp/fifo.1207825
	else
		echo "WARNING: $*"
	fi
}

set_user_group

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