diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2011-06-20 17:38:14 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2011-06-20 17:52:43 +0200 |
commit | 5e2fd2e1e50fe6cabdb3f9ec43bd00c5405627be (patch) | |
tree | dc78d8697f503cc22a4125f0198b3a945b34b4d5 | |
parent | c726262ca9f1ced15858c99085cec97f9896072a (diff) | |
download | ptxdist-5e2fd2e1e50fe6cabdb3f9ec43bd00c5405627be.tar.gz ptxdist-5e2fd2e1e50fe6cabdb3f9ec43bd00c5405627be.tar.xz |
pureftpd: add systemd support
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | generic/etc/init.d/pureftpd | 14 | ||||
-rw-r--r-- | generic/lib/systemd/system/pure-ftpd.socket | 9 | ||||
-rw-r--r-- | generic/lib/systemd/system/pure-ftpd@.service | 9 | ||||
-rw-r--r-- | generic/lib/systemd/system/pure-uploadscript.service | 7 | ||||
-rw-r--r-- | rules/pureftpd.in | 26 | ||||
-rw-r--r-- | rules/pureftpd.make | 49 |
6 files changed, 98 insertions, 16 deletions
diff --git a/generic/etc/init.d/pureftpd b/generic/etc/init.d/pureftpd index 31676459d..4d23aec2c 100644 --- a/generic/etc/init.d/pureftpd +++ b/generic/etc/init.d/pureftpd @@ -9,20 +9,12 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin DAEMON="pure-ftpd" NAME="pure-ftpd" PREFIX="pure-ftpd: " -DAEMON_OPTIONS="-B -H" +DAEMON_OPTIONS="-B @DAEMON_ARGS@" DAEMON_PIDFILE=/var/run/pure-ftpd.pid HELPER="pure-uploadscript" -HELPER_START_SCRIPT="" -HELPER_OPTIONS="-B -u 0 -g 0" - -# read config (will override defaults) -DEFAULTS="/etc/pure-ftpd.defaults" -if [ -r $DEFAULTS ]; then - . $DEFAULTS -else - echo "${PREFIX}no $DEFAULTS found." -fi +HELPER_START_SCRIPT="@HELPER_SCRIPT@" +HELPER_OPTIONS="-B @HELPER_ARGS@" trap "" 1 trap "" 15 diff --git a/generic/lib/systemd/system/pure-ftpd.socket b/generic/lib/systemd/system/pure-ftpd.socket new file mode 100644 index 000000000..1883b579f --- /dev/null +++ b/generic/lib/systemd/system/pure-ftpd.socket @@ -0,0 +1,9 @@ +[Unit] +Conflicts=pure-ftpd.service + +[Socket] +ListenStream=21 +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/generic/lib/systemd/system/pure-ftpd@.service b/generic/lib/systemd/system/pure-ftpd@.service new file mode 100644 index 000000000..769861dea --- /dev/null +++ b/generic/lib/systemd/system/pure-ftpd@.service @@ -0,0 +1,9 @@ +[Unit] +Description=pure-ftpd +Requires=pure-uploadscript.service +After=pure-uploadscript.service +After=syslog.target + +[Service] +ExecStart=/usr/sbin/pure-ftpd @ARGS@ +StandardInput=socket diff --git a/generic/lib/systemd/system/pure-uploadscript.service b/generic/lib/systemd/system/pure-uploadscript.service new file mode 100644 index 000000000..b0201f3a4 --- /dev/null +++ b/generic/lib/systemd/system/pure-uploadscript.service @@ -0,0 +1,7 @@ +[Unit] +Description=pure-ftpd upload script helper +ConditionPathExists=/usr/sbin/pure-uploadscript +ConditionPathExists=@SCRIPT@ + +[Service] +ExecStart=/usr/sbin/pure-uploadscript @ARGS@ -r @SCRIPT@ diff --git a/rules/pureftpd.in b/rules/pureftpd.in index aba67a03c..d04f9b27d 100644 --- a/rules/pureftpd.in +++ b/rules/pureftpd.in @@ -15,12 +15,32 @@ menuconfig PUREFTPD if PUREFTPD +config PUREFTPD_ARGS + string + default "-H" + prompt "daemon command-line args" + config PUREFTPD_UPLOADSCRIPT bool prompt "support upload scripts" help Allow running an external script after an upload +if PUREFTPD_UPLOADSCRIPT + +config PUREFTPD_UPLOADSCRIPT_ARGS + string + default "-u 0 -g 0" + prompt "upload helper args" + +config PUREFTPD_UPLOADSCRIPT_SCRIPT + string + prompt "script path" + help + Full path of the upload script + +endif + comment "build options ---" config PUREFTPD_VIRTUALHOSTS @@ -68,4 +88,10 @@ config PUREFTPD_STARTSCRIPT default y prompt "install /etc/init.d/pureftpd" +config PUREFTPD_SYSTEMD_UNIT + bool + default y + depends on SYSTEMD + prompt "install systemd unit files for pure-ftpd" + endif diff --git a/rules/pureftpd.make b/rules/pureftpd.make index c117c61b5..47605072e 100644 --- a/rules/pureftpd.make +++ b/rules/pureftpd.make @@ -49,7 +49,8 @@ PUREFTPD_AUTOCONF := \ --without-mysql \ --without-pgsql \ --without-privsep \ - --without-capabilities + --without-capabilities \ + --with-standalone # # FIXME: configure probes host's /dev/urandom and /dev/random @@ -57,10 +58,10 @@ PUREFTPD_AUTOCONF := \ # # Can --with-probe-random-dev solve this? -ifdef PTXCONF_PUREFTPD_INETD_SERVER -PUREFTPD_AUTOCONF += --with-inetd --without-standalone +ifdef PTXCONF_PUREFTPD_SYSTEMD_UNIT +PUREFTPD_AUTOCONF += --with-inetd else -PUREFTPD_AUTOCONF += --without-inetd --with-standalone +PUREFTPD_AUTOCONF += --without-inetd endif ifdef PTXCONF_PUREFTPD_UPLOADSCRIPT @@ -97,6 +98,11 @@ endif # Target-Install # ---------------------------------------------------------------------------- +PUREFTPD_ARGS := $(call remove_quotes,$(PTXCONF_PUREFTPD_ARGS)) +ifdef PTXCONF_PUREFTPD_UPLOADSCRIPT +PUREFTPD_ARGS += -o +endif + $(STATEDIR)/pureftpd.targetinstall: @$(call targetinfo) @@ -113,7 +119,7 @@ $(STATEDIR)/pureftpd.targetinstall: ifdef PTXCONF_PUREFTPD_UPLOADSCRIPT @$(call install_copy, pureftpd, 0, 0, 0755, -, \ - /usr/sbin/pure-uploadscript, n) + /usr/sbin/pure-uploadscript) endif # # @@ -123,6 +129,16 @@ ifdef PTXCONF_INITMETHOD_BBINIT ifdef PTXCONF_PUREFTPD_STARTSCRIPT @$(call install_alternative, pureftpd, 0, 0, 0755, /etc/init.d/pureftpd) + @$(call install_replace, pureftpd, \ + /etc/init.d/pureftpd, \ + @DAEMON_ARGS@, "$(PUREFTPD_ARGS)") + @$(call install_replace, pureftpd, \ + /etc/init.d/pureftpd, \ + @HELPER_ARGS@, $(PTXCONF_PUREFTPD_UPLOADSCRIPT_ARGS)) + @$(call install_replace, pureftpd, \ + /etc/init.d/pureftpd, \ + @HELPER_SCRIPT@, $(PTXCONF_PUREFTPD_UPLOADSCRIPT_SCRIPT)) + ifneq ($(call remove_quotes,$(PTXCONF_PUREFTPD_BBINIT_LINK)),) @$(call install_link, pureftpd, \ ../init.d/pureftpd, \ @@ -130,6 +146,29 @@ ifneq ($(call remove_quotes,$(PTXCONF_PUREFTPD_BBINIT_LINK)),) endif endif endif + +ifdef PTXCONF_PUREFTPD_SYSTEMD_UNIT + @$(call install_alternative, pureftpd, 0, 0, 0644, \ + /lib/systemd/system/pure-ftpd.socket) + @$(call install_link, pureftpd, ../pure-ftpd.socket, \ + /lib/systemd/system/sockets.target.wants/pure-ftpd.socket) + + @$(call install_alternative, pureftpd, 0, 0, 0644, \ + /lib/systemd/system/pure-ftpd@.service) + @$(call install_replace, pureftpd, \ + /lib/systemd/system/pure-ftpd@.service, \ + @ARGS@, "$(PUREFTPD_ARGS)") + + @$(call install_alternative, pureftpd, 0, 0, 0644, \ + /lib/systemd/system/pure-uploadscript.service) + @$(call install_replace, pureftpd, \ + /lib/systemd/system/pure-uploadscript.service, \ + @ARGS@, $(PTXCONF_PUREFTPD_UPLOADSCRIPT_ARGS)) + @$(call install_replace, pureftpd, \ + /lib/systemd/system/pure-uploadscript.service, \ + @SCRIPT@, $(PTXCONF_PUREFTPD_UPLOADSCRIPT_SCRIPT)) +endif + @$(call install_finish, pureftpd) @$(call touch) |