From 587ed04903ad0d8a70f111dd401c603c6dbb1774 Mon Sep 17 00:00:00 2001 From: fbt Date: Fri, 8 Dec 2017 16:49:34 +0300 Subject: [PATCH] init.d and reverse functions load order Signed-off-by: fbt --- ssm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ssm b/ssm index 8d26fd4..f8b91da 100755 --- a/ssm +++ b/ssm @@ -349,7 +349,7 @@ main() { default XDG_CONFIG_HOME "$HOME/.config" default XDG_RUNTIME_DIR "/run/user/$UID" - service_path=( "$XDG_CONFIG_HOME/ssm/services" ) + service_path=( "$XDG_CONFIG_HOME/ssm/init.d" ) cfg_path=( "$XDG_CONFIG_HOME/ssm" ) rundir="$XDG_RUNTIME_DIR/ssm" @@ -366,8 +366,10 @@ main() { cfg_path+=( '/etc/ssm/conf.d' ) # Load custom functions - for p in "${cfg_path[@]}"; do - for f in "$p/functions"/*; do + for (( idx=${#cfg_path[@]}-1; idx>=0; idx-- )); do + cfg_dir="${cfg_path[idx]}" + + for f in "$cfg_dir/functions"/*; do source "$f" || die 9 "Failed to source functions from $f" done done