aboutsummaryrefslogtreecommitdiffstats
path: root/testing/proftpd/APKBUILD
blob: ef1663c7a656faa5315e386d257014f3a4b46323 (plain) (blame)
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
# Contributor: Pedro Filipe <pedrofilipe64@gmail.com>
# 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.7a
_pkgver=${pkgver/_/}
pkgrel=0
pkgdesc="Highly configurable FTP server software"
url="https://github.com/proftpd/proftpd"
pkgusers=$pkgname
pkggroups=$pkgname
arch="all"
license="GPL-2.0-or-later"
options="!check" # almost all checks fail, disbled for now
makedepends="autoconf
	automake
	pcre-dev
	libmemcached-dev
	openssl-dev
	sqlite-dev
	mariadb-connector-c-dev
	hiredis-dev
	unixodbc-dev
	postgresql-dev
	openldap-dev
	geoip-dev
	net-snmp-dev"
install="$pkgname.pre-install"

_modules="mod_unique_id:mod_site_misc:mod_load:mod_ban:mod_quotatab:mod_sql:mod_sql_mysql:mod_sql_postgres:mod_sql_sqlite:mod_sql_odbc:mod_dynmasq"
_modules="$_modules:mod_quotatab_sql:mod_ldap:mod_quotatab_ldap:mod_ratio:mod_tls:mod_rewrite:mod_radius:mod_wrap2:mod_wrap2_file"
_modules="$_modules:mod_wrap2_sql:mod_quotatab_file:mod_quotatab_radius:mod_facl:mod_ctrls_admin:mod_copy:mod_deflate:mod_ifversion"
_modules="$_modules:mod_geoip:mod_exec:mod_sftp:mod_sftp_sql:mod_shaper:mod_sql_passwd:mod_ifsession:mod_auth_otp:mod_tls_redis"
_modules="$_modules:mod_wrap2_redis:mod_redis:mod_memcache:mod_tls_memcache:mod_readme:mod_snmp:mod_tls_shmcache"

subpackages="$pkgname-doc
	$pkgname-utils
	$pkgname-openrc"

