summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3a2f237a5bb47d71c46f72109aede86d181c9304 (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
# Maintainer: Pavol Hluchy (Lopo) <lopoATlosysDOTeu>
# based on original squirrelmail package by darose

pkgname=squirrelmail-dev-svn
pkgver=r14832
pkgrel=1
_svnmod='squirrelmail'
pkgdesc='Webmail for Nuts! (Development version Subversion source)'
arch=('any')
license=('GPL')
url="http://www.squirrelmail.org"
depends=('php' 'perl' 'imap-server')
makedepends=('subversion')
conflicts=('squirrelmail')
provides=('squirrelmail=1.5.2')
source=("squirrelmail::svn+http://svn.code.sf.net/p/squirrelmail/code/trunk/${_svnmod}")
sha512sums=('SKIP')
backup=(srv/http/squirrelmail/.htaccess srv/http/squirrelmail/config/config.php)
install=${pkgname}.install
options=(!strip)

pkgver() {
	cd "$srcdir"/${_svnmod}
	local ver=$(svnversion)
	printf "r%s" "${ver//[[:alpha:]]}"
}

prepare() {
	if [ -d ${_svnmod}-build ]; then
		rm -Rf ${_svnmod}-build
	fi
	svn --force export ${_svnmod} ${_svnmod}-build
}

package() {
	# install
	mkdir -p "${pkgdir}"/srv/http/squirrelmail
	cd "${pkgdir}"/srv/http/squirrelmail
	cp -a "${srcdir}"/squirrelmail-build/* .

	# customize config (data and attachments in /var/lib/squirrelmail)
	cd config
	cp -p config_default.php config.php
	sed -i 's|^$attachment_dir = $data_dir;|$attachment_dir = "/var/lib/squirrelmail/attachments";|' config.php
	sed -i 's|^$data_dir = "/var/local/squirrelmail/data";|$data_dir = "/var/lib/squirrelmail/data";|' config.php

	# create data and attachments directories, set ownership/permissions
	# ideally we would set attachments differently to root:-1 with 0730, but
	# I don't know how to get chgrp to take "-1" properly; perhaps someday
	# I'll figure out how to make this work
	mkdir -p "${pkgdir}"/var/lib/squirrelmail/{data,attachments}
	chown -R http:http "${pkgdir}"/var/lib/squirrelmail/data
	chown -R http:http "${pkgdir}"/var/lib/squirrelmail/attachments
	chmod 0700 "${pkgdir}"/var/lib/squirrelmail/data
	chmod 0300 "${pkgdir}"/var/lib/squirrelmail/attachments

	# restrict access to squirrelmail by default
	echo "deny from all" >"${pkgdir}"/srv/http/squirrelmail/.htaccess
}