From 09d9e87da8e4058a8c16dbe643879745204f2ba7 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 1 May 2016 09:09:38 +0200 Subject: [PATCH] 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. --- srcpkgs/apache/files/apache/run | 24 +++++++++++-- srcpkgs/apache/files/xbps.layout | 6 ++-- srcpkgs/apache/template | 58 ++++++++++++-------------------- 3 files changed, 46 insertions(+), 42 deletions(-) mode change 100755 => 100644 srcpkgs/apache/files/apache/run diff --git a/srcpkgs/apache/files/apache/run b/srcpkgs/apache/files/apache/run old mode 100755 new mode 100644 index 5fcf6470fb..fc946ed113 --- a/srcpkgs/apache/files/apache/run +++ b/srcpkgs/apache/files/apache/run @@ -1,5 +1,23 @@ #!/bin/sh -mkdir -p /run/httpd || exit 1 -chmod 0710 /run/httpd || exit 1 -chown root:httpd /run/httpd || exit 1 + +set -e + +[ -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 diff --git a/srcpkgs/apache/files/xbps.layout b/srcpkgs/apache/files/xbps.layout index 4b0ce78c9a..30a32dd8d6 100644 --- a/srcpkgs/apache/files/xbps.layout +++ b/srcpkgs/apache/files/xbps.layout @@ -6,12 +6,12 @@ libdir: ${exec_prefix}/lib libexecdir: ${exec_prefix}/libexec/httpd mandir: ${exec_prefix}/share/man - sysconfdir: /etc/httpd - datadir: ${exec_prefix}/share/apache-httpd + sysconfdir: /etc/apache + datadir: ${exec_prefix}/share/apache/webroot installbuilddir:${datadir}/build errordir: ${datadir}/error iconsdir: ${datadir}/icons - htdocsdir: /srv/httpd + htdocsdir: /srv/www/apache manualdir: ${datadir}/manual cgidir: ${htdocsdir}/cgi-bin includedir: ${exec_prefix}/include/httpd diff --git a/srcpkgs/apache/template b/srcpkgs/apache/template index 3d88bf7682..c63109f5ca 100644 --- a/srcpkgs/apache/template +++ b/srcpkgs/apache/template @@ -1,7 +1,7 @@ # Template file for 'apache' pkgname=apache version=2.4.20 -revision=1 +revision=2 wrksrc=httpd-${version} build_style=gnu-configure 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-dav --enable-info --enable-cgi --enable-cgid --enable-dav-fs --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" hostmakedepends="pkg-config perl" makedepends="zlib-devel libuuid-devel pcre-devel nghttp2-devel libressl-devel db-devel gdbm-devel expat-devel libldap-devel apr-util-devel" conf_files=" - /etc/httpd/extra/*.conf - /etc/httpd/httpd.conf - /etc/httpd/magic - /etc/httpd/mime.types" + /etc/${pkgname}/extra/*.conf + /etc/${pkgname}/httpd.conf + /etc/${pkgname}/magic + /etc/${pkgname}/mime.types" short_desc="The Number One HTTP Server On The Internet" maintainer="Juan RP " homepage="http://httpd.apache.org/" @@ -35,19 +35,13 @@ license="Apache-2.0" distfiles="http://www.apache.org/dist/httpd/httpd-${version}.tar.bz2" checksum=0e76a375ed3dbac636f50ac39de966ece443751fe4d62392f9a360a19d94d0da -system_accounts="httpd" -httpd_descr="Apache HTTP server" -httpd_homedir="/srv/httpd" - -make_dirs=" - /var/log/httpd 0755 root httpd - /srv/httpd 0755 root httpd - /srv/httpd/cgi-bin 755 root httpd" +system_accounts="_$pkgname" +_apache_homedir="/srv/www/$pkgname" pre_configure() { # set default user - sed -e 's#User daemon#User httpd#' \ - -e 's#Group daemon#Group httpd#' \ + sed -e 's#User daemon#User _apache#' \ + -e 's#Group daemon#Group _apache#' \ -i docs/conf/httpd.conf.in cat ${FILESDIR}/xbps.layout >> config.layout @@ -75,36 +69,28 @@ post_install() { # * httpd-default.conf # 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 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 negotiation_module /usr/libexec/httpd/mod_negotiation.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|#\(Include /etc/httpd/extra/httpd-multilang-errordoc.conf\)|\1|' \ - -e 's|#\(Include /etc/httpd/extra/httpd-autoindex.conf\)|\1|' \ - -e 's|#\(Include /etc/httpd/extra/httpd-languages.conf\)|\1|' \ - -e 's|#\(Include /etc/httpd/extra/httpd-userdir.conf\)|\1|' \ - -e 's|#\(Include /etc/httpd/extra/httpd-default.conf\)|\1|' \ - -i "${DESTDIR}/etc/httpd/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 + -e 's|#\(Include /etc/apache/extra/httpd-multilang-errordoc.conf\)|\1|' \ + -e 's|#\(Include /etc/apache/extra/httpd-autoindex.conf\)|\1|' \ + -e 's|#\(Include /etc/apache/extra/httpd-languages.conf\)|\1|' \ + -e 's|#\(Include /etc/apache/extra/httpd-userdir.conf\)|\1|' \ + -e 's|#\(Include /etc/apache/extra/httpd-default.conf\)|\1|' \ + -i "${DESTDIR}/etc/apache/httpd.conf" # Remove unused stuff. - mv ${DESTDIR}/srv/httpd/cgi-bin ${DESTDIR}/usr/share/apache-httpd - rm -rf ${DESTDIR}/srv/httpd + vmkdir usr/share/apache/webroot + 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 - vsv apache - - rm -rf ${DESTDIR}/etc/httpd/original } apache-devel_package() { @@ -112,7 +98,7 @@ apache-devel_package() { short_desc+=" - development files" pkg_install() { vmove usr/include - vmove usr/share/apache-httpd/build + vmove usr/share/apache/webroot/build vmove usr/bin/apxs vmove "usr/share/man/man1/apxs*" }