apache: multiple changes to normalize www pkg rules.

- Switch system account to "_apache".
- Switch sysconfdir to "/etc/apache".
- Switch default webrootdir to "/srv/www/apache"
- Webroot files are installed to "/usr/share/apache/webroot".
- Create logdir and webrootdir in the runit script.
This commit is contained in:
Juan RP 2016-05-01 09:09:38 +02:00
parent 5273b0aef1
commit 09d9e87da8
3 changed files with 46 additions and 42 deletions

24
srcpkgs/apache/files/apache/run Executable file → Normal file
View file

@ -1,5 +1,23 @@
#!/bin/sh #!/bin/sh
mkdir -p /run/httpd || exit 1
chmod 0710 /run/httpd || exit 1 set -e
chown root:httpd /run/httpd || exit 1
[ -s conf ] && . ./conf
mkdir -p /run/httpd
chmod 0710 /run/httpd
chown root:_apache /run/httpd
: ${ROOTDIR:=/srv/www/apache}
: ${LOGDIR:=/var/log/httpd}
if [ ! -d $ROOTDIR ]; then
mkdir -p $ROOTDIR
chown _apache:_apache $ROOTDIR
fi
if [ ! -d $LOGDIR ]; then
mkdir -p $LOGDIR
chown _apache:_apache $LOGDIR
fi
exec httpd -DNO_DETACH exec httpd -DNO_DETACH

View file

@ -6,12 +6,12 @@
libdir: ${exec_prefix}/lib libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec/httpd libexecdir: ${exec_prefix}/libexec/httpd
mandir: ${exec_prefix}/share/man mandir: ${exec_prefix}/share/man
sysconfdir: /etc/httpd sysconfdir: /etc/apache
datadir: ${exec_prefix}/share/apache-httpd datadir: ${exec_prefix}/share/apache/webroot
installbuilddir:${datadir}/build installbuilddir:${datadir}/build
errordir: ${datadir}/error errordir: ${datadir}/error
iconsdir: ${datadir}/icons iconsdir: ${datadir}/icons
htdocsdir: /srv/httpd htdocsdir: /srv/www/apache
manualdir: ${datadir}/manual manualdir: ${datadir}/manual
cgidir: ${htdocsdir}/cgi-bin cgidir: ${htdocsdir}/cgi-bin
includedir: ${exec_prefix}/include/httpd includedir: ${exec_prefix}/include/httpd

View file

