summaryrefslogtreecommitdiff
path: root/nfs/autorun.sh
blob: a998b135691429e859b81544cad51a0558efe888 (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
30
31
32
33
34
35
36
37
#!/bin/busybox sh

rest10() {
	# Let the user read machine_info and other usefull informations on console (or skip with Enter)
	read -t10 -p 'Press Enter or wait 10 sec...'
	# Make some blank lines on console
	echo -e '\n\n\n\n\n'
}

# Define some handy variables
imagedir=/mnt/nfs/images
scriptdir=/mnt/nfs/scripts/
hostname=$(hostname)

# Load helper functions
source $scriptdir/funcs.sh	# Load some autorun.sh specific helper functions
source /etc/rc.d/funcs		# Reload init help functions

# Check all prerequisites and exit if it fail
hostname_test || exit 1
firstdisk_test || exit 2

# Run the main action script
if nfswrite_test
then	rest10 # Let user cancel it
	source $scriptdir/image_deploy.sh # Start deploy script

else	# Start capture script if all it needs is available
	if scriptavailability_test image_capture_${hostname}.sh
	then	rest10 # Let user cancel it
		source $scriptdir/image_capture.sh
	# else No wait, nothing to do, go to eficast_end directly
	fi
fi

# Display ending message then reboot
eficast_end