1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
#!/usr/bin/make -f
# adapted from sample debian/rules that uses debhelper,
# GNU copyright 1997 to 1999 by Joey Hess.
# Copyright 2002-2016 by Stefan Hornburg (Racke) <racke@linuxia.de>
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
cfgflags=--sysconfdir=/etc/pure-ftpd CFLAGS="-O2 -DMAX_USER_LENGTH=128U -g"
optflags=--with-everything --with-largefile --with-pam --with-privsep --with-tls --with-rfc2640
bin=pure-pw pure-statsdecode pure-pwconvert
sbin=pure-authd pure-certd pure-ftpwho pure-uploadscript pure-quotacheck pure-ftpd pure-mrtginfo
FLAVOURS=pure-ftpd pure-ftpd-ldap pure-ftpd-mysql pure-ftpd-postgresql
src/vanilla/pure-ftpd:
dh_testdir
[ ! -f Makefile ] || $(MAKE) distclean
dh_auto_configure -- $(cfgflags) $(optflags)
$(MAKE)
mkdir $(@D)
mv $(addprefix src/, $(bin) $(sbin)) $(@D)
src/ldap/pure-ftpd:
dh_testdir
[ ! -f Makefile ] || $(MAKE) distclean
dh_auto_configure -- $(cfgflags) $(optflags) --with-ldap
$(MAKE)
mkdir $(@D)
mv $(addprefix src/, $(bin) $(sbin)) $(@D)
src/mysql/pure-ftpd:
dh_testdir
[ ! -f Makefile ] || $(MAKE) distclean
dh_auto_configure -- $(cfgflags) $(optflags) --with-mysql
$(MAKE)
mkdir $(@D)
mv $(addprefix src/, $(bin) $(sbin)) $(@D)
src/postgresql/pure-ftpd:
dh_testdir
[ ! -f Makefile ] || $(MAKE) distclean
dh_auto_configure -- $(cfgflags) $(optflags) --with-pgsql
$(MAKE)
mkdir $(@D)
mv $(addprefix src/, $(bin) $(sbin)) $(@D)
src/vanilla-virtualchroot/pure-ftpd:
dh_testdir
[ ! -f Makefile ] || $(MAKE) distclean
dh_auto_configure -- $(cfgflags) $(optflags) --with-virtualchroot
$(MAKE)
mkdir $(@D)
mv $(addprefix src/, $(bin) $(sbin)) $(@D)
src/ldap-virtualchroot/pure-ftpd:
dh_testdir
[ ! -f Makefile ] || $(MAKE) distclean
dh_auto_configure -- $(cfgflags) $(optflags) --with-virtualchroot --with-ldap
$(MAKE)
mkdir $(@D)
mv $(addprefix src/, $(bin) $(sbin)) $(@D)
src/mysql-virtualchroot/pure-ftpd:
dh_testdir
[ ! -f Makefile ] || $(MAKE) distclean
dh_auto_configure -- $(cfgflags) $(optflags) --with-virtualchroot --with-mysql
$(MAKE)
mkdir $(@D)
mv $(addprefix src/, $(bin) $(sbin)) $(@D)
src/postgresql-virtualchroot/pure-ftpd:
dh_testdir
[ ! -f Makefile ] || $(MAKE) distclean
dh_auto_configure -- $(cfgflags) $(optflags) --with-virtualchroot --with-pgsql
$(MAKE)
mkdir $(@D)
mv $(addprefix src/, $(bin) $(sbin)) $(@D)
build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: src/vanilla/pure-ftpd src/ldap/pure-ftpd src/mysql/pure-ftpd src/postgresql/pure-ftpd src/vanilla-virtualchroot/pure-ftpd src/ldap-virtualchroot/pure-ftpd src/mysql-virtualchroot/pure-ftpd src/postgresql-virtualchroot/pure-ftpd
dh_testdir
# create duplicates of the init script with unique provides
for suffix in -ldap -mysql -postgresql; do \
install -m 0644 -p debian/pure-ftpd.init.d debian/pure-ftpd$$suffix.init.d; \
sed -i -e "/Provides:/s/pure-ftpd/pure-ftpd$$suffix/" \
debian/pure-ftpd$$suffix.init.d; \
done
touch build-stamp
clean:
dh_testdir
dh_testroot
[ ! -f Makefile ] || $(MAKE) distclean
rm -f build-stamp configure-stamp config.status
rm -f debian/pure-ftpd-*.init.d
for package in $(FLAVOURS); do \
rm -f debian/$$package.post* debian/$$package.pre*; \
done
rm -rf src/.deps puredb/src/.deps src/vanilla src/ldap src/mysql src/postgresql src/vanilla-virtualchroot src/ldap-virtualchroot src/mysql-virtualchroot src/postgresql-virtualchroot
dh_clean
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs -ppure-ftpd-common etc/pam.d
dh_installdirs -A -Npure-ftpd-common usr/bin usr/sbin
# install docs and changelogs
dh_installdocs -ppure-ftpd-common --exclude=Windows --exclude=MacOS AUTHORS HISTORY THANKS README* pureftpd.schema
dh_installdocs -Npure-ftpd-common --exclude=Windows --exclude=MacOS
dh_installchangelogs -p pure-ftpd-common ChangeLog
# pam and init
install -p -m644 debian/pam debian/pure-ftpd-common/etc/pam.d/pure-ftpd
dh_installinit
# logrotate
dh_installlogrotate
# install into debian/pure-ftpd-common
# include binaries to make "make install" happy
cp src/vanilla/* src
$(MAKE) install DESTDIR=$(CURDIR)/debian/pure-ftpd-common #prefix=$(CURDIR)/debian/pure-ftpd-common/usr
# now remove binaries from package
rm -r $(CURDIR)/debian/pure-ftpd-common/usr/bin
rm $(CURDIR)/debian/pure-ftpd-common/usr/sbin/*
install -m 0644 debian/ftpallow $(CURDIR)/debian/pure-ftpd-common/etc/
for package in $(FLAVOURS); do \
install -m 0644 debian/ftpusers $(CURDIR)/debian/$$package/etc; \
done
install -m 0755 $(addprefix src/vanilla/, $(bin)) \
$(CURDIR)/debian/pure-ftpd/usr/bin
install -m 0755 $(addprefix src/vanilla/, $(sbin)) \
$(CURDIR)/debian/pure-ftpd/usr/sbin
install -m 0755 $(addprefix src/ldap/, $(bin)) \
$(CURDIR)/debian/pure-ftpd-ldap/usr/bin
install -m 0755 $(addprefix src/ldap/, $(sbin)) \
$(CURDIR)/debian/pure-ftpd-ldap/usr/sbin
install -m 0755 $(addprefix src/mysql/, $(bin)) \
$(CURDIR)/debian/pure-ftpd-mysql/usr/bin
install -m 0755 $(addprefix src/mysql/, $(sbin)) \
$(CURDIR)/debian/pure-ftpd-mysql/usr/sbin
install -m 0755 $(addprefix src/postgresql/, $(bin)) \
$(CURDIR)/debian/pure-ftpd-postgresql/usr/bin
install -m 0755 $(addprefix src/postgresql/, $(sbin)) \
$(CURDIR)/debian/pure-ftpd-postgresql/usr/sbin
(cd $(CURDIR)/debian/pure-ftpd-mysql/usr/sbin/; mv pure-ftpd pure-ftpd-mysql)
(cd $(CURDIR)/debian/pure-ftpd-postgresql/usr/sbin/; mv pure-ftpd pure-ftpd-postgresql)
(cd $(CURDIR)/debian/pure-ftpd-ldap/usr/sbin/; mv pure-ftpd pure-ftpd-ldap)
install -m 0755 $(CURDIR)/src/vanilla-virtualchroot/pure-ftpd $(CURDIR)/debian/pure-ftpd/usr/sbin/pure-ftpd-virtualchroot
install -m 0755 $(CURDIR)/src/ldap-virtualchroot/pure-ftpd $(CURDIR)/debian/pure-ftpd-ldap/usr/sbin/pure-ftpd-ldap-virtualchroot
install -m 0755 $(CURDIR)/src/mysql-virtualchroot/pure-ftpd $(CURDIR)/debian/pure-ftpd-mysql/usr/sbin/pure-ftpd-mysql-virtualchroot
install -m 0755 $(CURDIR)/src/postgresql-virtualchroot/pure-ftpd $(CURDIR)/debian/pure-ftpd-postgresql/usr/sbin/pure-ftpd-postgresql-virtualchroot
# install config files
install -d $(CURDIR)/debian/pure-ftpd-common/etc/pure-ftpd/conf
install -d $(CURDIR)/debian/pure-ftpd-common/etc/pure-ftpd/db
install -m 0644 debian/pureftpd-dir-aliases $(CURDIR)/debian/pure-ftpd-common/etc/pure-ftpd
for f in debian/etc/*; do if [ -f $$f ]; then install -m 0644 $$f $(CURDIR)/debian/pure-ftpd-common/etc/pure-ftpd/conf; fi; done
install -d $(CURDIR)/debian/pure-ftpd-ldap/etc/pure-ftpd/conf
install -m 0644 debian/etc/ldap/* $(CURDIR)/debian/pure-ftpd-ldap/etc/pure-ftpd/conf
install -d $(CURDIR)/debian/pure-ftpd-mysql/etc/pure-ftpd/conf
install -d $(CURDIR)/debian/pure-ftpd-mysql/etc/pure-ftpd/db
install -m 0644 debian/etc/mysql/* $(CURDIR)/debian/pure-ftpd-mysql/etc/pure-ftpd/conf
install -d $(CURDIR)/debian/pure-ftpd-postgresql/etc/pure-ftpd/conf
install -d $(CURDIR)/debian/pure-ftpd-postgresql/etc/pure-ftpd/db
install -m 0644 debian/etc/postgresql/* $(CURDIR)/debian/pure-ftpd-postgresql/etc/pure-ftpd/conf
# links for authentication configuration
install -d $(CURDIR)/debian/pure-ftpd-common/etc/pure-ftpd/auth
(cd $(CURDIR)/debian/pure-ftpd-common/etc/pure-ftpd/auth && ln -s ../conf/PAMAuthentication 70pam && ln -s ../conf/UnixAuthentication 65unix)
install -d $(CURDIR)/debian/pure-ftpd-mysql/etc/pure-ftpd/auth
(cd $(CURDIR)/debian/pure-ftpd-mysql/etc/pure-ftpd/auth && ln -s ../conf/MySQLConfigFile 30mysql)
install -d $(CURDIR)/debian/pure-ftpd-postgresql/etc/pure-ftpd/auth
(cd $(CURDIR)/debian/pure-ftpd-postgresql/etc/pure-ftpd/auth && ln -s ../conf/PGSQLConfigFile 30pgsql)
install -d $(CURDIR)/debian/pure-ftpd-ldap/etc/pure-ftpd/auth
(cd $(CURDIR)/debian/pure-ftpd-ldap/etc/pure-ftpd/auth && ln -s ../conf/LDAPConfigFile 30ldap)
# database configuration files
install -d $(CURDIR)/debian/pure-ftpd-mysql/etc/pure-ftpd/db
perl -pe 's%^MYSQLSocket.*%MYSQLSocket /var/run/mysqld/mysqld.sock%' pureftpd-mysql.conf > $(CURDIR)/debian/pure-ftpd-mysql/etc/pure-ftpd/db/mysql.conf
install -d $(CURDIR)/debian/pure-ftpd-postgresql/etc/pure-ftpd/db
perl -pe 's%^#\s*PGSQLServer\s+/tmp.*%# PGSQLServer /var/run/postgresql%' pureftpd-pgsql.conf > $(CURDIR)/debian/pure-ftpd-postgresql/etc/pure-ftpd/db/postgresql.conf
install -d $(CURDIR)/debian/pure-ftpd-ldap/etc/pure-ftpd/db
install -m 0600 pureftpd-ldap.conf $(CURDIR)/debian/pure-ftpd-ldap/etc/pure-ftpd/db/ldap.conf
# install the wrapper, control script and corresponding manual pages
install -m 0755 debian/pure-ftpd-wrapper $(CURDIR)/debian/pure-ftpd-common/usr/sbin
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/pure-ftpd-wrapper > $(CURDIR)/debian/pure-ftpd-common/usr/share/man/man8/pure-ftpd-wrapper.8
install -m 0755 debian/pure-ftpd-control $(CURDIR)/debian/pure-ftpd-common/usr/sbin
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/pure-ftpd-control > $(CURDIR)/debian/pure-ftpd-common/usr/share/man/man8/pure-ftpd-control.8
# fix path in pure-pw manual pages
perl -i -pe 's%/etc/pureftpd\.%/etc/pure-ftpd/pureftpd.%' $(CURDIR)/debian/pure-ftpd-common/usr/share/man/man8/pure-pw.8
# install log and runtime directory
install -m 0700 -d $(CURDIR)/debian/pure-ftpd-common/var/log/pure-ftpd
# shared maintainer scripts
for package in $(FLAVOURS); do\
for script in postinst prerm ; do \
install -p debian/flavour.$$script debian/$$package.$$script; \
done; \
done
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
dh_testdir
dh_testroot
dh_installchangelogs -i
dh_installdocs -i
dh_installexamples -i
dh_installdebconf -i
dh_link -i
dh_strip -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_shlibdeps -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs -a
dh_link -a
dh_strip -a
dh_compress -a
dh_fixperms -a
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
|