#!/bin/bash
. /home/ROULETTE/common.config #here is configuration of ROULETTE and FC5 locations

#if another instance of this iscrpt is already running, exit
#for pid in $(pidof -x $0); do
#    if [ $pid != $$ ]; then
#        echo "[$(date)] : $0 : Process is already running with PID $pid"
#        exit 1
#    fi
#done


echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'PLAYBACK_VOLUME', '', '', 11, NULL, '75');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('PLATFORM', 'UPDATE_ALL.sh', 'MUSIC_VOLUME', '', '', 11, NULL, '20');"|/home/ROULETTE/sqlexec.sh

#echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'IGPV6_ILLUMINATION_MAX_PWM', '', '', 11, NULL, '128');"|/home/ROULETTE/sqlexec.sh
#echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'IGPV6_SEMAPHORE_MAX_PWM', '', '', 11, NULL, '230');"|/home/ROULETTE/sqlexec.sh
#echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'IGPV6_BUTTON_LIGHTS_MAX_PWM', '', '', 11, NULL, '179');"|/home/ROULETTE/sqlexec.sh
#echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'SEMAPHORE_TYPE', '', '', 11, NULL, 'TrafficLight');"|/home/ROULETTE/sqlexec.sh

echo "select * from SET_PARAM('PLATFORM', 'UPDATE_ALL.sh', 'TOP_BACKGROUND_SHADER', NULL, NULL, 11, NULL, 'Animation/shader_godrays.json')" | $ROULETTE/sqlexec.sh
echo "select * from SET_PARAM('PLATFORM', 'UPDATE_ALL.sh', 'BACKGROUND_SHADER', NULL, NULL, 11, NULL, 'Animation/shader_bubbles.json')" | $ROULETTE/sqlexec.sh

#so zamenjali DEPOSIT in SMALL door pine - zdaj uporabljajo small doll za bill acceptor
echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'LOCK_IF_DEPOSIT_BOX_DOOR_OPEN', '', '', 11, NULL, '0');"|/home/ROULETTE/sqlexec.sh
echo "select RESULT from SET_PARAM('GLOBAL', 'UPDATE_ALL.sh', 'LOCK_IF_SMALL_DOOR_OPEN', '', '', 11, NULL, '1');"|/home/ROULETTE/sqlexec.sh


#KEY_RIGHTS - for AGRO default
#1056768 -NO UID, over other hardware
echo "select RESULT from SET_PARAM('PLATFORM', 'UPDATE_ALL.sh', 'CLOSE_ADMIN_MENU_ON_KEY_OUT', '', '', 11, NULL, '1');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'ADMIN_KEY_TYPE', '', '', 11, NULL, '0');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_1_DESC', '', '', 11, NULL, 'Master Key');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_1_CODE', '', '', 11, NULL, '85-85-33-141-230-60');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_1_RIGHTS', '', '', 11, NULL, 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_1_COUNTER_ID', '', '', 11, 2, '2');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_2_DESC', '', '', 11, NULL, 'Audit');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_2_CODE', '', '', 11, NULL, '142-227-192-8-239-125');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_2_RIGHTS', '', '', 11, NULL, 'nnyyyyynyynynnyynyyynnnnnnnynnnnnnyynnnnnnnnnnnnn');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_2_COUNTER_ID', '', '', 11, 2, '2');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_3_DESC', '', '', 11, NULL, 'Attendant');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_3_CODE', '', '', 11, NULL, '199-113-96-132-247-190');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_3_RIGHTS', '', '', 11, NULL, 'nyyyynnnyynynnyynynnnnnnnnnynnnnnnyynnnnnnnnnnnnn');"|/home/ROULETTE/sqlexec.sh
echo "select result from SET_PARAM('GLOBAL', 'INSTALLER', 'KEY_3_COUNTER_ID', '', '', 11, 2, '2');"|/home/ROULETTE/sqlexec.sh


#monitors configuration
wget -q http://igpupdates.4knh.com/PACKAGES_IGP/PUERTO_RICO/V7.1/monitors.xml.V6deluxe -O /home/user/.config/monitors.xml
chown user:user /home/user/.config/monitors.xml
chmod 664 /home/user/.config/monitors.xml
