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