#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2016-2023 Jim Klimov. All rights reserved.
#

set name=pkg.fmri \
    value=pkg:/$(COMPONENT_FMRI)/common@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.human-version value=$(HUMAN_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY) (Base accounts and dirs)"
set name=info.classification value="$(COMPONENT_CLASSIFICATION)"
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)

license $(COMPONENT_LICENSE_FILE) license='$(COMPONENT_LICENSE)'

# Ensure the UID exists till the end, until after the main packages are removed
# and in particular do not move databases and logs into lost+found on uninstall
# Note the locked user password is NL (not NP) because it has to manage crontab
# Default rights inspired by scripts/Solaris/postinstall.in
group groupname=nut gid=77
user ftpuser=false gcos-field="Network UPS Tools Reserved UID" \
    group=nut group-list=root \
    password=NL username=nut uid=77

# NUT service names are grouped as "system/power/nut*", hence the directory:
dir group=sys owner=root mode=0755 path=lib/svc/manifest/system/power

# These directories can hold some content generated or downloaded at runtime
# and can become lost+found when you un/re-install the core packages (if these
# pkg actions are delivered there instead)
dir group=nut owner=root mode=0775 path=etc/nut
dir group=nut owner=root mode=0770 path=var/db/nut
file files/README-NUT-etc.txt path=etc/nut/README-NUT-etc.txt owner=root group=bin

# Configuration report with details of this build
file path=usr/share/nut/config.nut_report_feature.log

# NUT umbrella service
# Services for monitoring client (upsmon) generally does not have to be
# present and running on the same system as a data server and drivers.
# NUT should start generally after networking (if SNMP or NetXML is used,
# or if this box is a client to remote upsd). Ending is trickier - could
# want it to issue killpower late in shutdown, but have network to be able
# to do so (for remote UPSes). This can be tuned in XML manifest by user.
file path=usr/share/nut/solaris-smf/manifest/nut.xml
link path=lib/svc/manifest/system/power/nut.xml \
    target=../../../../../usr/share/nut/solaris-smf/manifest/nut.xml \
    restart_fmri=svc:/system/manifest-import:default

# Common to clients, server, drivers...
file scripts/misc/nut.bash_completion path=usr/share/bash-completion/completions/nut
file scripts/logrotate/nutlogd path=usr/share/nut/nutlogd.example