init.d and reverse functions load order

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2017-12-08 16:49:34 +03:00
parent 8fdd73af45
commit 587ed04903
1 changed files with 5 additions and 3 deletions

8
ssm
View File

@ -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