Skip to content

smf manifest for sysutils/apcupsd #398

Description

@stratacast

I noticed there's no smf manifest for apcupsd. This is a naive attempt at generating one. This is what I created for the gz, installed apcupsd from the tools pkgsrc path.

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="application-apcupsd" >
    <service name="application/apcupsd" type="service" version="1" >
        <create_default_instance enabled="true" />
        <dependency name="dep0" grouping="require_all" restart_on="error" type="service" >
            <service_fmri value="svc:/milestone/multi-user:default" />
        </dependency>
        <exec_method type="method" name="start" exec="/opt/tools/sbin/apcupsd -f /opt/tools/etc/apcupsd/apcupsd.conf &amp;" timeout_seconds="10" >
            <method_context working_directory="/opt/tools/etc/apcupsd" >
                <method_credential user="root" group="staff" />
            </method_context>
        </exec_method>
        <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60" />
        <template >
            <common_name >
                <loctext xml:lang="C" >apcupsd</loctext>
            </common_name>
        </template>
    </service>
</service_bundle>

Activity

  1. jperkin commented on Dec 19, 2024

    @jperkin
    Collaborator

    Thanks! This will need a bit of work before it can be integrated. pkgsrc supports many different install types, so a lot of this information is extracted to variables so that it works for all builds.

    Picking one at random:

    https://github.com/NetBSD/pkgsrc/blob/trunk/sysutils/rsyslog/files/smf/manifest.xml

    you can see various @VARIABLE@ strings, which are replaced for the target. I'd suggest using all of the ones included in that file, and also switching the group to root.

    I'm happy to do this after the Christmas holidays if necessary.

  2. self-assigned this
    on Dec 19, 2024
  3. stratacast commented on Dec 20, 2024

    @stratacast
    Author

    Probably still some stuff missing, but I tweaked it more to match what you shared

    <?xml version="1.0"?>
    <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
    <service_bundle type="manifest" name="apcupsd" >
        <service name="@SMF_PREFIX@/@SMF_NAME@" type="service" version="1" >
            <create_default_instance enabled="true" />
            <dependency name="multi-user" grouping="require_all" restart_on="error" type="service" >
                <service_fmri value="svc:/milestone/multi-user:default" />
            </dependency>
            <dependency name="network" grouping="require_all" restart_on="error" type="service">
              <service_fmri value="svc:/milestone/network:default" />
            </dependency>
            <exec_method type="method" name="start" exec="@PREFIX@/sbin/apcupsd -f /opt/tools/etc/apcupsd/apcupsd.conf &amp;" timeout_seconds="10" >
                <method_context working_directory="@PREFIX@/etc/apcupsd" >
                    <method_credential user="root" group="root" />
                </method_context>
            </exec_method>
            <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60" />
            <template >
                <common_name >
                    <loctext xml:lang="C" >apcupsd</loctext>
                </common_name>
            </template>
        </service>
    </service_bundle>
    

    I'm not sure if that multi-user dependency is necessary. Maybe that dependency was generated because group was staff? I would assume too, looking at the rsyslog example, it could use network the network dependency perhaps. Since some configurations of apcupsd could require networking. I'm connected over USB.

    Thank you! Enjoy your Christmas and New Year

  4. added a commit that references this issue on Jan 28, 2025
  5. added a commit that references this issue on May 30, 2025
  6. added a commit that references this issue on May 14, 2026
  7. added a commit that references this issue on Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions