#!/bin/bash

#set -m
echo "Starting rc.local script"

. /etc/init.d/functions
. /ssstk/ssstk-functions

cmdline=$(cat /proc/cmdline)

if strstr "$cmdline" "deploy"; then
	deploy.sh 2>&1 | tee /tmp/ssstk_deploy.log
elif strstr "$cmdline" "capture"; then
	capture.sh 2>&1 | tee /tmp/ssstk_capture.log
elif strstr "$cmdline" "ilo"; then
	ilo.sh 2>&1 | tee /tmp/ssstk_ilo.log
elif strstr "$cmdline" "fw"; then
	fw.sh 2>&1 | tee /tmp/ssstk_fw.log
else 
	/bin/bash
fi

if strstr "$cmdline" "ssstkdebug"; then
	/bin/bash
fi

echo "Stopping the server in 10s"
sleep 10
poweroff
