diff --git a/files/update_repo.sh b/files/update_repo.sh index c871f416b5e32be90723fca95003573861de992e..210d36dcfbd73a4a35233c223a9c3d77bc342767 100755 --- a/files/update_repo.sh +++ b/files/update_repo.sh @@ -6,7 +6,7 @@ # The command is called as follows: # update_repo.sh <destination path> <source repo> <source branch> -# If REPO_ON_UPDATE is set, then that command will be executed whenever the repo is created and/or +# If REPO_ON_UPDATE is set, then that file will be executed whenever the repo is created and/or # updated to a new revision. This can be used to trigger further processing of some sort, such as # compiling the contained source and/or restarting system services as appropriate. @@ -58,6 +58,20 @@ then exit 2 fi +# Check if the REPO_ON_UPDATE script exists. If it doesn't (probably +# because Puppet has not created it yet), then we don't want to run +# yet. If we run without the script being present, then the script +# will not be executed until the repository is updated, thus breaking +# our promises. +if [[ ! -z "$REPO_ON_UPDATE" ]] +then + if [[ ! -f "$REPO_ON_UPDATE" ]] + then + echo "The script $REPO_ON_UPDATE does not exist." + exit 4 + fi +fi + # Setup variables for calling "update_repo"... repo_path="$1" repo_source="$2"