blob: 08238c1a3c935ff8dae0b588a7e5bac7069a6949 [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 \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050021 ${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://vsftpd-tcp_wrappers-support.patch', '', d)} \
22 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '', '${NOPAM_SRC}', d)} \
23 file://0001-sysdeputil.c-Fix-with-musl-which-does-not-have-utmpx.patch \
24 "
Patrick Williamsb48b7b42016-08-17 15:04:38 -050025
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080026UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/v/vsftpd/"
27UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.orig\.tar"
28
Patrick Williamsb48b7b42016-08-17 15:04:38 -050029LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271 \
30 file://COPYRIGHT;md5=04251b2eb0f298dae376d92454f6f72e \
31 file://LICENSE;md5=654df2042d44b8cac8a5654fc5be63eb"
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050032SRC_URI[sha256sum] = "26b602ae454b0ba6d99ef44a09b6b9e0dfa7f67228106736df1f278c70bc91d3"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050033
34
35PACKAGECONFIG ??= "tcp-wrappers"
36PACKAGECONFIG[tcp-wrappers] = ",,tcp-wrappers"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050037
Patrick Williamsddad1a12017-02-23 20:36:32 -060038DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
Patrick Williams213cb262021-08-07 19:21:33 -050039RDEPENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-listfile', '', d)}"
Patrick Williamsddad1a12017-02-23 20:36:32 -060040PAMLIB = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '-L${STAGING_BASELIBDIR} -lpam', '', d)}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041WRAPLIB = "${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', '-lwrap', '', d)}"
Patrick Williamsddad1a12017-02-23 20:36:32 -060042NOPAM_SRC ="${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://nopam-with-tcp_wrappers.patch', 'file://nopam.patch', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050043
44inherit update-rc.d useradd systemd
45
Patrick Williams213cb262021-08-07 19:21:33 -050046CONFFILES:${PN} = "${sysconfdir}/vsftpd.conf"
47LDFLAGS:append =" -lcrypt -lcap"
48CFLAGS:append:libc-musl = " -D_GNU_SOURCE -include fcntl.h"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050049EXTRA_OEMAKE = "-e MAKEFLAGS="
50
51do_configure() {
52 # Fix hardcoded /usr, /etc, /var mess.
53 cat tunables.c|sed s:\"/usr:\"${prefix}:g|sed s:\"/var:\"${localstatedir}:g \
54 |sed s:\"/etc:\"${sysconfdir}:g > tunables.c.new
55 mv tunables.c.new tunables.c
56}
57
58do_compile() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050059 oe_runmake "LIBS=-L${STAGING_LIBDIR} -lcrypt -lcap ${PAMLIB} ${WRAPLIB}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050060}
61
62do_install() {
63 install -d ${D}${sbindir}
64 install -d ${D}${mandir}/man8
65 install -d ${D}${mandir}/man5
66 oe_runmake 'DESTDIR=${D}' install
67 install -d ${D}${sysconfdir}
68 install -m 600 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}/vsftpd.conf
69 install -d ${D}${sysconfdir}/init.d/
70 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/vsftpd
71 install -d ${D}/${sysconfdir}/default/volatiles
72 install -m 644 ${WORKDIR}/volatiles.99_vsftpd ${D}/${sysconfdir}/default/volatiles/99_vsftpd
73
74 install -m 600 ${WORKDIR}/vsftpd.ftpusers ${D}${sysconfdir}/
75 install -m 600 ${WORKDIR}/vsftpd.user_list ${D}${sysconfdir}/
76 if ! test -z "${PAMLIB}" ; then
77 install -d ${D}${sysconfdir}/pam.d/
78 cp ${S}/RedHat/vsftpd.pam ${D}${sysconfdir}/pam.d/vsftpd
79 sed -i "s:/lib/security:${base_libdir}/security:" ${D}${sysconfdir}/pam.d/vsftpd
80 sed -i "s:ftpusers:vsftpd.ftpusers:" ${D}${sysconfdir}/pam.d/vsftpd
81 fi
Patrick Williamsddad1a12017-02-23 20:36:32 -060082 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050083 install -d ${D}${sysconfdir}/tmpfiles.d
84 echo "d /var/run/vsftpd/empty 0755 root root -" \
85 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
86 fi
87
88 # Install systemd unit files
89 install -d ${D}${systemd_unitdir}/system
90 install -m 0644 ${WORKDIR}/vsftpd.service ${D}${systemd_unitdir}/system
91 sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/vsftpd.service
92}
93
94INITSCRIPT_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -050095INITSCRIPT_NAME:${PN} = "vsftpd"
96INITSCRIPT_PARAMS:${PN} = "defaults 80"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050097
98USERADD_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -050099USERADD_PARAM:${PN} = "--system --home-dir /var/lib/ftp --no-create-home -g ftp \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500100 --shell /bin/false ftp "
Patrick Williams213cb262021-08-07 19:21:33 -0500101GROUPADD_PARAM:${PN} = "-r ftp"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500102
Patrick Williams213cb262021-08-07 19:21:33 -0500103SYSTEMD_SERVICE:${PN} = "vsftpd.service"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500104
Patrick Williams213cb262021-08-07 19:21:33 -0500105pkg_postinst:${PN}() {
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500106 if [ -z "$D" ]; then
Patrick Williamsddad1a12017-02-23 20:36:32 -0600107 if type systemd-tmpfiles >/dev/null; then
108 systemd-tmpfiles --create
109 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
110 ${sysconfdir}/init.d/populate-volatile.sh update
111 fi
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500112 fi
113}