From 84227b972b11c08d039700829d6df6412f7fd858 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 31 Aug 2018 00:15:22 -0400 Subject: [PATCH] feat: check if script is executable when a full path is specified This fixes issues where developers may specify a binary to run but haven't given that binary executable permissions. --- plugins/00_dokku-standard/exec-app-json-scripts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/00_dokku-standard/exec-app-json-scripts b/plugins/00_dokku-standard/exec-app-json-scripts index 9cbd4540d..07ceeacfb 100755 --- a/plugins/00_dokku-standard/exec-app-json-scripts +++ b/plugins/00_dokku-standard/exec-app-json-scripts @@ -44,6 +44,15 @@ execute_script() { COMMAND+=" rm -rf /tmp/cache ; " COMMAND+=" ln -sf /cache /tmp/cache ; " COMMAND+=" fi ; " + + if [[ "$SCRIPT_CMD" == /* ]]; then + local SCRIPT_BIN="$(echo "$SCRIPT_CMD" | cut -d' ' -f1)" + COMMAND+=" if [[ ! -x $SCRIPT_BIN ]]; then " + COMMAND+=" echo specified binary is not executable ; " + COMMAND+=" exit 1 ; " + COMMAND+=" fi " + fi + COMMAND+=" $SCRIPT_CMD || exit 1;" COMMAND+=" if [[ -d '/cache' ]]; then " COMMAND+=" echo removing installation cache... ; "