summaryrefslogtreecommitdiff
path: root/nfs/scripts/image_deploy.sh
blob: 6041b3003a4580e4698a36936d7224dadfb5c187 (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
38
#!/bin/busybox sh
# Should only started from autorun.sh (define some helper functions and variables)

# Load config to resolve $hostname to $mastername
source $scriptdir/masterlist-autogenerated.conf

# Check and print if the deploy script is defined for the current master machine
scriptavailability_test image_deploy_${mastername}.sh || exit $?

# Determine which image take
last=$(cat "$imagedir/$mastername/last")
# Put a bad value to help the user to see where the image should be available
last=${last:-XXXXXXXX}
indir="$imagedir/$mastername/$last/"

# Check and print if the select image is available
if [ "x$last" != "xdummy" ]
then diravailability_test $indir || exit $?
fi

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

# Plan a success action after script execution
echo reboot > /run/eficast_end

# Run the final deploy script
source $scriptdir/image_deploy_${mastername}.sh
res=$?

# Pause at the end to have chance to read error messages
pause10s
exit $res