diff options
author | Ludovic Pouzenc <ludovic.pouzenc@mines-albi.fr> | 2017-10-27 17:00:11 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic.pouzenc@mines-albi.fr> | 2017-10-27 17:00:11 +0200 |
commit | 6f39be0aae716a86b410556630ac48ed4da4c6f5 (patch) | |
tree | ffc58082a84e332ce0aa3ee2c6299a4b221eed4d /nfs/scripts/image_deploy.sh | |
parent | 211e646859ee028a0a66b67c96057a2f1a6a82ba (diff) | |
download | eficast-6f39be0aae716a86b410556630ac48ed4da4c6f5.tar.gz eficast-6f39be0aae716a86b410556630ac48ed4da4c6f5.tar.bz2 eficast-6f39be0aae716a86b410556630ac48ed4da4c6f5.zip |
capture and deploy script updates (not finished yet)
Diffstat (limited to 'nfs/scripts/image_deploy.sh')
-rw-r--r-- | nfs/scripts/image_deploy.sh | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/nfs/scripts/image_deploy.sh b/nfs/scripts/image_deploy.sh index 4efd715..e23fd70 100644 --- a/nfs/scripts/image_deploy.sh +++ b/nfs/scripts/image_deploy.sh @@ -1,4 +1,35 @@ #!/bin/busybox sh # Should only started from autorun.sh (define some helper functions and variables) -echo_color white red ">>> Image deploy not yet ready" +# 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=pctp-master ;; + *) mastername=I4920 ;; +# *) echo_color white red ">>> " "No master for $hostname (see image_deploy.sh)" ; exit 1 ;; +esac + +# 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) +# Put a bad value to help the user to see where the image should be available +indir=${indir:-$imagedir/$year/$mastername/XX-XX} + +# Check and print if the deploy script is defined for the current master machine +scriptavailability_test image_deploy_${mastername}.sh || exit $? +diravailability_test $indir || exit $? + +# 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" + +source $scriptdir/image_deploy_${mastername}.sh + |