Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 1 | SUMMARY = "Secure and configurable FTP server" |
| 2 | SECTION = "net" |
| 3 | HOMEPAGE = "http://www.proftpd.org" |
| 4 | LICENSE = "GPL-2.0-or-later" |
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=fb0d1484d11915fa88a6a7702f1dc184" |
| 6 | |
| 7 | SRCREV = "75aa739805a6e05eeb31189934a3d324e7862962" |
| 8 | BRANCH = "1.3.7" |
| 9 | |
| 10 | SRC_URI = "git://github.com/proftpd/proftpd.git;branch=${BRANCH};protocol=https \ |
| 11 | file://basic.conf.patch \ |
| 12 | file://proftpd-basic.init \ |
| 13 | file://default \ |
| 14 | file://close-RequireValidShell-check.patch \ |
| 15 | file://contrib.patch \ |
| 16 | file://build_fixup.patch \ |
| 17 | file://proftpd.service \ |
| 18 | " |
| 19 | |
| 20 | S = "${WORKDIR}/git" |
| 21 | |
| 22 | inherit autotools-brokensep useradd update-rc.d systemd multilib_script |
| 23 | |
| 24 | PACKAGECONFIG ??= "shadow \ |
| 25 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \ |
| 26 | static \ |
| 27 | " |
| 28 | |
| 29 | PACKAGECONFIG[curses] = "--enable-curses --enable-ncurses, --disable-curses --disable-ncurses, ncurses" |
| 30 | PACKAGECONFIG[openssl] = "--enable-openssl, --disable-openssl, openssl, openssl" |
| 31 | PACKAGECONFIG[pam] = "--enable-auth-pam, --disable-auth-pam, libpam, libpam" |
| 32 | PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6" |
| 33 | PACKAGECONFIG[shadow] = "--enable-shadow, --disable-shadow" |
| 34 | PACKAGECONFIG[pcre] = "--enable-pcre, --disable-pcre, libpcre " |
| 35 | PACKAGECONFIG[static] = "--enable-static=yes, --enable-static=no" |
| 36 | |
| 37 | # enable POSIX.1e capabilities |
| 38 | PACKAGECONFIG[cap] = "--enable-cap, --disable-cap, libcap, libcap" |
| 39 | |
| 40 | #enable support for POSIX ACLs |
| 41 | PACKAGECONFIG[acl] = "--enable-facl, --disable-facl" |
| 42 | |
| 43 | #enable proftpd controls via ftpdct |
| 44 | PACKAGECONFIG[ctrls] = "--enable-ctrls, --disable-crtls" |
| 45 | |
| 46 | #prevent proftpd from using its bundled getopt implementation. |
| 47 | PACKAGECONFIG[getopt] = "--with-getopt, --without-getopt" |
| 48 | |
| 49 | #do not strip debugging symbols from installed code |
| 50 | PACKAGECONFIG[strip] = "--enable-strip, --disable-strip" |
| 51 | |
| 52 | #enable SIA authentication support (Tru64) |
| 53 | PACKAGECONFIG[sia] = "--enable-sia, --disable-sia" |
| 54 | PACKAGECONFIG[sendfile] = "-enable-sendfile, --disable-sendfile" |
| 55 | |
| 56 | #enable Native Language Support (NLS) |
| 57 | PACKAGECONFIG[nls] = "--enable-nls, --disable-nls" |
| 58 | |
| 59 | #add mod_dso to core modules |
| 60 | PACKAGECONFIG[dso] = "--enable-dso, --disable-dso" |
| 61 | PACKAGECONFIG[largefile] = "--enable-largefile, --disable-largefile" |
| 62 | |
| 63 | #omit mod_auth_file from core modules |
| 64 | PACKAGECONFIG[auth] = "--enable-auth-file, --disable-auth-file" |
| 65 | |
| 66 | # proftpd uses libltdl which currently makes configuring using |
| 67 | # autotools.bbclass a pain... |
| 68 | do_configure () { |
| 69 | install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S} |
| 70 | install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S} |
| 71 | oe_runconf |
| 72 | } |
| 73 | |
| 74 | FTPUSER = "ftp" |
| 75 | FTPGROUP = "ftp" |
| 76 | |
| 77 | do_install () { |
| 78 | oe_runmake DESTDIR=${D} install |
| 79 | rmdir ${D}${libdir}/proftpd ${D}${datadir}/locale |
| 80 | [ -d ${D}${libexecdir} ] && rmdir ${D}${libexecdir} |
| 81 | sed -i '/ *User[ \t]*/s/ftp/${FTPUSER}/' ${D}${sysconfdir}/proftpd.conf |
| 82 | sed -i '/ *Group[ \t]*/s/ftp/${FTPGROUP}/' ${D}${sysconfdir}/proftpd.conf |
| 83 | install -d ${D}${sysconfdir}/init.d |
| 84 | install -m 0755 ${WORKDIR}/proftpd-basic.init ${D}${sysconfdir}/init.d/proftpd |
| 85 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/proftpd |
| 86 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/proftpd |
| 87 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/proftpd |
| 88 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/proftpd |
| 89 | |
| 90 | install -d ${D}${sysconfdir}/default |
| 91 | install -m 0755 ${WORKDIR}/default ${D}${sysconfdir}/default/proftpd |
| 92 | |
| 93 | # create the pub directory |
| 94 | mkdir -p ${D}/home/${FTPUSER}/pub/ |
| 95 | chown -R ${FTPUSER}:${FTPGROUP} ${D}/home/${FTPUSER}/pub |
| 96 | if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then |
| 97 | # install proftpd pam configuration |
| 98 | install -d ${D}${sysconfdir}/pam.d |
| 99 | install -m 644 ${S}/contrib/dist/rpm/ftp.pamd ${D}${sysconfdir}/pam.d/proftpd |
| 100 | sed -i '/ftpusers/d' ${D}${sysconfdir}/pam.d/proftpd |
| 101 | # specify the user Authentication config |
| 102 | sed -i '/^MaxInstances/a\AuthPAM on\nAuthPAMConfig proftpd' \ |
| 103 | ${D}${sysconfdir}/proftpd.conf |
| 104 | fi |
| 105 | |
| 106 | install -d ${D}/${systemd_unitdir}/system |
| 107 | install -m 644 ${WORKDIR}/proftpd.service ${D}/${systemd_unitdir}/system |
| 108 | sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \ |
| 109 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ |
| 110 | -e 's,@SBINDIR@,${sbindir},g' \ |
| 111 | -i ${D}${systemd_unitdir}/system/*.service |
| 112 | |
| 113 | sed -e 's|--sysroot=${STAGING_DIR_HOST}||g' \ |
| 114 | -e 's|${STAGING_DIR_NATIVE}||g' \ |
| 115 | -e 's|-ffile-prefix-map=[^ ]*||g' \ |
| 116 | -e 's|-fdebug-prefix-map=[^ ]*||g' \ |
| 117 | -e 's|-fmacro-prefix-map=[^ ]*||g' \ |
| 118 | -i ${D}/${bindir}/prxs |
| 119 | |
| 120 | # ftpmail perl script, which reads the proftpd log file and sends |
| 121 | # automatic email notifications once an upload finishs, |
| 122 | # depends on an old perl Mail::Sendmail |
| 123 | # The Mail::Sendmail has not been maintained for almost 10 years |
| 124 | # Other distribution not ship with ftpmail, so do the same to |
| 125 | # avoid confusion about having it fails to run |
| 126 | rm -rf ${D}${bindir}/ftpmail |
| 127 | rm -rf ${D}${mandir}/man1/ftpmail.1 |
| 128 | } |
| 129 | |
| 130 | INITSCRIPT_NAME = "proftpd" |
| 131 | INITSCRIPT_PARAM = "defaults 85 15" |
| 132 | |
| 133 | SYSTEMD_PACKAGES = "${PN}" |
| 134 | SYSTEMD_SERVICE:${PN} = "proftpd.service" |
| 135 | |
| 136 | USERADD_PACKAGES = "${PN}" |
| 137 | GROUPADD_PARAM:${PN} = "--system ${FTPGROUP}" |
| 138 | USERADD_PARAM:${PN} = "--system -g ${FTPGROUP} --home-dir /var/lib/${FTPUSER} --no-create-home \ |
| 139 | --shell /bin/false ${FTPUSER}" |
| 140 | |
| 141 | MULTILIB_SCRIPTS = "${PN}:${bindir}/prxs" |
| 142 | |
| 143 | FILES:${PN} += "/home/${FTPUSER}" |
| 144 | |
| 145 | RDEPENDS:${PN} += "perl" |