summaryrefslogtreecommitdiff
path: root/nfs/nfs-autorun.sh
blob: 130e58aefc15b89ac40d8701df3235004f630880 (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
#!/bin/busybox sh

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

# Load helper functions
source /etc/rc.d/funcs		# Load EFIcast helper functions (echo_color, machine_info, network_show, sfx_*)
source $scriptdir/funcs.sh	# Load some nfs-autorun.sh specific helper functions

# Check all prerequisites and exit if it fail
hostname_test || exit 1
firstdisk=$(firstdisk)
firstdisk_test "$firstdisk" || exit 2
firstdiskp=$(firstdiskp "$firstdisk")

# Run the main action script
if nfswrite_test
then	# Start deploy script after letting a chance to cancel it
	message deploy; message ${firstdisk#/dev/}; pause10s; sfx_starting
	source $scriptdir/image_deploy.sh

else	scriptavailability_test image_capture_${hostname}.sh || exit 3
	# Start capture script if all it needs is available
	message capture ; message ${firstdisk#/dev/}; pause10s; sfx_starting
	source $scriptdir/image_capture.sh
fi