separate cfg files after all; some cleanup
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
f548e6f53d
commit
d0d20d7d9c
38
ssm
38
ssm
|
@ -474,6 +474,7 @@ var service_pid \
|
|||
failed_deps \
|
||||
svc_pidfile \
|
||||
cfg_path \
|
||||
cfg_file \
|
||||
cfg_dir \
|
||||
rundir \
|
||||
logdir \
|
||||
|
@ -510,7 +511,19 @@ var service_stopped = 0
|
|||
var service_systemd = 0
|
||||
var service_nologs = 0
|
||||
var service_cgroup_empty = 1
|
||||
var ssm_config = 0
|
||||
|
||||
# These depend on who we are
|
||||
if (( $UID )); then
|
||||
rundir = "$XDG_RUNTIME_DIR/ssm"
|
||||
logdir = "$HOME/log/ssm"
|
||||
cgroup_home = "/sys/fs/cgroup/user/$UID/my/ssm"
|
||||
cfg_file = "$XDG_CONFIG_HOME/ssm/ssm.conf"
|
||||
else
|
||||
rundir = '/run/ssm'
|
||||
logdir = '/var/log/ssm'
|
||||
cgroup_home = "/sys/fs/cgroup/ssm"
|
||||
cfg_file = '/etc/ssm/ssm.conf'
|
||||
fi
|
||||
|
||||
## Figure out our full path
|
||||
case "$0" in
|
||||
|
@ -526,6 +539,11 @@ for p in "/etc/ssm/init.d" "$XDG_CONFIG_HOME/ssm/init.d"; do
|
|||
fi
|
||||
done
|
||||
|
||||
# Source the config
|
||||
if [[ -f "$cfg_file" ]]; then
|
||||
source "$cfg_file" || die 37 "Failed to load config: $cfg_file"
|
||||
fi
|
||||
|
||||
# Common config path
|
||||
cfg_path = "$XDG_CONFIG_HOME/ssm" '/etc/ssm'
|
||||
|
||||
|
@ -533,29 +551,11 @@ cfg_path = "$XDG_CONFIG_HOME/ssm" '/etc/ssm'
|
|||
for (( idx=${#cfg_path[@]}-1; idx>=0; idx-- )); do
|
||||
cfg_dir = "${cfg_path[idx]}"
|
||||
|
||||
ssm_config || {
|
||||
[[ -f "$cfg_dir/ssm.conf" ]] && {
|
||||
source "$cfg_dir/ssm.conf" || die 37 "Failed to load config: $cfg_dir/ssm.conf"
|
||||
ssm_config = 1
|
||||
}
|
||||
}
|
||||
|
||||
for f in "$cfg_dir/functions"/*; do
|
||||
source "$f" || die 9 "Failed to source functions from $f"
|
||||
done
|
||||
done
|
||||
|
||||
# These depend on who we are
|
||||
if (( $UID )); then
|
||||
rundir := "$XDG_RUNTIME_DIR/ssm"
|
||||
logdir := "$HOME/log/ssm"
|
||||
cgroup_home := "/sys/fs/cgroup/user/$UID/my/ssm"
|
||||
else
|
||||
rundir := '/run/ssm'
|
||||
logdir := '/var/log/ssm'
|
||||
cgroup_home := "/sys/fs/cgroup/ssm"
|
||||
fi
|
||||
|
||||
# Now create the needed runtime stuff
|
||||
for d in "$rundir" "$logdir"; do
|
||||
mkdir -p "$d" || die 3 "Failed to create runtime dir: $d"
|
||||
|
|
Loading…
Reference in New Issue
Block a user