From: Ned Ludd <solar@gentoo.org>
To: gentoo-dev@gentoo.org
Subject: [gentoo-dev] apache.eclass proposed
Date: 08 Jun 2003 06:12:21 -0400 [thread overview]
Message-ID: <1055067141.13370.109.camel@simple> (raw)
[-- Attachment #1: Type: text/plain, Size: 842 bytes --]
After writing a net-www/ ebuild it seemed apparent to me that we are
going to need an apache.eclass. A quick find in portage reveals quite a
few independent ebuilds all needing the basic functionality that could
be provided by an apache.eclass
syntactically perfect the idea is what matters..
I have attached an apache.eclass that I welcome your input/feedback on.
While it may not be syntactically perfect for the apache2 part its the
idea that we get this out there and start talking about one that
matters.
my portage # find . -name '*.ebuild' | xargs grep HTTPD_USER= | wc
22 96 1904
my portage # find . -name '*.ebuild' | xargs grep HTTPD_GROUP= | wc
21 123 2081
my portage # find . -name '*.ebuild' | xargs grep HTTPD_ROOT= | wc
50 299 5154
--
Ned Ludd <solar@gentoo.org>
Gentoo Linux (Hardened)
[-- Attachment #2: apache.eclass --]
[-- Type: text/plain, Size: 2326 bytes --]
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Author: Ned Ludd <solar@gentoo.org>
#
# This eclass is designed to allow easier installation of web applications,
# modules, and their counterparts incorporation into the Gentoo Linux system.
#
#set -x
ECLASS=apache
INHERITED="${INHERITED} ${ECLASS}"
IUSE="apache2 ${IUSE}"
DESCRIPTION="Based on the ${ECLASS} eclass"
newdepend virtual/glibc sys-apps/gawk sys-apps/grep
# apache2? ( >=net-www/apache-2.0.43-r1 ) \
# !apache2? ( !<net-www/apache-1.3.26-r2 <net-www/apache-2 )"
#
EXPORT_FUNCTIONS has_apache2 httpd_getvar httpd_user httpd_group httpd_root
# Return the string 2 on success, nothing otherwise
has_apache2() {
ret="";
# The use flag overrides all.
if [ `use apache2` ]; then
ret=2
else
if [ `has_version '>=net-www/apache-2'` ]; then
# If user has apache 1 & 2 installed and use
# `use apache2` was not set then we should pref apache1
if [ `has_version '<net-www/apache-2'` ]; then
ret=""
else
ret=2
fi
fi
fi
echo -n "${ret}"
}
# Wrapper function to grep for string from file.
httpd_getvar() {
name=$1
conf=$2
[ ! -f "${conf}" ] && die "$conf: No such file or directory"
v=$(grep ^${name} ${conf} | gawk '{print $2}' | head -1)
echo -n "${v}";
}
# Get apache User / should return apache
httpd_user() {
ap=$(has_apache2)
conf="/etc/apache${ap}/conf/commonapache${ap}.conf"
httpd_getvar User ${conf}
}
# Get apache Group / should return apache
httpd_group() {
ap=$(has_apache2)
conf="/etc/apache${ap}/conf/commonapache${ap}.conf"
httpd_getvar Group ${conf}
}
# Get apache DocumentRoot
httpd_root() {
ap=$(has_apache2)
conf=/etc/apache${ap}/conf/apache${ap}.conf
httpd_getvar DocumentRoot ${conf}
}
httpd_user=`httpd_user`
httpd_group=`httpd_group`
httpd_root=`httpd_root`
# fallbacks
[ -z "${httpd_user}" ] && httpd_user="apache"
[ -z "${httpd_group}" ] && httpd_group="apache"
[ -z "${httpd_root}" ] && httpd_root="/home/httpd/htdocs"
# Mark readonly so other ebuilds dont override.
declare -r HTTPD_USER=${httpd_user};
declare -r HTTPD_GROUP=${httpd_group};
declare -r HTTPD_ROOT=${httpd_root}
export HTTPD_USER
export HTTPD_GROUP
export HTTPD_ROOT
unset httpd_user
unset httpd_group
unset httpd_root
#set +x
[-- Attachment #3: Type: text/plain, Size: 37 bytes --]
--
gentoo-dev@gentoo.org mailing list
next reply other threads:[~2003-06-08 10:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-08 10:12 Ned Ludd [this message]
2003-06-08 19:45 ` [gentoo-dev] apache.eclass proposed Robin H.Johnson
2003-06-08 19:50 ` Paul de Vrieze
2003-06-09 3:07 ` Ned Ludd
2003-06-09 6:01 ` Robin H.Johnson
2003-06-09 17:23 ` Brad Laue
2003-06-10 3:02 ` Donny Davies
2003-06-10 5:43 ` Robin H.Johnson
2003-06-12 0:13 ` Stewart
-- strict thread matches above, loose matches on Subject: below --
2003-06-08 14:32 Joshua Brindle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1055067141.13370.109.camel@simple \
--to=solar@gentoo.org \
--cc=gentoo-dev@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox