19aee5003SAndrew GeisslerSUMMARY = "Secure and configurable FTP server"
29aee5003SAndrew GeisslerSECTION = "net"
39aee5003SAndrew GeisslerHOMEPAGE = "http://www.proftpd.org"
49aee5003SAndrew GeisslerLICENSE = "GPL-2.0-or-later"
59aee5003SAndrew GeisslerLIC_FILES_CHKSUM = "file://COPYING;md5=fb0d1484d11915fa88a6a7702f1dc184"
69aee5003SAndrew Geissler
79aee5003SAndrew GeisslerSRCREV = "75aa739805a6e05eeb31189934a3d324e7862962"
89aee5003SAndrew GeisslerBRANCH = "1.3.7"
99aee5003SAndrew Geissler
109aee5003SAndrew GeisslerSRC_URI = "git://github.com/proftpd/proftpd.git;branch=${BRANCH};protocol=https \
119aee5003SAndrew Geissler           file://basic.conf.patch \
129aee5003SAndrew Geissler           file://proftpd-basic.init \
139aee5003SAndrew Geissler           file://default \
149aee5003SAndrew Geissler           file://close-RequireValidShell-check.patch \
159aee5003SAndrew Geissler           file://contrib.patch  \
169aee5003SAndrew Geissler           file://build_fixup.patch \
179aee5003SAndrew Geissler           file://proftpd.service \
189aee5003SAndrew Geissler           "
199aee5003SAndrew Geissler
209aee5003SAndrew GeisslerS = "${WORKDIR}/git"
219aee5003SAndrew Geissler
229aee5003SAndrew Geisslerinherit autotools-brokensep useradd update-rc.d systemd multilib_script
239aee5003SAndrew Geissler
2492b42cb3SPatrick WilliamsEXTRA_OECONF += "--enable-largefile"
2592b42cb3SPatrick Williams
269aee5003SAndrew GeisslerPACKAGECONFIG ??= "shadow \
279aee5003SAndrew Geissler                   ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \
289aee5003SAndrew Geissler                   static \
299aee5003SAndrew Geissler                  "
309aee5003SAndrew Geissler
319aee5003SAndrew GeisslerPACKAGECONFIG[curses] = "--enable-curses --enable-ncurses, --disable-curses --disable-ncurses, ncurses"
329aee5003SAndrew GeisslerPACKAGECONFIG[openssl] = "--enable-openssl, --disable-openssl, openssl, openssl"
339aee5003SAndrew GeisslerPACKAGECONFIG[pam] = "--enable-auth-pam, --disable-auth-pam, libpam, libpam"
349aee5003SAndrew GeisslerPACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6"
359aee5003SAndrew GeisslerPACKAGECONFIG[shadow] = "--enable-shadow, --disable-shadow"
369aee5003SAndrew GeisslerPACKAGECONFIG[pcre] = "--enable-pcre, --disable-pcre, libpcre "
379aee5003SAndrew GeisslerPACKAGECONFIG[static] = "--enable-static=yes, --enable-static=no"
389aee5003SAndrew Geissler
399aee5003SAndrew Geissler# enable POSIX.1e capabilities
409aee5003SAndrew GeisslerPACKAGECONFIG[cap] = "--enable-cap, --disable-cap, libcap, libcap"
419aee5003SAndrew Geissler
429aee5003SAndrew Geissler#enable support for POSIX ACLs
439aee5003SAndrew GeisslerPACKAGECONFIG[acl] = "--enable-facl, --disable-facl"
449aee5003SAndrew Geissler
459aee5003SAndrew Geissler#enable proftpd controls via ftpdct
469aee5003SAndrew GeisslerPACKAGECONFIG[ctrls] = "--enable-ctrls, --disable-crtls"
479aee5003SAndrew Geissler
489aee5003SAndrew Geissler#prevent proftpd from using its bundled getopt implementation.
499aee5003SAndrew GeisslerPACKAGECONFIG[getopt] = "--with-getopt, --without-getopt"
509aee5003SAndrew Geissler
519aee5003SAndrew Geissler#do not strip debugging symbols from installed code
529aee5003SAndrew GeisslerPACKAGECONFIG[strip] = "--enable-strip, --disable-strip"
539aee5003SAndrew Geissler
549aee5003SAndrew Geissler#enable SIA authentication support (Tru64)
559aee5003SAndrew GeisslerPACKAGECONFIG[sia] = "--enable-sia, --disable-sia"
569aee5003SAndrew GeisslerPACKAGECONFIG[sendfile] = "-enable-sendfile, --disable-sendfile"
579aee5003SAndrew Geissler
589aee5003SAndrew Geissler#enable Native Language Support (NLS)
599aee5003SAndrew GeisslerPACKAGECONFIG[nls] = "--enable-nls, --disable-nls"
609aee5003SAndrew Geissler
619aee5003SAndrew Geissler#add mod_dso to core modules
629aee5003SAndrew GeisslerPACKAGECONFIG[dso] = "--enable-dso, --disable-dso"
639aee5003SAndrew Geissler
649aee5003SAndrew Geissler#omit mod_auth_file from core modules
659aee5003SAndrew GeisslerPACKAGECONFIG[auth] = "--enable-auth-file, --disable-auth-file"
669aee5003SAndrew Geissler
679aee5003SAndrew Geissler# proftpd uses libltdl which currently makes configuring using
689aee5003SAndrew Geissler# autotools.bbclass a pain...
699aee5003SAndrew Geisslerdo_configure () {
709aee5003SAndrew Geissler    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}
719aee5003SAndrew Geissler    install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}
729aee5003SAndrew Geissler    oe_runconf
739aee5003SAndrew Geissler}
749aee5003SAndrew Geissler
759aee5003SAndrew GeisslerFTPUSER = "ftp"
769aee5003SAndrew GeisslerFTPGROUP = "ftp"
779aee5003SAndrew Geissler
789aee5003SAndrew Geisslerdo_install () {
799aee5003SAndrew Geissler    oe_runmake DESTDIR=${D} install
809aee5003SAndrew Geissler    rmdir ${D}${libdir}/proftpd ${D}${datadir}/locale
819aee5003SAndrew Geissler    [ -d ${D}${libexecdir} ] && rmdir ${D}${libexecdir}
829aee5003SAndrew Geissler    sed -i '/ *User[ \t]*/s/ftp/${FTPUSER}/' ${D}${sysconfdir}/proftpd.conf
839aee5003SAndrew Geissler    sed -i '/ *Group[ \t]*/s/ftp/${FTPGROUP}/' ${D}${sysconfdir}/proftpd.conf
849aee5003SAndrew Geissler    install -d ${D}${sysconfdir}/init.d
85*edff4923SAndrew Geissler    install -m 0755 ${UNPACKDIR}/proftpd-basic.init ${D}${sysconfdir}/init.d/proftpd
869aee5003SAndrew Geissler    sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/proftpd
879aee5003SAndrew Geissler    sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/proftpd
889aee5003SAndrew Geissler    sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/proftpd
899aee5003SAndrew Geissler    sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/proftpd
909aee5003SAndrew Geissler
919aee5003SAndrew Geissler    install -d ${D}${sysconfdir}/default
92*edff4923SAndrew Geissler    install -m 0755 ${UNPACKDIR}/default ${D}${sysconfdir}/default/proftpd
939aee5003SAndrew Geissler
949aee5003SAndrew Geissler    # create the pub directory
959aee5003SAndrew Geissler    mkdir -p ${D}/home/${FTPUSER}/pub/
969aee5003SAndrew Geissler    chown -R ${FTPUSER}:${FTPGROUP} ${D}/home/${FTPUSER}/pub
979aee5003SAndrew Geissler    if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then
989aee5003SAndrew Geissler        # install proftpd pam configuration
999aee5003SAndrew Geissler        install -d ${D}${sysconfdir}/pam.d
1009aee5003SAndrew Geissler        install -m 644 ${S}/contrib/dist/rpm/ftp.pamd ${D}${sysconfdir}/pam.d/proftpd
1019aee5003SAndrew Geissler        sed -i '/ftpusers/d' ${D}${sysconfdir}/pam.d/proftpd
1029aee5003SAndrew Geissler        # specify the user Authentication config
1039aee5003SAndrew Geissler        sed -i '/^MaxInstances/a\AuthPAM                         on\nAuthPAMConfig                   proftpd' \
1049aee5003SAndrew Geissler            ${D}${sysconfdir}/proftpd.conf
1059aee5003SAndrew Geissler    fi
1069aee5003SAndrew Geissler
1079aee5003SAndrew Geissler    install -d ${D}/${systemd_unitdir}/system
108*edff4923SAndrew Geissler    install -m 644 ${UNPACKDIR}/proftpd.service ${D}/${systemd_unitdir}/system
1099aee5003SAndrew Geissler    sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \
1109aee5003SAndrew Geissler        -e 's,@SYSCONFDIR@,${sysconfdir},g' \
1119aee5003SAndrew Geissler        -e 's,@SBINDIR@,${sbindir},g' \
1129aee5003SAndrew Geissler        -i ${D}${systemd_unitdir}/system/*.service
1139aee5003SAndrew Geissler
1149aee5003SAndrew Geissler    sed -e 's|--sysroot=${STAGING_DIR_HOST}||g' \
1159aee5003SAndrew Geissler        -e 's|${STAGING_DIR_NATIVE}||g' \
1169aee5003SAndrew Geissler        -e 's|-ffile-prefix-map=[^ ]*||g' \
1179aee5003SAndrew Geissler        -e 's|-fdebug-prefix-map=[^ ]*||g' \
1189aee5003SAndrew Geissler        -e 's|-fmacro-prefix-map=[^ ]*||g' \
1199aee5003SAndrew Geissler        -i ${D}/${bindir}/prxs
1209aee5003SAndrew Geissler
1219aee5003SAndrew Geissler    # ftpmail perl script, which reads the proftpd log file and sends
1229aee5003SAndrew Geissler    # automatic email notifications once an upload finishs,
1239aee5003SAndrew Geissler    # depends on an old perl Mail::Sendmail
1249aee5003SAndrew Geissler    # The Mail::Sendmail has not been maintained for almost 10 years
1259aee5003SAndrew Geissler    # Other distribution not ship with ftpmail, so do the same to
1269aee5003SAndrew Geissler    # avoid confusion about having it fails to run
1279aee5003SAndrew Geissler    rm -rf ${D}${bindir}/ftpmail
1289aee5003SAndrew Geissler    rm -rf ${D}${mandir}/man1/ftpmail.1
1299aee5003SAndrew Geissler}
1309aee5003SAndrew Geissler
1319aee5003SAndrew GeisslerINITSCRIPT_NAME = "proftpd"
1329aee5003SAndrew GeisslerINITSCRIPT_PARAM = "defaults 85 15"
1339aee5003SAndrew Geissler
1349aee5003SAndrew GeisslerSYSTEMD_PACKAGES = "${PN}"
1359aee5003SAndrew GeisslerSYSTEMD_SERVICE:${PN} = "proftpd.service"
1369aee5003SAndrew Geissler
1379aee5003SAndrew GeisslerUSERADD_PACKAGES = "${PN}"
1389aee5003SAndrew GeisslerGROUPADD_PARAM:${PN} = "--system ${FTPGROUP}"
1399aee5003SAndrew GeisslerUSERADD_PARAM:${PN} = "--system -g ${FTPGROUP} --home-dir /var/lib/${FTPUSER} --no-create-home \
1409aee5003SAndrew Geissler                       --shell /bin/false ${FTPUSER}"
1419aee5003SAndrew Geissler
1429aee5003SAndrew GeisslerMULTILIB_SCRIPTS = "${PN}:${bindir}/prxs"
1439aee5003SAndrew Geissler
1449aee5003SAndrew GeisslerFILES:${PN} += "/home/${FTPUSER}"
1459aee5003SAndrew Geissler
1469aee5003SAndrew GeisslerRDEPENDS:${PN} += "perl"
147