61 lines
1.2 KiB
Bash
61 lines
1.2 KiB
Bash
# Copyright 2026 Shin'ya Minazuki
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
# @ECLASS: dinit.eclass
|
|
# @MAINTAINER:
|
|
# Shin'ya Minazuki <shinyoukai@chaotic.ninja>
|
|
# @AUTHOR:
|
|
# Shin'ya Minazuki <shinyoukai@chaotic.ninja>
|
|
# @SUPPORTED_EAPIS: 8
|
|
# @BLURB: helper functions to install service units for sys-process/dinit
|
|
# @DESCRIPTION:
|
|
# This eclass provides a set of functions to install unit files for
|
|
# https://davmac.org/projects/dinit
|
|
# @EXAMPLE:
|
|
#
|
|
# @CODE:
|
|
# inherit dinit
|
|
#
|
|
# src_install() {
|
|
# dinit_newservice "${FILESDIR}/gitea.dinit" "${PN}"
|
|
# }
|
|
# @CODE
|
|
|
|
case ${EAPI} in
|
|
8) ;;
|
|
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
|
esac
|
|
|
|
if [[ ! ${_DINIT_ECLASS} ]]; then
|
|
_DINIT_ECLASS=1
|
|
|
|
# @FUNCTION: dinit_doservice
|
|
# @USAGE: <service>
|
|
# @DESCRIPTION:
|
|
# Install dinit service(s).
|
|
# This function uses doins, therefore it is fatal
|
|
dinit_doservice() {
|
|
debug-print-function "${FUNCNAME}" "$@"
|
|
|
|
(
|
|
insopts -m 0644
|
|
insinto "${D}/etc/dinit.d"
|
|
doins "${@}"
|
|
)
|
|
}
|
|
|
|
# @FUNCTION: dinit_newservice
|
|
# @USAGE: <old-name> <new-name>
|
|
# @DESCRIPTION:
|
|
# Install dinit service with a new name.
|
|
# This function uses newins, therefore it is fatal
|
|
dinit_newservice() {
|
|
debug-print-function ${FUNCNAME} "$@"
|
|
|
|
(
|
|
insopts -m 0644
|
|
insinto "${D}/etc/dinit.d"
|
|
newins "${@}"
|
|
)
|
|
}
|
|
|
|
fi
|