Diff webdavcgi-0.8.3 with a webdavcgi-0.8.4

/usr/portage/www-apps/webdavcgi/webdavcgi-0.8.4.ebuild 2017-02-28 22:50:00.000000000 +0300
1 1
# Copyright 1999-2015 Gentoo Foundation
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=4
4
EAPI=5
5 5

  
6
inherit eutils toolchain-funcs webapp
6
inherit eutils toolchain-funcs versionator
7 7

  
8 8
DESCRIPTION="A Perl CGI for accessing and sharing files, or calendar/addressbooks via WebDAV"
9 9
HOMEPAGE="http://webdavcgi.sourceforge.net/"
10 10
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
11 11

  
12 12
LICENSE="GPL-3"
13
SLOT="0"
14
WEBAPP_MANUAL_SLOT="yes"
13

  
14
# Provide slotting on minor versions. WebDAV CGI is a web application which
15
# can be shared by multiple instances and thus major updates shouldn't be
16
# enforced to all users/instances at the same time.
17
SLOT="$(get_version_component_range 1-2)"
18

  
15 19
KEYWORDS="~amd64"
16
IUSE="mysql postgres rcs samba +sqlite +suid"
20
IUSE="afs kerberos mysql postgres rcs samba +sqlite +suid"
17 21

  
18 22
DEPEND=""
19
RDEPEND="dev-perl/Archive-Zip
23
RDEPEND="!www-apps/webdavcgi:0
24
	afs? ( net-fs/openafs )
25
	dev-lang/perl
26
	dev-perl/Archive-Zip
20 27
	dev-perl/File-Copy-Link
21 28
	dev-perl/PerlIO-gzip
22 29
	dev-perl/Quota
......
24 31
	dev-perl/URI
25 32
	dev-perl/UUID-Tiny
26 33
	dev-perl/XML-Simple
34
	kerberos? ( virtual/krb5 )
27 35
	media-gfx/graphicsmagick[perl]
28 36
	mysql? ( dev-perl/DBD-mysql )
29 37
	virtual/perl-Module-Load
......
32 40
	samba? ( dev-perl/Filesys-SmbClient )
33 41
	sqlite? ( dev-perl/DBD-SQLite )
34 42
	dev-perl/CGI
35
	virtual/perl-File-Spec"
36

  
37
need_httpd_cgi
43
	virtual/perl-File-Spec
44
	|| ( virtual/httpd-cgi virtual/httpd-fastcgi )"
