#!/bin/bash

exit
cd /home/itender/ || exit
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences

#address=""
#if ping -c1 -W1 192.168.1.186; then
#        address="192.168.1.186"
#fi
#if ping -c1 -W1 192.168.208.15; then
#        address="192.168.208.15"
#fi
#if ping -c1 -W1 10.10.0.5; then
#        address="10.10.0.5"
#fi
address="localhost"

echo "Waiting 5 seconds to start chromium..."
sleep 5
/usr/bin/chromium-browser --disable-infobars --kiosk --incognito --disable-pinch --overscroll-history-navigation=0 "http://${address}:3000/"
#/usr/bin/startx /usr/bin/chromium-browser --kiosk --incognito --disable-pinch --overscroll-history-navigation=0 http://192.168.1.186:3000/