blob: 3eaaa30b6210955f7d0bbd4b1951f6551e36284a [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "Very Secure FTP server"
2HOMEPAGE = "https://security.appspot.com/vsftpd.html"
3SECTION = "net"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271"
6
7DEPENDS = "libcap openssl"
8
9SRC_URI = "https://security.appspot.com/downloads/vsftpd-${PV}.tar.gz \
10 file://makefile-destdir.patch \
11 file://makefile-libs.patch \
12 file://makefile-strip.patch \
13 file://init \
14 file://vsftpd.conf \
15 file://vsftpd.user_list \
16 file://vsftpd.ftpusers \
17 file://change-secure_chroot_dir.patch \
18 file://volatiles.99_vsftpd \
19 file://vsftpd.service \
20 file://vsftpd-2.1.0-filter.patch \
Patrick Williamsddad1a12017-02-23 20:36:32 -060021 file://0001-vsftpd-allow-sysinfo-in-the-seccomp-sandbox.patch \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050022"
23
24LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271 \
25 file://COPYRIGHT;md5=04251b2eb0f298dae376d92454f6f72e \
26 file://LICENSE;md5=654df2042d44b8cac8a5654fc5be63eb"
27SRC_URI[md5sum] = "da119d084bd3f98664636ea05b5bb398"
28SRC_URI[sha256sum] = "9d4d2bf6e6e2884852ba4e69e157a2cecd68c5a7635d66a3a8cf8d898c955ef7"
29
30
31PACKAGECONFIG ??= "tcp-wrappers"
32PACKAGECONFIG[tcp-wrappers] = ",,tcp-wrappers"
Patrick Williamsddad1a12017-02-23 20:36:32 -060033SRC_URI +="${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://vsftpd-tcp_wrappers-support.patch', '', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050034
Patrick Williamsddad1a12017-02-23 20:36:32 -060035DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
36RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-listfile', '', d)}"
37PAMLIB = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '-L${STAGING_BASELIBDIR} -lpam', '', d)}"
38NOPAM_SRC ="${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://nopam-with-tcp_wrappers.patch', 'file://nopam.patch', d)}"
39SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '', '${NOPAM_SRC}', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050040
41inherit update-rc.d useradd systemd
42
43CONFFILES_${PN} = "${sysconfdir}/vsftpd.conf"
44LDFLAGS_append =" -lcrypt -lcap"
45
46EXTRA_OEMAKE = "-e MAKEFLAGS="
47
48do_configure() {
49 # Fix hardcoded /usr, /etc, /var mess.
50 cat tunables.c|sed s:\"/usr:\"${prefix}:g|sed s:\"/var:\"${localstatedir}:g \
51 |sed s:\"/etc:\"${sysconfdir}:g > tunables.c.new
52 mv tunables.c.new tunables.c
53}
54
55do_compile() {
56 oe_runmake "LIBS=-L${STAGING_LIBDIR} -lcrypt -lcap ${PAMLIB} -lwrap"
57}
58
59do_install() {
60 install -d ${D}${sbindir}
61 install -d ${D}${mandir}/man8
62 install -d ${D}${mandir}/man5
63 oe_runmake 'DESTDIR=${D}' install
64 install -d ${D}${sysconfdir}
65 install -m 600 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}/vsftpd.conf
66 install -d ${D}${sysconfdir}/init.d/
67 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/vsftpd
68 install -d ${D}/${sysconfdir}/default/volatiles
69 install -m 644 ${WORKDIR}/volatiles.99_vsftpd ${D}/${sysconfdir}/default/volatiles/99_vsftpd
70
71 install -m 600 ${WORKDIR}/vsftpd.ftpusers ${D}${sysconfdir}/
72 install -m 600 ${WORKDIR}/vsftpd.user_list ${D}${sysconfdir}/
73 if ! test -z "${PAMLIB}" ; then
74 install -d ${D}${sysconfdir}/pam.d/
75 cp ${S}/RedHat/vsftpd.pam ${D}${sysconfdir}/pam.d/vsftpd
76 sed -i "s:/lib/security:${base_libdir}/security:" ${D}${sysconfdir}/pam.d/vsftpd
77 sed -i "s:ftpusers:vsftpd.ftpusers:" ${D}${sysconfdir}/pam.d/vsftpd
78 fi
Patrick Williamsddad1a12017-02-23 20:36:32 -060079 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050080 install -d ${D}${sysconfdir}/tmpfiles.d
81 echo "d /var/run/vsftpd/empty 0755 root root -" \
82 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
83 fi
84
85 # Install systemd unit files
86 install -d ${D}${systemd_unitdir}/system
87 install -m 0644 ${WORKDIR}/vsftpd.service ${D}${systemd_unitdir}/system
88 sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/vsftpd.service
89}
90
91INITSCRIPT_PACKAGES = "${PN}"
92INITSCRIPT_NAME_${PN} = "vsftpd"
93INITSCRIPT_PARAMS_${PN} = "defaults 80"
94
95USERADD_PACKAGES = "${PN}"
96USERADD_PARAM_${PN} = "--system --home-dir /var/lib/ftp --no-create-home -g ftp \
97 --shell /bin/false ftp "
98GROUPADD_PARAM_${PN} = "-r ftp"
99
100SYSTEMD_SERVICE_${PN} = "vsftpd.service"
101
102pkg_postinst_${PN}() {
103 if [ -z "$D" ]; then
Patrick Williamsddad1a12017-02-23 20:36:32 -0600104 if type systemd-tmpfiles >/dev/null; then
105 systemd-tmpfiles --create
106 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
107 ${sysconfdir}/init.d/populate-volatile.sh update
108 fi
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500109 fi
110}