@ -1,7 +1,7 @@
# Template file for 'apache' # Template file for 'apache'
pkgname=apache pkgname=apache
version=2.4.20 version=2.4.20
revision=1 revision=2
wrksrc=httpd-${version} wrksrc=httpd-${version}
build_style=gnu-configure build_style=gnu-configure
configure_args="--prefix= --sbindir=/usr/bin --enable-pie --enable-modules=all configure_args="--prefix= --sbindir=/usr/bin --enable-pie --enable-modules=all
@ -18,16 +18,16 @@ configure_args="--prefix= --sbindir=/usr/bin --enable-pie --enable-modules=all
--enable-proxy-balancer --enable-ssl --enable-http --enable-speling --enable-proxy-balancer --enable-ssl --enable-http --enable-speling
--enable-dav --enable-info --enable-cgi --enable-cgid --enable-dav-fs --enable-dav --enable-info --enable-cgi --enable-cgid --enable-dav-fs
--enable-dav-lock --enable-vhost-alias --enable-imagemap --enable-so --enable-dav-lock --enable-vhost-alias --enable-imagemap --enable-so
--enable-rewrite --with-pcre=/usr --enable-layout=XBPS --sysconfdir=/etc/httpd --enable-rewrite --with-pcre=/usr --enable-layout=XBPS --sysconfdir=/etc/${pkgname}
--enable-mpms-shared=all" --enable-mpms-shared=all"
hostmakedepends="pkg-config perl" hostmakedepends="pkg-config perl"
makedepends="zlib-devel libuuid-devel pcre-devel nghttp2-devel makedepends="zlib-devel libuuid-devel pcre-devel nghttp2-devel
libressl-devel db-devel gdbm-devel expat-devel libldap-devel apr-util-devel" libressl-devel db-devel gdbm-devel expat-devel libldap-devel apr-util-devel"
conf_files=" conf_files="
/etc/httpd/extra/*.conf /etc/${pkgname}/extra/*.conf
/etc/httpd/httpd.conf /etc/${pkgname}/httpd.conf
/etc/httpd/magic /etc/${pkgname}/magic
/etc/httpd/mime.types" /etc/${pkgname}/mime.types"
short_desc="The Number One HTTP Server On The Internet" short_desc="The Number One HTTP Server On The Internet"
maintainer="Juan RP <xtraeme@voidlinux.eu>" maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://httpd.apache.org/" homepage="http://httpd.apache.org/"
@ -35,19 +35,13 @@ license="Apache-2.0"
distfiles="http://www.apache.org/dist/httpd/httpd-${version}.tar.bz2" distfiles="http://www.apache.org/dist/httpd/httpd-${version}.tar.bz2"
checksum=0e76a375ed3dbac636f50ac39de966ece443751fe4d62392f9a360a19d94d0da checksum=0e76a375ed3dbac636f50ac39de966ece443751fe4d62392f9a360a19d94d0da
system_accounts="httpd" system_accounts="_$pkgname"
httpd_descr="Apache HTTP server" _apache_homedir="/srv/www/$pkgname"
httpd_homedir="/srv/httpd"
make_dirs="
/var/log/httpd 0755 root httpd
/srv/httpd 0755 root httpd
/srv/httpd/cgi-bin 755 root httpd"
pre_configure() { pre_configure() {
# set default user # set default user
sed -e 's#User daemon#User httpd#' \ sed -e 's#User daemon#User _apache#' \
-e 's#Group daemon#Group httpd#' \ -e 's#Group daemon#Group _apache#' \
-i docs/conf/httpd.conf.in -i docs/conf/httpd.conf.in
cat ${FILESDIR}/xbps.layout >> config.layout cat ${FILESDIR}/xbps.layout >> config.layout
@ -75,36 +69,28 @@ post_install() {
# * httpd-default.conf # * httpd-default.conf
# #
sed \ sed \
-e 's|ServerRoot ""|ServerRoot "/etc/httpd"|' \ -e 's|ServerRoot ""|ServerRoot "/srv/www/apache"|' \
-e 's|#\(LoadModule include_module /usr/libexec/httpd/mod_include.so\)|\1|' \ -e 's|#\(LoadModule include_module /usr/libexec/httpd/mod_include.so\)|\1|' \
-e 's|\(LoadModule unique_id_module /usr/libexec/httpd/mod_unique_id.so\)|#\1|' \ -e 's|\(LoadModule unique_id_module /usr/libexec/httpd/mod_unique_id.so\)|#\1|' \
-e 's|#\(LoadModule slotmem_shm_module /usr/libexec/httpd/mod_slotmem_shm.so\)|\1|' \ -e 's|#\(LoadModule slotmem_shm_module /usr/libexec/httpd/mod_slotmem_shm.so\)|\1|' \
-e 's|#\(LoadModule negotiation_module /usr/libexec/httpd/mod_negotiation.so\)|\1|' \ -e 's|#\(LoadModule negotiation_module /usr/libexec/httpd/mod_negotiation.so\)|\1|' \
-e 's|#\(LoadModule userdir_module /usr/libexec/httpd/mod_userdir.so\)|\1|' \ -e 's|#\(LoadModule userdir_module /usr/libexec/httpd/mod_userdir.so\)|\1|' \
-e 's|#ServerName www.example.com:80|ServerName 127.0.0.1:80|' \ -e 's|#ServerName www.example.com:80|ServerName 127.0.0.1:80|' \
-e 's|#\(Include /etc/httpd/extra/httpd-multilang-errordoc.conf\)|\1|' \ -e 's|#\(Include /etc/apache/extra/httpd-multilang-errordoc.conf\)|\1|' \
-e 's|#\(Include /etc/httpd/extra/httpd-autoindex.conf\)|\1|' \ -e 's|#\(Include /etc/apache/extra/httpd-autoindex.conf\)|\1|' \
-e 's|#\(Include /etc/httpd/extra/httpd-languages.conf\)|\1|' \ -e 's|#\(Include /etc/apache/extra/httpd-languages.conf\)|\1|' \
-e 's|#\(Include /etc/httpd/extra/httpd-userdir.conf\)|\1|' \ -e 's|#\(Include /etc/apache/extra/httpd-userdir.conf\)|\1|' \
-e 's|#\(Include /etc/httpd/extra/httpd-default.conf\)|\1|' \ -e 's|#\(Include /etc/apache/extra/httpd-default.conf\)|\1|' \
-i "${DESTDIR}/etc/httpd/httpd.conf" -i "${DESTDIR}/etc/apache/httpd.conf"
# symlinks for /etc/httpd
ln -fs /var/log/httpd ${DESTDIR}/etc/httpd/logs
ln -fs /var/run/httpd ${DESTDIR}/etc/httpd/run
ln -fs /usr/libexec/httpd ${DESTDIR}/etc/httpd/modules
ln -fs /usr/share/apache-httpd/build ${DESTDIR}/etc/httpd/build
# Remove unused stuff. # Remove unused stuff.
mv ${DESTDIR}/srv/httpd/cgi-bin ${DESTDIR}/usr/share/apache-httpd vmkdir usr/share/apache/webroot
rm -rf ${DESTDIR}/srv/httpd mv ${DESTDIR}/srv/www/$pkgname/cgi-bin ${DESTDIR}/usr/share/apache/webroot
rm -rf ${DESTDIR}/srv
rm -rf ${DESTDIR}/etc/$pkgname/original
# systemd and logrotate files.
vinstall ${FILESDIR}/apache.logrotate 644 etc/logrotate.d apache vinstall ${FILESDIR}/apache.logrotate 644 etc/logrotate.d apache
vsv apache vsv apache
rm -rf ${DESTDIR}/etc/httpd/original
} }
apache-devel_package() { apache-devel_package() {
@ -112,7 +98,7 @@ apache-devel_package() {
short_desc+=" - development files" short_desc+=" - development files"
pkg_install() { pkg_install() {
vmove usr/include vmove usr/include
vmove usr/share/apache-httpd/build vmove usr/share/apache/webroot/build
vmove usr/bin/apxs vmove usr/bin/apxs
vmove "usr/share/man/man1/apxs*" vmove "usr/share/man/man1/apxs*"
} }