#!/bin/busybox sh
# Should only started from autorun.sh, it defines some helper functions and variables)

# Prepare capture
year=$(date +%Y)
monthday=$(date +%m-%d)
outdir="$imagedir/$year/$hostname/$monthday"

if [ -d "$outdir" ]
then	rm -r "$outdir"
fi
mkdir -p "$outdir"
cd "$outdir"
mkdir logs
date >logs/date.log

# Print all variables and start the capture using the customized script (image_capture_<hostname>.sh)
setterm -bold on
env
setterm -bold off
echo_color green black "$scriptdir/image_capture_${hostname}.sh script will run on tty1 now"
pause10s
source $scriptdir/image_capture_${hostname}.sh

date >>logs/date.log