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 2022 OmniOS Community Edition (OmniOSce) Association.
Copy link
Member

Choose a reason for hiding this comment

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

can you please update the year to 2024


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

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

set_arch 64
set_gover 1.22

# No configure
configure_amd64() { :; }
justledbetter marked this conversation as resolved.
Show resolved Hide resolved

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
105 changes: 105 additions & 0 deletions build/sdns/files/sdns-template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?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">
<method_context security_flags="aslr">
<method_credential user="$(USER)"
group="$(GROUP)"
privileges="basic,net_privaddr,!proc_info,!proc_session,!file_link_any" />
</method_context>
justledbetter marked this conversation as resolved.
Show resolved Hide resolved
</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 Guo-Rong Koh
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I don't remember writing this 😂


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=$(PROG) gid=5353
user ftpuser=false username=$(PROG) uid=5353 group=$(PROG) \
Copy link
Member

Choose a reason for hiding this comment

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

system UIDs should be below 100 to avoid clashes with user IDs. have a look at doc/idlist.md and look for a free uid/gid pair (e.g. 58). and document the ID you are using in idlist.md.

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>
Loading