2023-08-07 00:30:11 +00:00
|
|
|
#!/bin/sh
|
2023-10-23 22:44:47 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2023-10-24 16:00:57 +00:00
|
|
|
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
2022-02-05 14:23:32 +00:00
|
|
|
|
2023-08-07 00:30:11 +00:00
|
|
|
# Minimal OS variable loading for performance
|
2023-09-04 10:46:11 +00:00
|
|
|
. /etc/profile.d/001-functions
|
2022-02-05 14:23:32 +00:00
|
|
|
|
2023-04-22 20:01:07 +00:00
|
|
|
tocon "Starting services..."
|
|
|
|
|
2022-09-16 21:13:51 +00:00
|
|
|
for SERVICE in /usr/lib/autostart/daemons/*
|
2022-02-05 14:23:32 +00:00
|
|
|
do
|
2022-09-16 21:13:51 +00:00
|
|
|
source ${SERVICE}
|
|
|
|
|
2023-04-22 20:01:07 +00:00
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
if [ ! -d "/storage/.cache/services" ]
|
|
|
|
then
|
|
|
|
mkdir -p "/storage/.cache/services"
|
|
|
|
fi
|
|
|
|
|
2022-09-24 12:39:27 +00:00
|
|
|
if [ -n "${CONF}" ] && \
|
|
|
|
[ -e "/storage/.cache/services/${CONF}" ]
|
2022-02-05 14:23:32 +00:00
|
|
|
then
|
|
|
|
rm -f "/storage/.cache/services/${CONF}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
statemgr() {
|
|
|
|
for daemon in ${DAEMONS[@]}
|
|
|
|
do
|
2022-03-27 19:40:10 +00:00
|
|
|
nohup systemctl ${1} ${daemon} &
|
2022-02-05 14:23:32 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$STATE" in
|
|
|
|
"1")
|
|
|
|
touch "/storage/.cache/services/${CONF}"
|
|
|
|
statemgr start
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
statemgr stop
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|