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