#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2016-2023 Jim Klimov
#

set name=pkg.fmri value=pkg:/$(COMPONENT_FMRI)/cgi@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.human-version value=$(HUMAN_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY) - NUT CGI clients"
set name=info.classification value="$(COMPONENT_CLASSIFICATION)"
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)

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

<transform file path=usr/lib/nut/cgi-bin/.+ -> default mode 0555>
<transform dir path=usr/lib/nut/cgi-bin -> set group bin>
<transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
<transform file path=usr/share/man/man1/(.+) -> set action.hash usr/share/man/man1/%<1> >
<transform file path=usr/share/man/man1m/(.+) -> set action.hash usr/share/man/man1m/%<1> >

depend fmri=$(COMPONENT_FMRI)/common@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION) type=require
depend fmri=library/security/openssl-31 type=require

### NUT CGI clients, require libgd
file path=usr/lib/nut/cgi-bin/upsimage.cgi
file path=usr/lib/nut/cgi-bin/upsset.cgi
file path=usr/lib/nut/cgi-bin/upsstats.cgi

file path=usr/share/man/man5/hosts.conf.5
file path=usr/share/man/man5/upsset.conf.5
file path=usr/share/man/man5/upsstats.html.5

file path=usr/share/man/man1m/upsimage.cgi.1m
file path=usr/share/man/man1m/upsset.cgi.1m
file path=usr/share/man/man1m/upsstats.cgi.1m

# We deliver the sample configs as the ones to use,
# at worst they have no actual information inside and do nothing.
# Also, the CGIs are disabled by default `upsset.conf` contents
file etc/nut/hosts.conf.sample \
    path=etc/nut/hosts.conf \
    group=nut owner=root mode=0640 preserve=true
file etc/nut/upsset.conf.sample \
    path=etc/nut/upsset.conf \
    group=nut owner=root mode=0640 preserve=true
file etc/nut/upsstats-single.html.sample \
    path=etc/nut/upsstats-single.html \
    group=nut owner=root mode=0640 preserve=true
file etc/nut/upsstats.html.sample \
    path=etc/nut/upsstats.html \
    group=nut owner=root mode=0640 preserve=true