#!/bin/sh

export HOSTNAME="TARGET"
export ROOTFS_VERSION=$(cat /etc/VERSION)

hostname $HOSTNAME

case "$1" in
	start|"")
		echo "Launching app..."
		# Copy /app/bin/applaunch to /tmp and execute
		# NOTE: This means it can dismount the UBI filesystems if it wants to...
		cp /app/bin/applaunch.sh /tmp
		cp /app/bin/settings.sh /tmp
		/tmp/applaunch.sh &
		;;

	stop)
		;;

	restart|reload)
		"$0" stop
		"$0" start
		;;

	*)
		echo $"Usage: $0 {start|stop|restart}"
		exit 1
esac

exit $?
