distribution/packages/jelos/autostart/099-networkservices
2023-10-23 22:53:27 +00:00

42 lines
824 B
Bash
Executable file

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023-present - The JELOS Project (https://github.com/JustEnoughLinuxOS) (https://github.com/fewtarius)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
tocon "Starting services..."
for SERVICE in /usr/lib/autostart/daemons/*
do
source ${SERVICE}
if [ ! -d "/storage/.cache/services" ]
then
mkdir -p "/storage/.cache/services"
fi
if [ -n "${CONF}" ] && \
[ -e "/storage/.cache/services/${CONF}" ]
then
rm -f "/storage/.cache/services/${CONF}"
fi
statemgr() {
for daemon in ${DAEMONS[@]}
do
nohup systemctl ${1} ${daemon} &
done
}
case "$STATE" in
"1")
touch "/storage/.cache/services/${CONF}"
statemgr start
;;
*)
statemgr stop
;;
esac
done