Files
@ 8551913bda80
Branch filter:
Location: majic-scripts/templates/init.d_gentoo.tpl - annotation
8551913bda80
2.5 KiB
application/vnd.groove-tool-template
Noticket: Implement additional path validations for Factorio Manager:
- Added test for instance directories, new backup directories, backup
directories, and import sources.
- Refactored commands to use the new path validations.
- Updated some comments and formatting.
- Added test for instance directories, new backup directories, backup
directories, and import sources.
- Refactored commands to use the new path validations.
- Updated some comments and formatting.
9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 9eb26b78a711 | #!/sbin/runscript
# Setup static variables
configFile='(>>>CONFIG_FILE<<<)'
daemonExec='(>>>DAEMON_EXEC<<<)'
daemonArgs='(>>>DAEMON_ARGS<<<)'
daemonName="$(basename "$daemonExec")"
pidFile='/var/run/(>>>FILE<<<).pid'
#
# Checks if the environment is capable of running the script (such as
# availability of programs etc).
#
# Return: 0 if the environmnt is properly setup for execution of init script, 1
# if not all conditions have been met.
#
function checkEnvironment() {
# Verify that the necessary binaries are available for execution.
local binaries=((>>>REQ_BINARIES<<<))
for bin in "${binaries[@]}"; do
if ! which "$bin" > /dev/null; then
eerror "Binary '$bin' is not available. Please install \
package containing it."
exit 5
fi
done
# Verify that the necessary environment variables have been set.
local envVars=((>>>REQ_ENV_VARIABLES<<<))
for var in "${envVars[@]}"; do
if printenv "$var" > /dev/null; then
eerror "Environment variable '$var' is not set. Please \
check your global environment settings."
exit 6
fi
done
}
#
# Checks if the configuration files are available and properly setup.
#
# Return: 0 if irssid if properly configured, 1 otherwise.
#
function checkConfig() {
# Make sure the configuration file has been created
if ! [[ -f $configFile ]]; then
eerror "Please populate the configuration file '$configFile' \
before running."
exit 6
fi
# Make sure the required options have been set
local reqOptions=((>>>REQ_OPTIONS<<<))
for option in "${reqOptions[@]}"; do
if ! grep -q -e "^[[:blank:]]*$option=" "$configFile"; then
eerror "Mandatory option '$option' was not specified in \
'$configFile'"
exit 6
fi
done
}
#
# Loads the configuration file and performs any additional configuration steps.
#
function configure() {
. "$configFile"
daemonCommand="$daemonExec $daemonArgs"
}
#############################
# Gentoo-specific functions #
#############################
opts="${opts} (>>>GENTOO_OPTS<<<)"
depend() {
need (>>>GENTOO_NEED<<<)
after (>>>GENTOO_AFTER<<<)
}
start () {
ebegin "Starting irssid"
start-stop-daemon --start --quiet --oknodo --pidfile "$pidFile" \
--make-pidfile --exec "$daemonExec" -- $daemonArgs
eend $?
}
stop () {
ebegin "Stopping irssid"
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile "$pidFile" \
--exec "$daemonExec" -- $daemonArgs
eend $?
}
|