From a4e9d4dcdceee87256a0151d8542e3531c183608 Mon Sep 17 00:00:00 2001 From: Stuart Cardall Date: Wed, 20 Sep 2017 13:44:39 +0000 Subject: [PATCH] install-ngxblocker: add set_mode() * ensure all $SCRIPT_FILES are executable --- install-ngxblocker | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/install-ngxblocker b/install-ngxblocker index 4ebb34a12..2ca0f621c 100755 --- a/install-ngxblocker +++ b/install-ngxblocker @@ -141,6 +141,16 @@ download_files() { fi } +set_mode() { + local mode=$1 dir=$2 file= + local file_list="$(echo $@ | awk '{$1=$2=""; print}' | sed -e 's/^[ \t]*//')" + + for file in $file_list; do + printf "Setting mode: $mode => $dir/$file\n" + chmod $mode $dir/$file + done +} + check_config() { local x= dirs="$*" @@ -283,6 +293,11 @@ main() { download_files conf.d $CONF_DIR $CONF_FILES download_files bots.d $BOTS_DIR $BOT_FILES download_files / $SCRIPT_DIR $SCRIPT_FILES + + # ensures scripts are executable + if [ "$DRY_RUN" = "N" ]; then + set_mode 700 $SCRIPT_DIR $SCRIPT_FILES + fi } ## START ##