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