#!/bin/sh
-########################################################################
-# Begin $rc_base/init.d/functions
-#
-# Description : Run Level Control Functions
-#
-# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
-#
-# Version : 00.00
-#
-# Notes : With code based on Matthias Benkmann's simpleinit-msb
-# http://winterdrache.de/linux/newboot/index.html
-#
-########################################################################
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
## Environmental setup
# Setup default values for environment
# This will ensure compatibility with previous LFS Bootscripts
getpids()
{
- if [ -z "${PIDFILE}" ]; then
+ if [ -n "${PIDFILE}" ]; then
pidofproc -s -p "${PIDFILE}" $@
else
pidofproc -s $@
#*******************************************************************************
loadproc()
{
+ local background=""
local pidfile=""
local forcestart=""
local nicelevel=""
+ local pid
# This will ensure compatibility with previous LFS Bootscripts
if [ -n "${PIDFILE}" ]; then
while true
do
case "${1}" in
+ -b)
+ background="1"
+ shift 1
+ ;;
-f)
forcestart="1"
shift 1
cmd="nice -n "${nicelevel}" ${cmd}"
fi
- ${cmd}
- evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts
+ if [ -n "${background}" ]; then
+ (
+ ${cmd} &>/dev/null
+ ) &
+ pid="$!"
+ evaluate_retval
+ else
+ ${cmd}
+ pid="$!"
+ evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts
+ fi
+
+ # Write the pidfile
+ if [ -n "${pid}" -a -n "${pidfile}" ]; then
+ echo "${pid}" > "${pidfile}"
+ fi
+
return 0
}
if [ -r "/sys/devices/virtual/dmi/id/product_uuid" ]; then
uuid=$(</sys/devices/virtual/dmi/id/product_uuid)
+ # Convert the UUID as uppercase
+ uuid="${uuid^^}"
+
[ "${uuid:0:3}" = "EC2" ] && return 0
fi
# We are not running on OCI
return 1
}
-
-# End $rc_base/init.d/functions