summaryrefslogtreecommitdiff
path: root/www-apps
diff options
context:
space:
mode:
authorBertrand Jacquin <beber@meleeweb.net>2013-09-16 23:33:53 +0200
committerBertrand Jacquin <beber@meleeweb.net>2013-09-16 23:35:59 +0200
commit94fae4d0a7acfe50f82880f0392e83aa30779bf2 (patch)
tree96b5caaca75ca1eb2ee3ea204e03fc561e3d2543 /www-apps
parentmetadata: refresh cache (diff)
downloadportage-94fae4d0a7acfe50f82880f0392e83aa30779bf2.tar.xz
www-apps/phabricator: refuse to install in htdocs is not a subdirectory of root dir, add a .htaccess
Package-Manager: portage-2.2.6
Diffstat (limited to 'www-apps')
-rw-r--r--www-apps/phabricator/ChangeLog5
-rw-r--r--www-apps/phabricator/Manifest7
-rw-r--r--www-apps/phabricator/files/htaccess17
-rwxr-xr-xwww-apps/phabricator/files/webapp-hook25
-rw-r--r--www-apps/phabricator/phabricator-9999.ebuild9
5 files changed, 57 insertions, 6 deletions
diff --git a/www-apps/phabricator/ChangeLog b/www-apps/phabricator/ChangeLog
index b505205d..85471119 100644
--- a/www-apps/phabricator/ChangeLog
+++ b/www-apps/phabricator/ChangeLog
@@ -2,6 +2,11 @@
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+ 16 Sep 2013; Bertrand Jacquin <beber@meleeweb.net> +files/htaccess,
+ files/webapp-hook, phabricator-9999.ebuild:
+ www-apps/phabricator: refuse to install in htdocs is not a subdirectory of
+ root dir, add a .htaccess
+
14 Sep 2013; Bertrand Jacquin <beber@meleeweb.net> phabricator-9999.ebuild:
www-apps/phabricator: Requiere >=app-admin/webapp-config-1.51-r1 otherwise
hooks fail with interactive terms
diff --git a/www-apps/phabricator/Manifest b/www-apps/phabricator/Manifest
index b55d5a76..90cdfd91 100644
--- a/www-apps/phabricator/Manifest
+++ b/www-apps/phabricator/Manifest
@@ -2,9 +2,10 @@ AUX 0001-Changed-add_user.php-to-create-users-with-unverified.patch 1246 SHA256
AUX 0002-Make-wiki-visible-to-all.patch 907 SHA256 8f145e199490c559b11865b90b694146bf2d6fa07dcdf50f34f91f44216f24c9 WHIRLPOOL b868cfd98f85eda609ec2c700b42ae1c1ec2724dba8b3bed1cc53dbbda862b294dbad9864cf95f6aab5668b15a17b6f39a25778250c38d602c28a540a7d70ad7
AUX aphlictd.confd 163 SHA256 553f18f54bcf75eada649e564fea7c4c610fd01ec93708bd246263405e7d5246 WHIRLPOOL 027e41cff147fbf7544ba72575fa21e12a66da7b5cd1bdf53a98b929b7c6127c25a997118e9cfea0e00379a7937eb52b051deb4256abb5bb5d6796a9d16138ad
AUX aphlictd.initd 1049 SHA256 6f45d4e4d2d55b50b35b84c11c73628c067f5b7e4d6d88e148ebd00a1a1208cd WHIRLPOOL 2dcf7c230891e660f6dd3655ef0f04be74798f7fc98cc6191088d90ceeb7b6fe51d36ea016d625c18325f4b724a89f07b8e6c2bfd0aa6779946fe72b1702f95d
+AUX htaccess 475 SHA256 90b7245b7518f5b3e56bae9d574a530e3cd47808ef937bdc78ea4288eaff0c6a WHIRLPOOL fc9123f3d40affe53314a25c2649a5b2f47640131c9bc5a6dd0c55ac36e0a205f392b403fcbce93daffceaf427c7146b7a091115a8260c7551a3bfe8069ad88e
AUX phd.confd 215 SHA256 80ddbf586f38cc600d06e524f7e85c3258bd563696fa2e41e1ea19268da8079b WHIRLPOOL 0f1a587c755994c410b62da6b897ca8684d584b9f01956359e078429fc7ec7642561dc3e3c306bbb24753e3a68ef5f088a5709706143b6154aa085ac2dfa52ad
AUX phd.initd 2108 SHA256 8475c308320ce4d51d35cbea46df61628c9c1d64eb724955a38ed49e51690cda WHIRLPOOL 4c91fcce779d423fa0fa24e744675a7dfaa57d0fe2dd86792a2c27215fc014ca85b38695909f8f6c063308a10d53c499620d909ee29382aec8097c437857988e
-AUX webapp-hook 3210 SHA256 edd160d84f7609bc12cef970bfdb1187140e15c59b0f9be39f8cfab3e36db9d8 WHIRLPOOL c7ea180db1ad2b784864618f43f2d446abaa7a7a5fc3e81eabc212ace67fa35dc659a8e6298bff5dc5a8ac0420f53f6c58e45d8f0406e10e31825a03e20a8af8
-EBUILD phabricator-9999.ebuild 4380 SHA256 82d37a2f67af9f1f3b45f509418249472224856e5394748a5b39e118968b874c WHIRLPOOL b717269e8b622d861afb0fced583fd0ef653ff1aeaad371fd27f819cadb386aa82e67868b773f8ce3de734c634bbe508690c435578933975db1a2c90cdd4efa5
-MISC ChangeLog 5288 SHA256 4e5c69d2edf6b7d7c9b19aeb9ef67be26e379ad0e8d7f013232bedcf0fee0a9b WHIRLPOOL 4c0b3121cb2b194f979c6483e54eef08e1398327e8531e46b5027417d467cc9bd9e5d75b0c47c03e69529f110169b88e723167cd4217d345d1dfea361a72dec9
+AUX webapp-hook 3866 SHA256 429b0dd02a50b61c71b340037687fbacd41fabaf399e6b078cdc80b7b035357e WHIRLPOOL 38395b7ba5d6ee06ccb724b12f0c2dd1192e3cc517e30eed1efbb9b4d4dcb06ab411aad0a004aa833e05f2552525f48e98e58d6915be2be4e633b7900705d831
+EBUILD phabricator-9999.ebuild 4447 SHA256 bdf13289c45393bb662a68a5b245709301c75827f6b862d8e25874b02834e3d6 WHIRLPOOL 71ffd697eabfacb9af315d37f7eabe3cbed0b58b45d839defc9828f4100794df0b77afa8d3e16ee68ecff4d772b1be86d0ea351db974bcea8d7085534c9b0784
+MISC ChangeLog 5510 SHA256 42a23aea75ba359a20d9e04761940e64d10528583f3e4a7547940be9d1957d8a WHIRLPOOL df70bb81aec9581805b3b0e61c041a1644d8ac3f6c2c35419b904ea419bee9e4532c08f6b2c3cc66cbd1f03049ff7ff01810535053be71bfa51d7fe8f2369d41
MISC metadata.xml 653 SHA256 744c67bfd3b874f305b08a5b68c5e2213c3cdc1c47b381fe130ebfc2005a964b WHIRLPOOL 5efd225c032e0704862510f166c94327460caf27527b473fe8f35ea6117b2b16862e362aff0b7bdb47b38349dbcf8710fff4040f11d50e07865f983dacc93d99
diff --git a/www-apps/phabricator/files/htaccess b/www-apps/phabricator/files/htaccess
new file mode 100644
index 00000000..9b7023fa
--- /dev/null
+++ b/www-apps/phabricator/files/htaccess
@@ -0,0 +1,17 @@
+# Environnement to enable
+SetEnv PHABRICATOR_ENV default
+
+# Needed for RewriteEngine
+Options FollowSymLinks
+
+RewriteEngine On
+
+# Server local file directly expect index.php
+RewriteCond %{REQUEST_FILENAME} -f
+RewriteCond %{REQUEST_URI} !^/index.php
+RewriteRule .* - [L,QSA]
+
+# Append REQUEST_URI as a __path__ QUERY_STRING to all other requests
+# if not already existing
+RewriteCond %{QUERY_STRING} !^__path__=
+RewriteRule ^(.*)$ /index.php?__path__=/$1 [NS,B,L,QSA]
diff --git a/www-apps/phabricator/files/webapp-hook b/www-apps/phabricator/files/webapp-hook
index c35e3089..e0096999 100755
--- a/www-apps/phabricator/files/webapp-hook
+++ b/www-apps/phabricator/files/webapp-hook
@@ -14,6 +14,30 @@ function rc_status () {
"/etc/init.d/${_svc}" -sCq status > /dev/null 2>&1
}
+function chk-htdocs () {
+ local _root="$(realpath ${VHOST_ROOT})"
+ local _htdocs="$(realpath ${VHOST_HTDOCSDIR})"
+
+ _root="${_root//[^\/]}"
+ _htdocs="${_htdocs//[^\/]}"
+
+ if (( ${#_htdocs} - ${#_root} != 1 )) ; then
+ eerror "VHOST_HTDOCSDIR MUST be one level subdirectory of VHOST_ROOT"
+ eerror
+ eerror "What you have is"
+ eerror " VHOST_ROOT=${VHOST_ROOT}"
+ eerror " VHOST_HTDOCSDIR=${VHOST_HTDOCSDIR}"
+ eerror
+ eerror "Example of what you should have"
+ eerror " VHOST_ROOT=/var/www/localhost"
+ eerror " VHOST_HTDOCSDIR=/var/www/localhost/public_html"
+ eerror
+ die "You must fix your webapp-config configuration"
+ fi
+
+ return 0
+}
+
function fix-perms () {
einfo "Make executable all shebanged files"
find "${VHOST_ROOT}" -type f \
@@ -114,6 +138,7 @@ einfo
case "$1" in
install)
+ chk-htdocs
fix-perms
fix-webroot
storage-upgrade
diff --git a/www-apps/phabricator/phabricator-9999.ebuild b/www-apps/phabricator/phabricator-9999.ebuild
index dcefa5e6..644b58dc 100644
--- a/www-apps/phabricator/phabricator-9999.ebuild
+++ b/www-apps/phabricator/phabricator-9999.ebuild
@@ -55,14 +55,14 @@ src_prepare() {
epatch "${FILESDIR}/0001-Changed-add_user.php-to-create-users-with-unverified.patch"
epatch "${FILESDIR}/0002-Make-wiki-visible-to-all.patch"
- find "${S}" -type f -name .gitignore -print0 \
+ find -type f -name .gitignore -print0 \
| xargs -0 --no-run-if-empty -- \
rm
rm -r scripts/install
# Replace 'env' shebang to files it point to
- find "${S}" -type f \
+ find -type f \
| sort \
| xargs -n 1 --no-run-if-empty -- \
awk 'NR == 1 && /^#!\/usr\/bin\/env/ {print FILENAME}' \
@@ -78,7 +78,7 @@ src_prepare() {
path="$(type -p ${cmd})" || continue
[[ -z "${path}" ]] && continue
- einfo "Changing ${REPLY/#${S}\/} shebang to #!${path} ${args}"
+ einfo "Changing ${REPLY} shebang to #!${path} ${args}"
sed -i \
-e "1 s:^#!.*:#!${path} ${args}:" \
"${REPLY}"
@@ -128,6 +128,8 @@ src_install() {
insinto "${MY_HTDOCSDIR}"
doins -r webroot/*
+ newins "${FILESDIR}/htaccess" .htaccess
+
# Make executable all shebanged files
find "${ED}" -type f \
| xargs -n 1 --no-run-if-empty -- \
@@ -137,6 +139,7 @@ src_install() {
fperms 755
webapp_configfile "${MY_HOSTROOTDIR}"/conf/{default,development,production}.conf.php
+ webapp_configfile "${MY_HTDOCSDIR}/.htaccess"
webapp_hook_script "${FILESDIR}/webapp-hook"
webapp_src_install