for _module in ${_modules//:/ };  do
	subpackages="$subpackages $pkgname-$_module:_module"
done

source="$pkgname-$_pkgver.tar.gz::https://github.com/proftpd/proftpd/archive/v$_pkgver.tar.gz
	fix-autoconf.patch
	fix-ar-dir.patch

	$pkgname.logrotate
	$pkgname.initd
	$pkgname.conf
	mod_sftp.conf
	mod_tls_shmcache.conf"

builddir="$srcdir/$pkgname-$_pkgver/"

prepare() {
	default_prepare
	autoreconf -f
}

check() {
	make check
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc/$pkgname \
		--localstatedir=/run/$pkgname \
		--libexecdir=/usr/lib/$pkgname \
		--disable-static \
		--enable-sendfile \
		--enable-facl \
		--enable-dso \
		--enable-autoshadow \
		--enable-ctrls \
		--enable-ipv6 \
		--enable-pcre \
		--disable-strip \
		--disable-wtmp \
		--disable-auth-pam \
		--enable-openssl \
		--with-shared=$_modules
	make
}

package() {
	make DESTDIR="$pkgdir" -j1 install
	mkdir -p "$pkgdir"/var/log/$pkgname \
		"$pkgdir"/etc/$pkgname/conf.d \
		"$pkgdir"/etc/$pkgname/modules.d

	install -Dm644 "$srcdir"/$pkgname.conf "$pkgdir"/etc/$pkgname/$pkgname.conf
	install -dm750 -o ftp -g ftp "$pkgdir"/var/lib/ftp
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname

	rm -fr "$pkgdir"/run "$pkgdir"/usr/share/locale \
		"$pkgdir"/usr/sbin/in.$pkgname \
		"$pkgdir"/usr/lib/pkgconfig \
		"$pkgdir"/usr/include
}

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

doc() {
	default_doc
	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname
	cd "$builddir"
	cp -r RELEASE_NOTES doc/* contrib/README* \
		contrib/mod_quotatab_ldap.ldif \
		contrib/mod_quotatab_ldap.schema \
		"$subpkgdir"/usr/share/doc/$pkgname
}

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

_module() {
	local name=${subpkgname#$pkgname-}
	local module_name=${name#mod_}
	local module_dep=${module_name%%_*}

	pkgdesc="ProFTPd module: $name"
	depends="$pkgname"
	mkdir -p "$subpkgdir"/usr/lib/$pkgname
	mv "$pkgdir"/usr/lib/$pkgname/$name.so "$subpkgdir"/usr/lib/$pkgname
	if [ -f "$srcdir"/$name.conf ]; then
		install -Dm644 "$srcdir"/$name.conf \
			"$subpkgdir"/etc/$pkgname/conf.d/$module_name.conf
	fi

	local file="$subpkgdir"/etc/$pkgname/modules.d/$module_name.conf
	mkdir -p ${file%/*}
	{
		echo "<IfModule !$name.c>"
		if [ "$module_name" != "$module_dep" ]; then
			depends="$depends $pkgname-mod_$module_dep"
			echo "  <IfModule !mod_$module_dep.c>"
			echo "    LoadModule mod_$module_dep.c"
			echo "  </IfModule>"
		fi
		echo "  LoadModule $name.c"
		echo "</IfModule>"
	} >$file

	# thats fine
	# shellcheck disable=2015
	type -q _post_$name && eval _post_$name || true
}

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

_post_mod_ldap() {
	mkdir -p "$subpkgdir"/etc/$pkgname
	cp "$builddir"/contrib/mod_quotatab_ldap.ldif \
		"$builddir"/contrib/mod_quotatab_ldap.schema \
		"$subpkgdir"/etc/$pkgname
}

_post_mod_sftp() {
	mkdir -p "$subpkgdir"/etc/$pkgname/authorized_keys
	mv "$pkgdir"/etc/$pkgname/dhparams.pem \
		"$pkgdir"/etc/$pkgname/blacklist.dat \
		"$subpkgdir"/etc/$pkgname/
}

sha512sums="abb53c494677001b6d8d5a15af4ae47e2527025c952667b8c42e144452266d2b7f89b57e68c96177e6054733eb5e5d04cc1c0cf61ff7c3697910e0a525a9de87  proftpd-1.3.7a.tar.gz
6e1679de13fb504fbeaa12eb28492af1b3ef7303c0a6ce0a341d5dfda5ce01061c0986c3619eacceab01897eb11fdc54e1f5f419180e75ab906a47e74df3870c  fix-autoconf.patch
00cceed4c7fb98a109e1f7059e352d02cdbe9805df6e9de052fd44a9562f31234fbd72a57f92f6612b69c8ed6b946b7b9a5dd75ff98ce43b9eaf74ac48fabeda  fix-ar-dir.patch
142f8ba096844eb48883cdd3890fa3c0c4c8f73f7ce4f2acd5fb742053f8a3605b3f6ca5d5ab6c62c673d76eb60885d796af55bd7b53950794c4e7e2837973b8  proftpd.logrotate
a03124a88c0c9f3981762804c62aa479f36227f24408a60437bf737c1e783c539a2d2c0aed0b1d95e56a587bdb5c372f6d670c298cdb7433ecd1f64d4bef7c42  proftpd.initd
c6c6b6c32dd00d31fc1e328e989c77944aac993818747da05794c9560a270630e9bc7e09ac29215b57bcc709299d3720ae9009d3e2a94a0aef8cc5729fae1d0b  proftpd.conf
8c810838219dd0663d3a7390c4e3a31739c1389238f92f856a4c74cd5a71317e1cae0dcfecc4e43cc3057f8c4132539e87511e06620debb2f166694a15adc13e  mod_sftp.conf
2b5beaa4e01588b6d936b7ffda790e270fcba1e337eb43af11a1ad9c615d443d627c4bf66fe2b7946e57c65f5b1075568ab32df3c982e7e7d263b39d422693cd  mod_tls_shmcache.conf"