summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore13
-rw-r--r--Makefile25
-rw-r--r--nshd.service.in10
-rw-r--r--nshd.socket (renamed from nshd.socket.in)5
-rw-r--r--nshd.sysusers.in1
-rw-r--r--scripts/common.rb.in (renamed from scripts/common.rb)2
6 files changed, 26 insertions, 30 deletions
diff --git a/.gitignore b/.gitignore
index 2ffdf1a..0446d88 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,13 @@
/pkg
/bin/
-/nshd.service
-/nshd.socket
.var.*
.tmp.*
-/LICENSE.*.txt
*.o
-
*~
-output/
-cache/
-parabola-keyring-*.tar.gz
+/nshd.service
+/nshd.sysusers
+/scripts/common.rb
+/LICENSE.*.txt
+
+parabola-keyring-*.tar.gz
diff --git a/Makefile b/Makefile
index 80031c7..b03c431 100644
--- a/Makefile
+++ b/Makefile
@@ -20,12 +20,12 @@
# <http://www.gnu.org/licenses/>.
PACKAGE = parabola-hackers
-systemddir = $(libdir)/systemd
+sysusersdir=$(prefix)/lib/sysusers.d
+systemunitdir=$(prefix)/lib/systemd/system
conf_file = $(sysconfdir)/$(PACKAGE).yml
NET ?=
#NET ?= FORCE
user = nshd
-group = nshd
CFLAGS = -Wall -Wextra -Werror -pedantic
CC = gcc -std=c99
@@ -39,12 +39,12 @@ CGO_ENABLED = 1
at.subdirs += src/lukeshu.com/git/go/libnslcd.git/proto
-scripts = $(notdir $(wildcard $(srcdir)/scripts/*))
+scripts = $(filter-out common.rb common.rb.in,$(notdir $(wildcard $(srcdir)/scripts/*))) common.rb
std.gen_files += LICENSE.lgpl-2.1.txt LICENSE.gpl-2.txt LICENSE.apache-2.0.txt
-std.out_files += bin/nshd nshd.service nshd.socket test/runner
-std.sys_files += $(addprefix $(bindir)/,nshd $(scripts)) $(systemddir)/system/nshd.socket $(systemddir)/system/nshd.service
-std.clean_files += test/*.o pkg/
+std.out_files += bin/nshd nshd.service nshd.sysusers scripts/common.rb test/runner
+std.sys_files += $(addprefix $(bindir)/,nshd $(scripts)) $(systemunitdir)/nshd.socket $(systemunitdir)/nshd.service $(sysusersdir)/nshd.conf $(conf_file)
+std.clean_files += test/*.o pkg/ .tmp* .var*
$(srcdir)/LICENSE.lgpl-2.1.txt: $(NET)
curl https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt > $@
@@ -69,8 +69,9 @@ $(outdir)/%: $(outdir)/%.o $(var)CC $(var)LDFLAGS
$(outdir)/%: $(srcdir)/%.in
< $< sed $(foreach v,$(patsubst $(var)%,%,$(filter $(var)%,$^)), -e 's|@$v@|$($v)|g' ) > $@
-$(outdir)/nshd.service: $(var)user $(var)group $(var)bindir
-$(outdir)/nshd.socket: $(var)user $(var)group
+$(outdir)/nshd.service: $(var)user $(var)bindir
+$(outdir)/nshd.sysusers: $(var)user
+$(outdir)/scripts/common.rb: $(var)conf_file
$(DESTDIR)$(bindir)/%: $(outdir)/bin/%
install -TDm755 $< $@
@@ -78,9 +79,13 @@ $(DESTDIR)$(bindir)/%: $(srcdir)/scripts/%
install -TDm755 $< $@
$(DESTDIR)$(bindir)/common.rb: $(srcdir)/scripts/common.rb
install -TDm644 $< $@
-$(DESTDIR)$(systemddir)/system/%.socket: $(outdir)/%.socket
+$(DESTDIR)$(systemunitdir)/%.socket: $(outdir)/%.socket
install -TDm644 $< $@
-$(DESTDIR)$(systemddir)/system/%.service: $(outdir)/%.service
+$(DESTDIR)$(systemunitdir)/%.service: $(outdir)/%.service
+ install -TDm644 $< $@
+$(DESTDIR)$(sysusersdir)/%.conf: $(outdir)/%.sysusers
+ install -TDm644 $< $@
+$(DESTDIR)$(conf_file): $(srcdir)/parabola-hackers.yml
install -TDm644 $< $@
.PHONY: FORCE
diff --git a/nshd.service.in b/nshd.service.in
index caf5508..57897ab 100644
--- a/nshd.service.in
+++ b/nshd.service.in
@@ -1,15 +1,9 @@
[Unit]
-Description=Parabola hackers.git authentication
+Description=Name Switch hackers.git Daemon
Requires=nshd.socket
-After=syslog.target nshd.socket
[Service]
Type=notify
-Sockets=nshd.socket
-ExecStart=@bindir@/nshd
+ExecStart=/usr/bin/sleep 100
User=@user@
-Group=@group@
-
-[Install]
-WantedBy=multi-user.target
diff --git a/nshd.socket.in b/nshd.socket
index a514391..2434aa3 100644
--- a/nshd.socket.in
+++ b/nshd.socket
@@ -1,13 +1,10 @@
[Unit]
-Description=Parabola hackers.git authentication
+Description=Name Switch hackers.git Daemon socket
[Socket]
ListenStream=/var/run/nslcd/socket
PassCredentials=yes
PassSecurity=yes
-SocketUser=@user@
-SocketGroup=@group@
-
[Install]
WantedBy=sockets.target
diff --git a/nshd.sysusers.in b/nshd.sysusers.in
new file mode 100644
index 0000000..6b2a442
--- /dev/null
+++ b/nshd.sysusers.in
@@ -0,0 +1 @@
+u @user@ - "Name Switch hackers.git Daemon"
diff --git a/scripts/common.rb b/scripts/common.rb.in
index 91e14be..c7dc261 100644
--- a/scripts/common.rb
+++ b/scripts/common.rb.in
@@ -1,7 +1,7 @@
require 'yaml'
def cfg
- @cfg ||= YAML::load(open("parabola-hackers.yml"))
+ @cfg ||= YAML::load(open("@conf_file@"))
end
def load_user_yaml(filename)