williamh    15/06/02 21:08:48

  Modified:             ChangeLog
  Added:                s6.eclass
  Log:
  Add s6.eclass to handle s6 services

Revision  Changes    Path
1.1635               eclass/ChangeLog

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1635&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1635&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1634&r2=1.1635

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1634
retrieving revision 1.1635
diff -u -r1.1634 -r1.1635
--- ChangeLog   31 May 2015 15:51:21 -0000      1.1634
+++ ChangeLog   2 Jun 2015 21:08:48 -0000       1.1635
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1634 2015/05/31 
15:51:21 mrueg Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1635 2015/06/02 
21:08:48 williamh Exp $
+
+  02 Jun 2015; William Hubbs <[email protected]> +s6.eclass:
+  Add s6.eclass for handling s6 services
 
   31 May 2015; Manuel RĂ¼ger <[email protected]> kde5.eclass:
   Sync verbosely with kde overlay. Drop fetch restriction for unpublished



1.1                  eclass/s6.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/s6.eclass?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/s6.eclass?rev=1.1&content-type=text/plain

Index: s6.eclass
===================================================================
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/s6.eclass,v 1.1 2015/06/02 21:08:48 
williamh Exp $

# @ECLASS: s6.eclass
# @MAINTAINER:
# William Hubbs <[email protected]>
# @BLURB: helper functions to install s6 services
# @DESCRIPTION:
# This eclass provides helpers to install s6 services.
# @EXAMPLE:
#
# @CODE
# inherit s6
#
# src_install() {
#       ...
#       s6_install_service myservice "${FILESDIR}"/run-s6 
"${FILESDIR}"/finish-s6
        ...
#       If you want a service to be logged, install the log service as
#       shown here.
#       s6_install_service myservice/log "${FILESDIR}"/log-run-s6 \
#               "${FILESDIR}"/log-finish-s6
#       ...
# }
# @CODE

case ${EAPI:-0} in
        5) ;;
        *) die "${ECLASS}.eclass: API in EAPI ${EAPI} not yet established"
esac

# @FUNCTION: _s6_get_servicedir
# @INTERNAL
# @DESCRIPTION:
# Get unprefixed servicedir.
_s6_get_servicedir() {
        echo /var/svc.d
}

# @FUNCTION: s6_get_servicedir
# @DESCRIPTION:
# Output the path for the s6 service directory (not including ${D}).
s6_get_servicedir() {
        debug-print-function ${FUNCNAME} "${@}"

        echo "${EPREFIX}$(_s6_get_servicedir)"
}

# @FUNCTION: s6_install_service
# @USAGE: servicename run finish
# @DESCRIPTION:
# Install an s6 service.
# servicename is the name of the service.
# run is the run script for the service.
# finish is the optional finish script for the service.
s6_install_service() {
        debug-print-function ${FUNCNAME} "${@}"

        local name="$1"
        local run="$2"
        local finish="$3"

        [[ $name ]] ||
                die "${ECLASS}.eclass: you must specify the s6 service name"
        [[ $run ]] ||
                die "${ECLASS}.eclass: you must specify the s6 service run 
script"

        (
        local servicepath="$(_s6_get_servicedir)/$name"
        exeinto "$servicepath"
        newexe "$run" run
        [[ $finish ]] && newexe "$finish" finish
        )
}

# @FUNCTION: s6_service_down
# @USAGE: servicename
# @DESCRIPTION:
# Install the "down" flag so this service will not be started by
# default.
# servicename is the name of the service.
s6_service_down() {
        debug-print-function ${FUNCNAME} "${@}"

        local name="$1"

        [[ $name ]] ||
                die "${ECLASS}.eclass: you must specify the s6 service name"

        (
        touch "$T"/down || die
        local servicepath="$(_s6_get_servicedir)/$name"
        insinto "$servicepath"
        doins "$T"/down
        )
}

# @FUNCTION: s6_service_nosetsid
# @USAGE: servicename
# @DESCRIPTION:
# Install the "nosetsid" flag so this service will not be made a session
# leader.
# servicename is the name of the service.
s6_service_nosetsid() {
        debug-print-function ${FUNCNAME} "${@}"

        local name="$1"

        [[ $name ]] ||
                die "${ECLASS}.eclass: you must specify the s6 service name"

        (
        touch "$T"/nosetsid || die
        local servicepath="$(_s6_get_servicedir)/$name"
        insinto "$servicepath"
        doins "$T"/nosetsid
        )
}




Reply via email to