File firstboot-windowmanager of Package l4t-initial-setup
#!/usr/bin/sh
# This is the list of supported window manager binaries
WM="openbox"
# Get the application binary to start and remove it from
# the argument list
BINARY=$1
shift
FILE=$(which $WM 2>/dev/null)
FOUND=$?
if [ $FOUND -eq 0 -a -x "$FILE" ]; then
# start window manager
echo "Running window manager ($FILE)" | systemd-cat -t initial-setup -p 6
"$FILE" &
pid=$!
# start the application
echo "Running ($BINARY)" | systemd-cat -t initial-setup -p 6
$BINARY "$@"
res=$?
# stop window manager
echo "Stopping the window manager ($FILE)" | systemd-cat -t initial-setup -p 6
ps -p $pid >/dev/null && kill $pid
# return result
exit $res
fi
# No known window manager found
echo "No supported window manager found!" | systemd-cat -t initial-setup -p 3
exit 1