Commit cb330024 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix: chmod issue on hook scripts

parent 74255d33
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -236,6 +236,17 @@ stages:
    awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);val=ENVIRON[var];gsub(/["\\]/,"\\\\&", val);gsub("\n", "\\n", val);gsub("\r", "\\r", val);gsub("[$]{"var"}",val)}}1'
  }

  function exec_hook() {
    if [[ ! -x "$1" ]] && ! chmod +x "$1"
    then
      log_warn "... could not make \\e[33;1m${1}\\e[0m executable: please do it (chmod +x)"
      # fallback technique
      sh "$1"
    else
      "$1"
    fi
  }

  # application deployment function
  function deploy() {
    export env=$1
@@ -260,8 +271,7 @@ stages:
    if [[ -f "$deployscript" ]]
    then
      log_info "--- deploy script (\\e[33;1m${deployscript}\\e[0m) found: execute"
      chmod +x "$deployscript"
      "$deployscript"
      exec_hook "$deployscript"
    else
      log_error "--- no deploy script found: abort"
      exit 1
@@ -292,8 +302,7 @@ stages:
    if [[ -f "$cleanupscript" ]]
    then
      log_info "--- cleanup script (\\e[33;1m${cleanupscript}\\e[0m) found: execute"
      chmod +x "$cleanupscript"
      "$cleanupscript"
      exec_hook "$cleanupscript"
    else
      log_error "--- no cleanup script found: abort"
      exit 1