- Name: pure-ftpd
- Version: 1.0.36
- Release: 1%{?dist}
- Summary: Pure-FTPd
- Group: System Environment/Daemons
- License: BSD
- URL: http://www.pureftpd.org
- Source0: ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.tar.bz2
- Source1: http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz
- BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
- Vendor: itnihao@qq.com
- BuildRequires: gcc
- Requires: shadow-utils
- %description
- Pure-FTPd is a free (BSD), secure, production-quality and standard-conformant FTP server. It doesn't provide useless bells and whistles, but focuses on efficiency and ease of use. It provides simple answers to common needs, plus unique useful features for personal users as well as hosting providers.
- %prep
- %setup -q
- %build
- ./configure --prefix=/usr/local/pureftpd \
- --with-mysql \
- --with-pam \
- --with-shadow \
- --with-welcomemsg \
- --with-uploadscript \
- --with-cookie \
- --with-virtualchroot \
- --with-virtualhosts \
- --with-diraliases \
- --with-quotas \
- --with-puredb \
- --with-sysquotas \
- --with-ratios \
- --with-ftpwho \
- --with-throttling \
- --with-language=simplified-chinese
- make %{?_smp_mflags}
- %install
- rm -rf %{buildroot}
- make install DESTDIR=%{buildroot}
- %{__install} -d %{buildroot}%{_sysconfdir}/pureftpd
- %{__install} -d %{_datadir}
- %{__install} -d %{buildroot}%{_initrddir}
- #%{__install} -d %{buildroot}%{_sbindir}
- %{__install} -d %{buildroot}%{_mandir}/man8/
- %{__install} -m 755 configuration-file/pure-config.pl %{buildroot}/usr/local/pureftpd/sbin/pure-config.pl
- %{__install} -m 755 configuration-file/pure-ftpd.conf %{buildroot}%{_sysconfdir}/default.pure-ftpd.conf
- %{__install} -m 755 configuration-file/pure-ftpd.conf %{buildroot}%{_sysconfdir}/pure-ftpd.conf
- %{__install} -m 755 pureftpd-mysql.conf %{buildroot}%{_sysconfdir}/default.pureftpd-mysql.conf
- cat >> %{buildroot}%{_sysconfdir}/pureftpd/pureftpd-mysql.conf << EOF
- MYSQLSocket /var/lib/mysql/mysql.sock
- MYSQLServer 127.0.0.1
- MYSQLPort 3306
- MYSQLUser pureftpuser
- MYSQLPassword pureftpuser
- MYSQLDatabase pureftp
- MYSQLCrypt md5
- MYSQLGetPW SELECT Password FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
- MYSQLGetUID SELECT Uid FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
- MYSQLGetGID SELECT Gid FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
- MYSQLGetDir SELECT Dir FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
- MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
- MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
- EOF
- %{__install} -m 755 contrib/redhat.init %{buildroot}%{_initrddir}/pureftpd
- sed -i\
- -e "s|usr/local|usr/local/pureftpd|g" \
- -e "s|etc/pure-ftpd.conf|etc/pureftpd/pure-ftpd.conf|g" \
- %{buildroot}%{_initrddir}/pureftpd
- sed -i \
- -e "s|NoAnonymous no|NoAnonymous yes|g" \
- -e "s|# MySQLConfigFile /etc/pureftpd-mysql.conf|MySQLConfigFile /etc/pureftpd/pureftpd-mysql.conf|g" \
- -e "s|# Bind 127.0.0.1,21| Bind 127.0.0.1,21|g" \
- -e "s|AllowUserFXP no|AllowUserFXP yes|g" \
- -e "s|AnonymousCantUpload no|AnonymousCantUpload yes|g" \
- -e "s|#CreateHomeDir yes|CreateHomeDir yes|g" \
- %{buildroot}%{_sysconfdir}/pure-ftpd.conf
- #cp conf/pureftpd-mysql.conf %{buildroot}%{_sysconfdir}/pureftpd
- #cp conf/pure-ftpd.conf %{buildroot}%{_sysconfdir}/pureftpd
- install -m 0644 -p man/pure-authd.8 $RPM_BUILD_ROOT%{_mandir}/man8/pure-authd.8
- install -m 0644 -p man/pure-ftpd.8 $RPM_BUILD_ROOT%{_mandir}/man8/pure-ftpd.8
- install -m 0644 -p man/pure-ftpwho.8 $RPM_BUILD_ROOT%{_mandir}/man8/pure-ftpwho.8
- install -m 0644 -p man/pure-mrtginfo.8 $RPM_BUILD_ROOT%{_mandir}/man8/pure-mrtginfo.8
- install -m 0644 -p man/pure-pw.8 $RPM_BUILD_ROOT%{_mandir}/man8/pure-pw.8
- install -m 0644 -p man/pure-pwconvert.8 $RPM_BUILD_ROOT%{_mandir}/man8/pure-pwconvert.8
- install -m 0644 -p man/pure-quotacheck.8 $RPM_BUILD_ROOT%{_mandir}/man8/pure-quotacheck.8
- install -m 0644 -p man/pure-statsdecode.8 $RPM_BUILD_ROOT%{_mandir}/man8/pure-statsdecode.8
- install -m 0644 -p man/pure-uploadscript.8 $RPM_BUILD_ROOT%{_mandir}/man8/pure-uploadscript.8
- %{__tar} xf %{SOURCE1} -C $RPM_BUILD_ROOT/%{_datadir}
- %clean
- rm -rf %{buildroot}
- %files
- %defattr(-,root,root,-)
- %doc
- /usr/local/pureftpd/bin/pure-pw
- /usr/local/pureftpd/bin/pure-pwconvert
- /usr/local/pureftpd/bin/pure-statsdecode
- /usr/local/pureftpd/sbin/pure-authd
- /usr/local/pureftpd/sbin/pure-config.pl
- /usr/local/pureftpd/sbin/pure-ftpd
- /usr/local/pureftpd/sbin/pure-ftpwho
- /usr/local/pureftpd/sbin/pure-mrtginfo
- /usr/local/pureftpd/sbin/pure-quotacheck
- /usr/local/pureftpd/sbin/pure-uploadscript
- %{_initrddir}/pureftpd
- %{_sysconfdir}/pureftpd/*
- %{_mandir}/man8/pure*
- %{_datadir}/ftp
- %post
- getent group pureftpuser >/dev/null || groupadd -r pureftpuser
- getent passwd pureftpuser >/dev/null || useradd -r -g pureftpuser -s /sbin/nologin -c "pureftp user" pureftpuser
- sed -i \
- -e "s|DBLogin = "ftp";|DBLogin = "pureftpuser";|g" \
- -e "s|DBPassword = "tmppasswd";|DBPassword = "pureftpuser";|g" \
- -e "s|FTPAddress = "myipaddress.com:21";|FTPAddress = "127.0.0.1:21";|g" \
- -e "s|DBDatabase = "ftpusers"|DBDatabase = "pureftp"|g" \
- -e "s|DEFUserID = "65534"|DEFUserID = "$ftpuid"|g" \
- -e "s|DEFGroupID = "31"|DEFGroupID = "$ftpgid"|g" /usr/share/ftp/config.php
- /sbin/chkconfig pureftpd on
- cat <<EOF
- create pureftp database like this:
- ====================================================================================
- mysql>create database pureftp;
- mysql>grant all on pureftp.* to pureftpuser@'127.0.0.1' identified by 'pureftpuser';
- mysql>grant privileges;
- ====================================================================================
- if you want to use pdb to store password :
- you should change /etc/pureftpd/pure-ftpd.conf
- sed -i "s|MySQLConfigFile /etc/pureftpd-mysql.conf|# MySQLConfigFile /etc/pureftpd/pureftpd-mysql.conf|g" /etc/pureftpd/pure-ftpd.conf
- sed -i "s|# PureDB /etc/pureftpd.pdb|PureDB /etc/pureftpd/pureftpd.pdb|g" /etc/pureftpd/pure-ftpd.conf
- #adduser
- /usr/local/pureftpd/bin/pure-pw useradd virtualftp -f /usr/local/pureftpd/etc/pureftpd.passwd -u 500 -g 500 -d /ftproot
- #make it into effect
- /usr/local/pureftpd/bin/pure-pw mkdb /usr/local/pureftpd/etc/pureftpd.pdb -f /usr/local/pureftpd/etc/pureftpd.passwd
- #modify user password
- /usr/local/pureftpd/bin/pure-pw passwd virtualftp -f /usr/local/pureftpd/etc/pureftpd.passwd -m
- EOF
- %changelog
本文转自it你好 51CTO博客,原文链接:http://blog.51cto.com/itnihao/1148570,如需转载请自行联系原作者