distribution/packages/jelos/autostart/099-networkservices

43 lines
771 B
Text
Raw Normal View History

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
2022-02-05 14:23:32 +00:00
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
2022-02-05 14:23:32 +00:00
tocon "Starting services..."
for SERVICE in /usr/lib/autostart/daemons/*
2022-02-05 14:23:32 +00:00
do
source ${SERVICE}
2022-02-05 14:23:32 +00:00
if [ ! -d "/storage/.cache/services" ]
then
mkdir -p "/storage/.cache/services"
fi
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
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