Skip to contentSkip to conversation

vsftpd: fix pkg_postinst

PATCH New [email protected] 1 participant 2 messages Sep 28, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 vsftpd: fix pkg_postinst

From: Chen Qi <[email protected]>

Fix pkg_postinst to not exit if "$D" is not empty. Otherwise, postinsts from update-rc.d.bbclass would not run and the symlinks under /etc/rc?.d/ would not be created.

---
 .../recipes-daemons/vsftpd/vsftpd_3.0.2.bb         |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
meta-networking/recipes-daemons/vsftpd/vsftpd_3.0.2.bb +4 -5
index a1c4ff4..07c73c5 100644
@@ -88,12 +88,11 @@ USERADD_PARAM_${PN} = "--system --home-dir /var/lib/ftp --no-create-home -g ftp
 GROUPADD_PARAM_${PN} = "-r ftp"
 
 pkg_postinst_${PN}() {
-	if [ -n "$D" ]; then
-		exit 0
-	fi
+    if [ -z "$D" ]; then
 	if type systemd-tmpfiles >/dev/null; then
-		systemd-tmpfiles --create
+	    systemd-tmpfiles --create
 	elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
-		${sysconfdir}/init.d/populate-volatile.sh update
+	    ${sysconfdir}/init.d/populate-volatile.sh update
 	fi
+    fi
 }
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 vsftpd: add systemd service file

From: Chen Qi <[email protected]>

Add systemd service for vsftpd.

---
 .../recipes-daemons/vsftpd/files/vsftpd.service    |    9 +++++++++
 .../recipes-daemons/vsftpd/vsftpd_3.0.2.bb         |   10 +++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-daemons/vsftpd/files/vsftpd.service
meta-networking/recipes-daemons/vsftpd/files/vsftpd.service new file +9 -0
new file mode 100644
index 0000000..e271020
@@ -0,0 +1,9 @@
+[Unit]
+Description=Vsftpd ftp daemon
+After=network.target
+
+[Service]
+ExecStart=@SBINDIR@/vsftpd
+
+[Install]
+WantedBy=multi-user.target
meta-networking/recipes-daemons/vsftpd/vsftpd_3.0.2.bb +9 -1
index 07c73c5..e4d65ee 100644
@@ -16,6 +16,7 @@ SRC_URI = "https://security.appspot.com/downloads/vsftpd-${PV}.tar.gz \
            file://vsftpd.ftpusers \
            file://change-secure_chroot_dir.patch \
            file://volatiles.99_vsftpd \
+           file://vsftpd.service \
 "
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271 \
@@ -35,7 +36,7 @@ PAMLIB = "${@base_contains('DISTRO_FEATURES', 'pam', '-L${STAGING_BASELIBDIR} -l
 NOPAM_SRC ="${@base_contains('PACKAGECONFIG', 'tcp-wrappers', 'file://nopam-with-tcp_wrappers.patch', 'file://nopam.patch', d)}"
 SRC_URI += "${@base_contains('DISTRO_FEATURES', 'pam', '', '${NOPAM_SRC}', d)}"
 
-inherit update-rc.d useradd
+inherit update-rc.d useradd systemd
 
 CONFFILES_${PN} = "${sysconfdir}/vsftpd.conf"
 LDFLAGS_append =" -lcrypt -lcap"
@@ -76,6 +77,11 @@ do_install() {
         echo "d /var/run/vsftpd/empty 0755 root root -" \
         > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
     fi
+
+    # Install systemd unit files
+    install -d ${D}${systemd_unitdir}/system
+    install -m 0644 ${WORKDIR}/vsftpd.service ${D}${systemd_unitdir}/system
+    sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/vsftpd.service
 }
 
 INITSCRIPT_PACKAGES = "${PN}"
@@ -87,6 +93,8 @@ USERADD_PARAM_${PN} = "--system --home-dir /var/lib/ftp --no-create-home -g ftp
                        --shell /bin/false ftp "
 GROUPADD_PARAM_${PN} = "-r ftp"
 
+SYSTEMD_SERVICE_${PN} = "vsftpd.service"
+
 pkg_postinst_${PN}() {
     if [ -z "$D" ]; then
 	if type systemd-tmpfiles >/dev/null; then
Signature · 1 line
1.7.9.5