aboutsummaryrefslogtreecommitdiffstats
path: root/testing/proftpd/APKBUILD
blob: 7bc6701684decf60b699c5112f366b449a4a5fe6 (plain)
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
# Contributor: Elizabeth Jennifer Myers <elizabeth@sporksirc.net>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=proftpd
pkgver=1.3.6
pkgrel=0
_pkgver=${pkgver/_rc/rc}
pkgdesc="Highly configurable FTP server software"
url="http://www.proftpd.org/"
pkgusers=$pkgname
pkggroups=$pkgname
arch=""
license="GPL"
options="!check"
depends=""
depends_dev="perl"
makedepends="$depends_dev bash pcre-dev libressl-dev sqlite-dev mariadb-dev
	unixodbc-dev postgresql-dev openldap-dev geoip-dev net-snmp-dev"
install="$pkgname.pre-install"
_modules="auth_file ban copy ctrls_admin deflate delay dnsbl dynmasq exec geoip facl facts ident
	ifsession:=zz ifversion ldap load log_forensic qos quotatab:-- quotatab_file:quotatab
	quotatab_ldap:quotatab quotatab_radius:quotatab quotatab_sql:quotatab,sql radius ratio
	readme rewrite shaper site_misc sql:-- sql_passwd:sql sftp_sql:sftp,sql sql_sqlite:sql
	sql_mysql:sql sql_odbc:sql sql_postgres:sql tls tls_shmcache:tls unique_id"
for _module in $_modules; do
	[ -z "${_module##*:*}" ] && eval _load_mod_${_module%:*}=${_module#*:}
	subpackages="$subpackages $pkgname-mod_${_module%:*}:_module"
	_shared_mods="${_shared_mods:+$_shared_mods:}mod_${_module%:*}"
done
subpackages="$pkgname-dev $pkgname-doc $pkgname-utils
	$pkgname-mod_sftp $pkgname-mod_snmp $subpackages
	"
source="ftp://ftp.proftpd.org/distrib/source/$pkgname-$_pkgver.tar.gz
	$pkgname.logrotate
	$pkgname.initd
	mod_delay.conf
	mod_load.conf
	mod_sftp.conf
	mod_tls_shmcache.conf
	"
builddir="$srcdir/$pkgname-$_pkgver"

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc/$pkgname \
		--localstatedir=/run/$pkgname \
		--libexecdir=/usr/lib/$pkgname \
		--disable-strip \
		--disable-pam \
		--enable-dso \
		--enable-facl \
		--enable-pcre \
		--enable-ipv6 \
		--enable-ctrls \
		--enable-openssl \
		--with-shared=mod_sftp:mod_snmp:$_shared_mods \
		|| return 1
	make || return 1
}

package() {
	make -C "$builddir" DESTDIR="$pkgdir" install || return 1
	sed -i	-e "5 a Include /etc/$pkgname/modules.d/*.conf" \
		-e "5 a Include /etc/$pkgname/conf.d/*.conf\n" \
		-e "s/nobody/$pkgname/" \
		-e "s/nogroup/$pkgname/" \
		"$pkgdir"/etc/$pkgname/$pkgname.conf || return 1
	mkdir -p "$pkgdir"/var/log/$pkgname \
		"$pkgdir"/etc/$pkgname/conf.d \
		"$pkgdir"/etc/$pkgname/modules.d || return 1
	install -dm750 -o ftp -g ftp "$pkgdir"/var/lib/ftp || return 1
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname || return 1
	install -Dm644 "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname || return 1
	rm -fr "$pkgdir"/run "$pkgdir"/usr/share/locale \
		"$pkgdir"/usr/sbin/in.$pkgname
}

dev() {
	default_dev || return 1
	mkdir -p "$subpkgdir"/usr/bin || return 1
	mv "$pkgdir"/usr/bin/prxs "$subpkgdir"/usr/bin
}

