#!/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/systemd/255.22/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/systemd/255.22/recipe-sysroot-native/usr/include"
export BUILD_CXX="g++ "
export BUILD_CXXFLAGS="-isystem/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/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/systemd/255.22/recipe-sysroot-native/usr/lib                         -L/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/lib                         -Wl,-rpath,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/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/cortexa72-poky-linux/systemd/255.22/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/cortexa72-poky-linux/systemd/255.22/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/systemd/255.22/git=/usr/src/debug/systemd/255.22  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/git=/usr/src/debug/systemd/255.22  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/build=/usr/src/debug/systemd/255.22  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/build=/usr/src/debug/systemd/255.22  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native= "
export CPP="aarch64-poky-linux-gcc -E --sysroot=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/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/cortexa72-poky-linux/systemd/255.22/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/systemd/255.22/git=/usr/src/debug/systemd/255.22  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/git=/usr/src/debug/systemd/255.22  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/build=/usr/src/debug/systemd/255.22  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/build=/usr/src/debug/systemd/255.22  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/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/cortexa72-poky-linux/systemd/255.22/recipe-sysroot"
export GETTEXTDATADIRS=":/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot/usr/share/gettext"
export GIT_CEILING_DIRECTORIES="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22:/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/systemd/255.22/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/systemd/255.22/git=/usr/src/debug/systemd/255.22  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/git=/usr/src/debug/systemd/255.22  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/build=/usr/src/debug/systemd/255.22  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/build=/usr/src/debug/systemd/255.22  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot=  -fmacro-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot=  -fdebug-prefix-map=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/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/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/usr/bin/python3-native:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/usr/bin/perl-native:/home/sim/yocto/scarthgap/poky/scripts:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/usr/bin/aarch64-poky-linux:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot/usr/bin/crossscripts:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/usr/sbin:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/usr/bin:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/sbin:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/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/systemd/255.22/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/systemd/255.22/recipe-sysroot/usr/lib/pkgconfig"
export PKG_CONFIG_PATH="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot/usr/lib/pkgconfig:/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot"
export PKG_CONFIG_SYSTEM_INCLUDE_PATH="/usr/include"
export PKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/lib:/usr/lib"
export PSEUDO_DISABLED="1"
export PSEUDO_UNLOAD="1"
export PYTHON="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot-native/usr/bin/python3-native/python3"
export PYTHONHASHSEED="0"
export PYTHONNOUSERSITE="1"
export PYTHON_INCLUDE_DIR="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot/usr/include/python3.12"
export PYTHON_LIBRARY="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot/usr/lib/libpython3.12.so"
export RANLIB="aarch64-poky-linux-gcc-ranlib"
export READELF="aarch64-poky-linux-readelf"
unset SHELL
export SOURCE_DATE_EPOCH="1750927453"
export STAGING_DIR_HOST="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot"
export STAGING_INCDIR="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot/usr/include"
export STAGING_LIBDIR="/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot/usr/lib"
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: 105, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd.bbclass
useradd_sysroot() {
	user_group_groupmems_add_sysroot user
}

# line: 117, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd.bbclass
user_group_groupmems_add_sysroot() {
	# Pseudo may (do_prepare_recipe_sysroot) or may not (do_populate_sysroot_setscene) be running
	# at this point so we're explicit about the environment so pseudo can load if
	# not already present.
	# PSEUDO_SYSROOT can contain references to the build architecture and COMPONENT_DIR
	# so needs the STAGING_FIXME below
	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/cortexa72-poky-linux/systemd/255.22/pseudo/ PSEUDO_PASSWD=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot:/home/sim/yocto/scarthgap/build/tmp/sysroots-components/x86_64/pseudo-native PSEUDO_NOSYMLINKEXP=1 PSEUDO_IGNORE_PATHS=/usr/,/etc/,/usr/lib,/dev/,/run/,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/temp,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/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/systemd/255.22/deploy-,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/sstate-build-package_,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/sstate-install-package_,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/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/systemd/255.22/git,/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/build PSEUDO_DISABLED=0 /home/sim/yocto/scarthgap/build/tmp/sysroots-components/x86_64/pseudo-native/usr/bin/pseudo"

	# Explicitly set $D since it isn't set to anything
	# before do_prepare_recipe_sysroot
	D=/home/sim/yocto/scarthgap/build/tmp/work/cortexa72-poky-linux/systemd/255.22/recipe-sysroot

	# base-passwd's postinst may not have run yet in which case we'll get called later, just exit.
	# Beware that in some cases we might see the fake pseudo passwd here, in which case we also must
	# exit.
	if [ ! -f $D/etc/passwd ] ||
			grep -q this-is-the-pseudo-passwd $D/etc/passwd; then
		exit 0
	fi

	# It is also possible we may be in a recipe which doesn't have useradd dependencies and hence the
	# useradd/groupadd tools are unavailable. If there is no dependency, we assume we don't want to
	# create users in the sysroot
	if ! command -v useradd; then
		bbwarn "command useradd not found!"
		exit 0
	fi

	# Add groups and users defined for all recipe packages
	if test "$1" = "group"; then
		GROUPADD_PARAM="-r systemd-journal; -r render"
	elif test "$1" = "user"; then
		USERADD_PARAM="   --system --no-create-home --user-group --home-dir /etc/polkit-1 polkitd; --system -d / -M --shell /sbin/nologin systemd-resolve; --system -d / -M --shell /sbin/nologin systemd-timesync"
	elif test "$1" = "groupmems"; then
		GROUPMEMS_PARAM=""
	elif test "x$1" = "x"; then
		bbwarn "missing type of passwd db action"
	fi

	# Tell the system to use the environment vars
	UA_SYSROOT=1

	useradd_preinst
}

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

