summaryrefslogtreecommitdiff
path: root/nfs/scripts/image_capture.sh
blob: ae72320e2bfcffcd85915568eb4905e9ab08785a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/busybox sh
# Should only started from autorun.sh, it defines some helper functions and variables)

# Prepare capture
last=$(date +%Y%m%d)
lastfile="$imagedir/$hostname/last"
outdir="$imagedir/$hostname/$last"

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

# Do the work then mark image in "last" after completion
source $scriptdir/image_capture_${hostname}.sh
echo $last > $lastfile

date >>logs/date.log