Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdns: Add new package to repo #1457

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
70 changes: 70 additions & 0 deletions build/sdns/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/bash
#
# {{{ CDDL HEADER
#
# 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 2024 OmniOS Community Edition (OmniOSce) Association.

. ../../lib/build.sh

PROG=sdns
VER=1.3.7
PKG=ooce/network/sdns
SUMMARY="sdns"
DESC="Simple DNS Server"

set_arch 64
set_gover 1.22

# No configure
pre_configure() { false; }

CONFIG=etc/${PREFIX#/}/$PROG
DATA=var/${PREFIX#/}/$PROG

XFORM_ARGS="
-DPREFIX=${PREFIX#/}
-DPROG=$PROG
-DVERSION=$VER
-DUSER=sdns -DGROUP=sdns
-DCONFIG=$CONFIG
-DDATA=$DATA
-DXDG_CONFIG=${CONFIG%/$PROG}
-DXDG_DATA=${DATA%/$PROG}
"

build() {
pushd $TMPDIR/$BUILDDIR > /dev/null

logmsg "Building $PROG"
export CGO_ENABLED=0
export GOOS=illumos

logcmd go build || logerr "Unable to build $PROG"

popd >/dev/null
}

init
clone_go_source $PROG semihalev v$VER
patch_source
print_config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a leftover from another build.sh

prep_build
build
install_go $PROG
xform files/$PROG-template.xml > $TMPDIR/$PROG.xml
install_smf network $PROG.xml
make_package
clean_up

# Vim hints
# vim:ts=4:sw=4:et:fdm=marker
100 changes: 100 additions & 0 deletions build/sdns/files/sdns-template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--

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 2024 OmniOS Community Edition (OmniOSce) Association.

-->
<service_bundle type="manifest"
name="network:sdns">

<service name="network/sdns"
type="service"
version="1">

<instance name="default"
enabled="false">

<dependency name="loopback"
grouping="require_any"
restart_on="error"
type="service">
<service_fmri value="svc:/network/loopback" />
</dependency>

<dependency name="network"
grouping="optional_all"
restart_on="error"
type="service">
<service_fmri value="svc:/milestone/network" />
</dependency>

<dependency name="filesystem_local"
grouping="require_all"
restart_on="none"
type="service">
<service_fmri value="svc:/system/filesystem/local:default" />
</dependency>

<dependent name="sdns_multi-user"
grouping="optional_all"
restart_on="none">
<service_fmri value="svc:/milestone/multi-user" />
</dependent>
<method_context security_flags="aslr">
<method_credential user="$(USER)"
group="$(GROUP)"
limit_privileges="basic,net_privaddr,!proc_info,!file_link_any" />
<method_environment>
<envvar name="HOME"
value="/$(DATA)" />
<envvar name="XDG_CONFIG_HOME"
value="/$(XDG_CONFIG)" />
<envvar name="XDG_DATA_HOME"
value="/$(XDG_DATA)" />
</method_environment>
</method_context>

<exec_method type="method"
name="start"
exec="%{config/exec} --config %{config/file} &amp;"
timeout_seconds="60">
</exec_method>

<exec_method type="method"
name="stop"
exec=":kill"
timeout_seconds="60"></exec_method>

<property_group name="config"
type="application">
<propval name="file"
type="astring"
value="/$(CONFIG)/sdns.conf" />
<propval name="exec"
type="astring"
value="/$(PREFIX)/bin/$(PROG)" />
</property_group>

<template>
<common_name>
<loctext xml:lang="C">sdns $(VERSION)</loctext>
</common_name>
</template>

</instance>

<stability value="External" />

</service>

</service_bundle>
26 changes: 26 additions & 0 deletions build/sdns/local.mog
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# 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 2024 OmniOS Community Edition (OmniOSce) Association.

license LICENSE license=MIT

dir path=$(CONFIG) owner=$(USER) group=$(GROUP) mode=0700
dir path=$(DATA) owner=$(USER) group=$(GROUP) mode=0700
dir path=var/log/$(PREFIX)/$(PROG) owner=$(USER) group=$(GROUP) mode=0755

group groupname=$(GROUP) gid=35
user ftpuser=false username=$(USER) uid=35 group=$(GROUP) \
gcos-field="SDNS User" home-dir=/$(DATA) password=NP

<transform file path=$(CONFIG)/ -> set preserve true>

<transform file path=$(PREFIX)/bin/$(PROG) -> \
set restart_fmri svc:/network/sdns:default>
1 change: 1 addition & 0 deletions doc/idlist.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
| illumos | 25 | smmsp
| extra | 27 | postfix
| extra | 28 | postdrop
| extra | 35 | sdns
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you misinterpreted the input from @citrus-it. Yes we need this in groups since you allocate the sdns gid. But you'll also need to leave your initial entry in users, as you allocate a uid as well

| extra | 45 | sasl
| illumos | 50 | gdm
| illumos | 52 | upnp
Expand Down
Loading