# line: 22, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd.bbclass
useradd_preinst() {
OPT=""
SYSROOT=""

if test "x$D" != "x"; then
	# Installing into a sysroot
	SYSROOT="$D"
	OPT="--root $D"

	# Make sure login.defs is there, this is to make debian package backend work
	# correctly while doing rootfs.
	# The problem here is that if /etc/login.defs is treated as a config file for
	# shadow package, then while performing preinsts for packages that depend on
	# shadow, there might only be /etc/login.def.dpkg-new there in root filesystem.
	if [ ! -e $D/etc/login.defs -a -e $D/etc/login.defs.dpkg-new ]; then
	    cp $D/etc/login.defs.dpkg-new $D/etc/login.defs
	fi

	# user/group lookups should match useradd/groupadd --root
	export PSEUDO_PASSWD="$SYSROOT"
fi

# If we're not doing a special SSTATE/SYSROOT install
# then set the values, otherwise use the environment
if test "x$UA_SYSROOT" = "x"; then
	# Installing onto a target
	# Add groups and users defined only for this package
	GROUPADD_PARAM="${GROUPADD_PARAM}"
	USERADD_PARAM="${USERADD_PARAM}"
	GROUPMEMS_PARAM="${GROUPMEMS_PARAM}"
fi

# Perform group additions first, since user additions may depend
# on these groups existing
if test "x`echo $GROUPADD_PARAM | tr -d '[:space:]'`" != "x"; then
	echo "Running groupadd commands..."
	# Invoke multiple instances of groupadd for parameter lists
	# separated by ';'
	opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
	remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
	while test "x$opts" != "x"; do
		perform_groupadd "$SYSROOT" "$OPT $opts"
		if test "x$opts" = "x$remaining"; then
			break
		fi
		opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
		remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
	done
fi

if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then
	echo "Running useradd commands..."
	# Invoke multiple instances of useradd for parameter lists
	# separated by ';'
	opts=`echo "$USERADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
	remaining=`echo "$USERADD_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
	while test "x$opts" != "x"; do
		perform_useradd "$SYSROOT" "$OPT $opts"
		if test "x$opts" = "x$remaining"; then
			break
		fi
		opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
		remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
	done
fi

if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then
	echo "Running groupmems commands..."
	# Invoke multiple instances of groupmems for parameter lists
	# separated by ';'
	opts=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
	remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
	while test "x$opts" != "x"; do
		perform_groupmems "$SYSROOT" "$OPT $opts"
		if test "x$opts" = "x$remaining"; then
			break
		fi
		opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
		remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
	done
fi
}

# line: 19, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_groupadd() {
	local rootdir="$1"
	local opts="$2"
	bbnote "systemd: 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 "systemd: groupadd command did not succeed."
		fi
	else
		bbnote "systemd: group $groupname already exists, not re-creating it"
	fi
}

# line: 53, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_groupmems() {
	local rootdir="$1"
	local opts="$2"
	bbnote "systemd: Performing groupmems with [$opts]"
	local groupname=`echo "$opts" | awk '{ for (i = 1; i < NF; i++) if ($i == "-g" || $i == "--group") print $(i+1) }'`
	local username=`echo "$opts" | awk '{ for (i = 1; i < NF; i++) if ($i == "-a" || $i == "--add") print $(i+1) }'`
	bbnote "systemd: Running groupmems command with group $groupname and user $username"
	local mem_exists="`grep "^$groupname:[^:]*:[^:]*:\([^,]*,\)*$username\(,[^,]*\)*$" $rootdir/etc/group || true`"
	if test "x$mem_exists" = "x"; then
		eval flock -x $rootdir/etc -c \"$PSEUDO groupmems \$opts\" || true
		mem_exists="`grep "^$groupname:[^:]*:[^:]*:\([^,]*,\)*$username\(,[^,]*\)*$" $rootdir/etc/group || true`"
		if test "x$mem_exists" = "x"; then
			bbfatal "systemd: groupmems command did not succeed."
		fi
	else
		bbnote "systemd: group $groupname already contains $username, not re-adding it"
	fi
}

# line: 36, file: /home/sim/yocto/scarthgap/poky/meta/classes/useradd_base.bbclass
perform_useradd() {
	local rootdir="$1"
	local opts="$2"
	bbnote "systemd: 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 "systemd: useradd command did not succeed."
		fi
	else
		bbnote "systemd: user $username already exists, not re-creating it"
	fi
}

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

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

useradd_sysroot

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