#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
if [ -f /opt/banc/tools/img-wpa_supplicant.sh ]; then
	/bin/bash /opt/banc/tools/img-wpa_supplicant.sh
fi

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

touch /tmp/star-menu-first-launch
screen -A -m -d -S start-menu /opt/banc/start-menu.sh
if [ -x /opt/ttyd ]; then
	/opt/ttyd -p 8022 /opt/banc/start-ttyd.sh > /tmp/ttyd.log 2>/tmp/ttyd-error.log &
fi

exit 0
