Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 1 | SUMMARY = "Very Secure FTP server" |
| 2 | HOMEPAGE = "https://security.appspot.com/vsftpd.html" |
| 3 | SECTION = "net" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 4 | LICENSE = "GPL-2.0-only" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271" |
| 6 | |
| 7 | DEPENDS = "libcap openssl" |
| 8 | |
| 9 | SRC_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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 21 | ${@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 Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 25 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 26 | UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/v/vsftpd/" |
| 27 | UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.orig\.tar" |
| 28 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 29 | LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271 \ |
| 30 | file://COPYRIGHT;md5=04251b2eb0f298dae376d92454f6f72e \ |
| 31 | file://LICENSE;md5=654df2042d44b8cac8a5654fc5be63eb" |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 32 | SRC_URI[sha256sum] = "26b602ae454b0ba6d99ef44a09b6b9e0dfa7f67228106736df1f278c70bc91d3" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 33 | |
| 34 | |
| 35 | PACKAGECONFIG ??= "tcp-wrappers" |
| 36 | PACKAGECONFIG[tcp-wrappers] = ",,tcp-wrappers" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 37 | |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 38 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 39 | RDEPENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-listfile', '', d)}" |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 40 | PAMLIB = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '-L${STAGING_BASELIBDIR} -lpam', '', d)}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 41 | WRAPLIB = "${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', '-lwrap', '', d)}" |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 42 | NOPAM_SRC ="${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://nopam-with-tcp_wrappers.patch', 'file://nopam.patch', d)}" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 43 | |
| 44 | inherit update-rc.d useradd systemd |
| 45 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 46 | CONFFILES:${PN} = "${sysconfdir}/vsftpd.conf" |
| 47 | LDFLAGS:append =" -lcrypt -lcap" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 48 | CFLAGS:append:libc-musl = " -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -include fcntl.h" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 49 | EXTRA_OEMAKE = "-e MAKEFLAGS=" |
| 50 | |
| 51 | do_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 | |
| 58 | do_compile() { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 59 | oe_runmake "LIBS=-L${STAGING_LIBDIR} -lcrypt -lcap ${PAMLIB} ${WRAPLIB}" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | do_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 Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 82 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 83 | 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 | |
| 94 | INITSCRIPT_PACKAGES = "${PN}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 95 | INITSCRIPT_NAME:${PN} = "vsftpd" |
| 96 | INITSCRIPT_PARAMS:${PN} = "defaults 80" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 97 | |
| 98 | USERADD_PACKAGES = "${PN}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 99 | USERADD_PARAM:${PN} = "--system --home-dir /var/lib/ftp --no-create-home -g ftp \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 100 | --shell /bin/false ftp " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 101 | GROUPADD_PARAM:${PN} = "-r ftp" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 102 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 103 | SYSTEMD_SERVICE:${PN} = "vsftpd.service" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 104 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 105 | pkg_postinst:${PN}() { |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 106 | if [ -z "$D" ]; then |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 107 | 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 Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 112 | fi |
| 113 | } |