38 45

  
39 46
REQUIRED_USE="|| ( mysql postgres sqlite )"
40 47

  
41 48
CGIBINDIR="cgi-bin"
42 49

  
43
src_prepare() {
44
	epatch "${FILESDIR}/${PV}-logout-var-expansion.patch"
45
}
46

  
47 50
src_compile() {
48 51
	if use suid; then
49
		# There are several webdavwrappers, TODO: make it configureable
50
		export WEBDAVWRAPPER="webdavwrapper"
52
		WEBDAVWRAPPERS="webdavwrapper" # Standard UID/GID wrapper
53

  
54
		use afs      && WEBDAVWRAPPERS+=" webdavwrapper-afs"
55
		use kerberos && WEBDAVWRAPPERS+=" webdavwrapper-krb"
56

  
57
		export WEBDAVWRAPPERS
51 58

  
52
		$(tc-getCC) ${LDFLAGS} ${CFLAGS} \
53
			-o "${CGIBINDIR}/${WEBDAVWRAPPER}" \
54
			helper/webdavwrapper.c || die "compile ${WEBDAVWRAPPER} failed"
59
		local wrapper
60
		for wrapper in ${WEBDAVWRAPPERS}; do
61
			$(tc-getCC) ${LDFLAGS} ${CFLAGS} \
62
				-o "${CGIBINDIR}/${wrapper}" \
63
				"helper/${wrapper}.c" || die "compile ${wrapper} failed"
64
		done
55 65
	fi
56 66
}
57 67

  
58 68
src_install() {
59
	webapp_src_preinst
69
	exeinto "/usr/libexec/${PN}-${SLOT}/${CGIBINDIR}"
70
	newexe "${CGIBINDIR}/logout-dist" "logout"
71
	doexe "${CGIBINDIR}/webdav.pl"
60 72

  
61
	local htdocsDir='htdocs'
62
	local confDir='etc'
73
	use afs   && doexe "${CGIBINDIR}/afswrapper"
74
	use samba && doexe "${CGIBINDIR}/smbwrapper"
75

  
76
	if use suid; then
77
	    # In order to change the user and group ID at runtime, the webdavwrapper
78
	    # needs to be run as root (set-user-ID and set-group-ID bit)
79
		exeopts -o root -g root -m 6755
80

  
81
	    local wrapper
82
		for wrapper in ${WEBDAVWRAPPERS}; do
83
			einfo "Installing UID/GID wrapper ${wrapper}"
84
			doexe "${CGIBINDIR}/${wrapper}"
85
		done
63 86

  
64
	local installDirs="$confDir lib locale"
87
		# reset install opts
88
		exeopts
89
	else
90
		ewarn "You have the 'suid' USE flag disabled"
91
		ewarn "WebDAV CGI won't be able to switch user ids"
92
	fi
65 93

  
66
	insinto "${MY_HTDOCSDIR}"
67
	doins -r "${htdocsDir}"/*
94
	local confDir='etc'
95
	local webdavConfDir="/etc/${PN}-${SLOT}/default"
68 96

  
69
	exeinto "${MY_CGIBINDIR}"
70
	newexe "${CGIBINDIR}/logout-dist" logout
97
	export WEBDAVCONFIG="${webdavConfDir}/webdav.conf"
71 98

  
72
	doexe "${CGIBINDIR}/webdav.pl"
73
	use suid && doexe "${CGIBINDIR}/${WEBDAVWRAPPER}"
99
	insinto "${webdavConfDir}"
100
	doins "${confDir}/mime.types"
101
	newins "${FILESDIR}/webdav-${SLOT}.conf" "webdav.conf"
74 102

  
103
	local installBaseDir="/usr/share/${PN}-${SLOT}"
75 104
	local currentDir
76
	for currentDir in ${installDirs}; do
77
		dodir "${MY_HOSTROOTDIR}/${currentDir}"
78
		insinto "${MY_HOSTROOTDIR}/${currentDir}"
105
	for currentDir in htdocs lib locale; do
106
		insinto "${installBaseDir}/${currentDir}"
79 107
		doins -r "${currentDir}"/*
80 108
	done
81 109

  
82
	webapp_configfile "${MY_HOSTROOTDIR}/${confDir}"/{webdav.conf-dist,mime.types}
110
	if use mysql || use postgres; then
111
		local sqlDir='sql'
112
		insinto "${installBaseDir}/${sqlDir}"
113
		use mysql    && "${sqlDir}/mysql.sql"
114
		use postgres && "${sqlDir}/postgresql.sql"
115
	fi
83 116

  
84
	use mysql && webapp_sqlscript mysql sql/mysql.sql
85
	use postgres && webapp_sqlscript postgres sql/postgresql.sql
117
	if use sqlite; then
118
		# Directory where the SQLite database resides
119
		local sqliteRootDir="/var/lib/${PN}/${SLOT}"
120
		keepdir "${sqliteRootDir}"
121

  
122
		# Default database directory where all users are able to create and
123
		# share the databases, this can be changed within the config file and
124
		# restricted to user/group only access if required.
125
		export SQLITEDIR="${sqliteRootDir}/default"
126
		keepdir "${SQLITEDIR}"
127
		fperms 1777 "${SQLITEDIR}"
128
	fi
129

  
130
	# Default thumbnail directory, writable by all users
131
	export THUMBNAILDIR="/var/cache/${PN}/${SLOT}/default/thumbnails"
132
	keepdir "${THUMBNAILDIR}"
133
	fperms 1777 "${THUMBNAILDIR}"
86 134

  
135
	export APACHEEXAMPLECONFIG="apache-webdavcgi-${SLOT}-example.conf"
87 136
	dodoc CHANGELOG TODO
137
	dodoc "${FILESDIR}/${APACHEEXAMPLECONFIG}"
88 138
	dohtml -r doc/*
139
}
89 140

  
90
	webapp_hook_script "${FILESDIR}/reconfig"
91

  
92
	webapp_src_install
93

  
94
	# In order to change the user and group ID at runtime, the webdavwrapper
95
	# needs to be run as root (set-user-ID and set-group-ID bit)
96
	if use suid; then
97
		einfo "Setting SUID and SGID bit for ${WEBDAVWRAPPER}"
98
		fowners root:root "${MY_CGIBINDIR}/${WEBDAVWRAPPER}"
99
		fperms 6755 "${MY_CGIBINDIR}/${WEBDAVWRAPPER}"
100
		webapp_postinst_txt en "${FILESDIR}/postinstall-${WEBDAVWRAPPER}-en.txt"
101
		webapp_hook_script "${FILESDIR}/reconfig-suid"
102
	else
103
		ewarn "You have the 'suid' USE flag disabled"
104
		ewarn "WebDAV CGI won't be able to switch user ids"
105
		webapp_postinst_txt en "${FILESDIR}/postinstall-en.txt"
106
	fi
141
pkg_postinst() {
142
	ewarn "In order to allow different users to create and share files,"
143
	ewarn "some directories were installed with world write access by default."
144
	ewarn "To set restrictive permissions, add all WebDAV CGI users to a"
145
	ewarn "common group, and allow access to the following directories by this"
146
	ewarn "group only."
147
	ewarn "Thumbnail directory: ${THUMBNAILDIR}"
148
	use sqlite && ewarn "SQLite directory:    ${SQLITEDIR}"
149

  
150
	ewarn
151
	ewarn "Until bug #456180 is fixed, you probably have to re-emerge"
152
	ewarn "media-gfx/graphicsmagick"
153

  
154
	elog
155
	elog "The WebDAV CGI config is located at ${WEBDAVCONFIG}."
156
	elog
157
	elog "An example Apache HTTP server configuration snippet is available in"
158
	elog "/usr/share/doc/${PF} in the file ${APACHEEXAMPLECONFIG}"
159

  
160
	einfo
161
	einfo "Detailed installation and configuration instructions can be found at"
162
	einfo "http://webdavcgi.sourceforge.net/"
107 163
}
Thank you!