utils() {
	pkgdesc="$pkgdesc (utilities)"
	depends="$pkgname perl perl-mail-sendmail"
	mkdir -p "$subpkgdir"/usr/sbin || return 1
	mv "$pkgdir"/usr/sbin/ftpscrub \
		"$pkgdir"/usr/sbin/ftpshut \
		"$subpkgdir"/usr/sbin || return 1
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}

_module() {
	local name=${subpkgname#$pkgname-}
	local load=$(eval echo \$_load_$name)
	pkgdesc="ProFTPd module: $name"
	depends="$pkgname"
	mkdir -p "$subpkgdir"/usr/lib/$pkgname || return 1
	mv "$pkgdir"/usr/lib/$pkgname/$name.so \
		"$subpkgdir"/usr/lib/$pkgname || return 1
	[ -f "$srcdir"/$name.conf ] && install -Dm644 "$srcdir"/$name.conf \
		"$subpkgdir"/etc/$pkgname/conf.d/${name#mod_}.conf
	if [ "$load" != "--" ]; then
		local file="$subpkgdir"/etc/$pkgname/modules.d/${name#mod_}.conf
		if [ -z "${load##=*}" ]; then
			file="$subpkgdir"/etc/$pkgname/modules.d/${load#=}${name#mod_}.conf
			load=""
		fi
		mkdir -p ${file%/*} || return 1
		echo "<IfModule !$name.c>" > $file
		local dep; for dep in $(echo $load | tr "," " "); do
			depends="$depends $pkgname-mod_$dep"
			echo "  <IfModule !mod_$dep.c>" >> $file
			echo "    LoadModule mod_$dep.c" >> $file
			echo "  </IfModule>" >> $file
		done
		echo "  LoadModule $name.c" >> $file
		echo "</IfModule>" >> $file
	fi
}

mod_snmp() {
	_module || return 1
	mkdir -p "$subpkgdir"/usr/share/snmp/mibs || return 1
	mv "$pkgdir"/etc/$pkgname/PROFTPD-MIB.txt \
		"$subpkgdir"/usr/share/snmp/mibs
}

mod_sftp() {
	_module || return 1
	mkdir -p "$subpkgdir"/etc/$pkgname/authorized_keys || return 1
	mv "$pkgdir"/etc/$pkgname/dhparams.pem \
		"$pkgdir"/etc/$pkgname/blacklist.dat \
		"$subpkgdir"/etc/$pkgname/
}

sha512sums="2a3ca76a0c35ba31e9d79f7f652f4f35768262f5039c5dc04ef83ac9218f624645ac6cee445af4ec6a8c59a9bdad1e7b48e0e90cd13934cbe7c3e77a2f6013c0  proftpd-1.3.6.tar.gz
142f8ba096844eb48883cdd3890fa3c0c4c8f73f7ce4f2acd5fb742053f8a3605b3f6ca5d5ab6c62c673d76eb60885d796af55bd7b53950794c4e7e2837973b8  proftpd.logrotate
a03124a88c0c9f3981762804c62aa479f36227f24408a60437bf737c1e783c539a2d2c0aed0b1d95e56a587bdb5c372f6d670c298cdb7433ecd1f64d4bef7c42  proftpd.initd
e918e9fdf42e46953faeb55f5a8e7e7afc8951b861059182993f45b7ca870b9bdfa261fc893923772060bf500c44f98503d44878473dce7534f0825a7ff87831  mod_delay.conf
06c149f4c1b8e0deb8102a0ddbe5314354d53cb70934c9315968ab69b9d2b1e16c33bf652aba05472eac4ca44137ce18c93214bb1257fad6c6e2e9b0728cf556  mod_load.conf
557cbf2c1ca3a724216837f98c0f86b7d14df5f91564e1aceef721389c4774562edbd584d3ce2611ea4b2853c50acd569c33302f534e6e60452cf12b4b997ece  mod_sftp.conf
768ce1e63b44eafb9033212655c9a5a9aa65a6f7e1b97b11210ccc0e49caf5c32dd2514dba10a098a4ab2c8bd5f3ad5167f337f5fa0a1cdd5efa4e37c980f6e5  mod_tls_shmcache.conf"