* Tue Feb 25 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme

- move to full systemd unit [SME: 12877]
This commit is contained in:
Jean-Philippe Pialasse 2025-02-25 23:08:48 -05:00
parent 9bc8a0f5eb
commit 537dbcf295
13 changed files with 65 additions and 33 deletions

View File

@ -1 +0,0 @@
sme10

View File

@ -7,23 +7,21 @@ use esmith::Build::CreateLinks qw(:all);
#-------------------------------------------------------------------
# actions for bootstrap-console-save event, smeserver-tinydns-update :
#-------------------------------------------------------------------
foreach (qw(
env/IP
env/DATALIMIT
root/data
))
{
templates2events("/var/service/tinydns/$_", qw(
templates2events("/var/service/tinydns/root/data", qw(
bootstrap-console-save
smeserver-tinydns-update
));
}
templates2events("/usr/lib/systemd/system/tinydns.service.d/50koozali.conf", qw(
bootstrap-console-save
smeserver-tinydns-update
));
#--------------------------------------------------
# actions for ip-change event
#--------------------------------------------------
my $event = "ip-change";
safe_symlink("sigusr2", "root/etc/e-smith/events/$event/services2adjust/tinydns");
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/tinydns");
#--------------------------------------------------
# actions for smeserver-tinydns-update event
@ -31,5 +29,8 @@ safe_symlink("sigusr2", "root/etc/e-smith/events/$event/services2adjust/tinydns"
$event = "smeserver-tinydns-update";
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/tinydns");
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event);
templates2events("/usr/lib/systemd/system/tinydns.service.d/50koozali.conf", $event);
templates2events("/etc/rsyslog.conf", $event);
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/rsyslog");
event_link("systemd-reload", $event, "89");

View File

@ -0,0 +1,3 @@
#tinydns
:programname, isequal, "tinydns" /var/log/tinydns/tinydns.log
& stop

View File

@ -0,0 +1,7 @@
[Service]
{
my $datalimit = $tinydns{'DataLimit'} || "3000000";
my $ListenIP= $tinydns{'ListenIP'} || "127.0.0.1";
$OUT = "LimitDATA=$datalimit\n";
$OUT .= 'Environment="DATALIMIT='.$datalimit.'" "IP='.$ListenIP.'" GID=53 UID=53 "ROOT=/var/service/tinydns/root"';
}

View File

@ -1,4 +0,0 @@
{
my $datalimit = $tinydns{'DataLimit'} || "300000";
"$datalimit";
}

View File

@ -1,3 +0,0 @@
{
$OUT = $tinydns{'ListenIP'} || "127.0.0.1";
}

View File

@ -0,0 +1,15 @@
/var/log/tinydns/tinydns.log{
weekly
rotate 4
missingok
notifempty
compress
delaycompress
sharedscripts
su root root
create 600 root root
postrotate
/usr/bin/systemctl try-restart tinydns.service >/dev/null 2>&1 || true
endscript
}

View File

@ -1 +0,0 @@
/var/service/tinydns

View File

@ -1,15 +1,27 @@
[Unit]
Description=tinydns,
Description=tinydns, A DNS server daemon
Documentation=man:tinydns(8)
After=network.target
Requires=runit.service
After=networking.service
Requires=network.target
[Service]
Type=oneshot
ExecStartPre=/sbin/e-smith/service-status tinydns
ExecStart=/usr/bin/sv u /service/tinydns
ExecStop=/usr/bin/sv stop /service/tinydns
ExecReload=/usr/bin/sv t /service/tinydns
RemainAfterExit=yes
Type=simple
PermissionsStartOnly=true
LimitDATA=3000000
WorkingDirectory=/var/service/tinydns/root
Environment="DATALIMIT=3000000" "IP=127.0.0.1" GID=53 UID=53 "ROOT=/var/service/tinydns/root"
ExecStartPre=/sbin/e-smith/systemd/tinydns-control1
ExecStartPre=/sbin/e-smith/systemd/tinydns-control2
ExecStart=/usr/local/bin/tinydns
ExecReload=/sbin/e-smith/systemd/tinydns-control1
ExecReload=/sbin/e-smith/systemd/tinydns-control2
#ExecReload=/bin/kill -CONT $MAINPID
Restart=always
RestartSec=20s
SyslogIdentifier=tinydns
[Install]
WantedBy=sme-server.target

View File

@ -4,7 +4,7 @@ Summary: smeserver module to configure tinydns
%define name smeserver-tinydns
Name: %{name}
%define version 11.0.0
%define release 6
%define release 7
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@ -28,6 +28,9 @@ Provides: e-smith-tinydns
AutoReqProv: no
%changelog
* Tue Feb 25 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- move to full systemd unit [SME: 12877]
* Sun Jan 26 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-6.sme
- requires daemontools bins [SME: 12566]
@ -428,16 +431,11 @@ rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--dir /var/service/tinydns 'attr(0755,root,root)' \
--dir /var/service/tinydns/log 'attr(0755,root,root)' \
--file /var/service/tinydns/run 'attr(0750,root,root)' \
--file /var/service/tinydns/tinydns-log.pl 'attr(0750,root,root)' \
--file /var/service/tinydns/tinydns-readstats 'attr(0750,root,root)' \
--file /var/service/tinydns/control/1 'attr(0750,root,root)' \
--file /var/service/tinydns/control/2 'attr(0750,root,root)' \
--file /var/service/tinydns/log/run 'attr(0750,root,root)' \
--file /sbin/e-smith/systemd/tinydns-control1 'attr(0750,root,root)' \
--file /sbin/e-smith/systemd/tinydns-control2 'attr(0750,root,root)' \
--dir /var/log/tinydns 'attr(02755,dnslog,dnslog)' \
--file /var/service/dhcp-dns/dhcp-dns 'attr(0750,root,root)' \
--file /var/service/dhcp-dns/run 'attr(0750,root,root)' \
> %{name}-%{version}-%{release}-filelist
echo "%doc COPYING" >> %{name}-%{version}-%{release}-filelist
@ -445,6 +443,11 @@ echo "%doc COPYING" >> %{name}-%{version}-%{release}-filelist
rm -rf $RPM_BUILD_ROOT
%pre
if [ $1 -gt 1 ] ; then
if [ -e /var/service/tinydns/run ] ; then
/usr/bin/sv d tinydns
/usr/bin/sv d tinydns/log
fi
/sbin/e-smith/create-system-user dns 53 "Name server" /var/service/tinydns /bin/false
/sbin/e-smith/create-system-user dnslog 411 "DNS log user" /var/log /bin/false
exit 0