#!/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 # 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) # 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 select image is available diravailability_test $indir || exit $? # Print all variables and start the deploy using the customized script (image_deploy_.sh) setterm -bold on env setterm -bold off echo_color green black "$scriptdir/image_deploy_${mastername}.sh script will run on tty1 now" pause10s source $scriptdir/image_deploy_${mastername}.sh