diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2020-07-04 23:38:38 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2020-07-04 23:38:38 +0200 |
commit | cf81fed0c9277550e6b98927f7ff2f8eb5de7b40 (patch) | |
tree | d193ebdaed1853d2868c26c43d2fc0c00ebb42ac /nfs/scripts/image_deploy.sh | |
parent | 8d273fe8d76ef394cfab04a195c90f4b7aeb8495 (diff) | |
download | eficast-cf81fed0c9277550e6b98927f7ff2f8eb5de7b40.tar.gz eficast-cf81fed0c9277550e6b98927f7ff2f8eb5de7b40.tar.bz2 eficast-cf81fed0c9277550e6b98927f7ff2f8eb5de7b40.zip |
Add blkdiscard on image. Add nfs scripts newer examples.
Diffstat (limited to 'nfs/scripts/image_deploy.sh')
-rw-r--r-- | nfs/scripts/image_deploy.sh | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/nfs/scripts/image_deploy.sh b/nfs/scripts/image_deploy.sh index 69c5cf6..6041b30 100644 --- a/nfs/scripts/image_deploy.sh +++ b/nfs/scripts/image_deploy.sh @@ -1,31 +1,22 @@ #!/bin/busybox sh # Should only started from autorun.sh (define some helper functions and variables) -# Prepare deploy -year=$(date +%Y) -monthday=$(date +%m-%d) - -# define what master image should be used for the current client machine -#TODO : have a better place for that (CMDB...) -case "$hostname" in - I5480) mastername=I5456 ;; - I5454) mastername=I5456 ;; - *) echo_color white red ">>> " "No master for $hostname (see image_deploy.sh)" ; exit 1 ;; -esac +# 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 -#TODO : have a better place for that (CMDB...) -ls -ld "$imagedir/$year/$mastername/" - -indir=$(find "$imagedir/$year/$mastername/" -maxdepth 1 -type d -regex '.*/\d\d-\d\d' | sort -rn | head -n1) +last=$(cat "$imagedir/$mastername/last") # Put a bad value to help the user to see where the image should be available -indir=${indir:-$imagedir/$year/$mastername/XX-XX} +last=${last:-XXXXXXXX} +indir="$imagedir/$mastername/$last/" # Check and print if the select image is available -diravailability_test $indir || exit $? +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 @@ -34,5 +25,14 @@ 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 |