mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-04 14:39:54 +00:00
apache2: fix service start fail
reproduce steps: 1. boot up target 2. scp apache2-2.4.41-r0.1.aarch64.rpm on target 3. rpm -i apache2-2.4.41-r0.1.aarch64.rpm 4. systemctl status apache2 Error: httpd[7767]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log with the old way, /var/log/apache2/ is created by service systemd-tmpfiles-setup during boot, so only works when apache2 already installed before boot, in above scenario, /var/log/apache2/ will not created. fix by creating it in the service file. similar fix for sysV system Signed-off-by: Changqing Li <changqing.li@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
@@ -20,9 +20,7 @@ SRC_URI = "${APACHE_MIRROR}/httpd/httpd-${PV}.tar.bz2 \
|
|||||||
SRC_URI_append_class-target = " \
|
SRC_URI_append_class-target = " \
|
||||||
file://0008-apache2-do-not-use-relative-path-for-gen_test_char.patch \
|
file://0008-apache2-do-not-use-relative-path-for-gen_test_char.patch \
|
||||||
file://init \
|
file://init \
|
||||||
file://apache2-volatile.conf \
|
|
||||||
file://apache2.service \
|
file://apache2.service \
|
||||||
file://volatiles.04_apache2 \
|
|
||||||
"
|
"
|
||||||
|
|
||||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=bddeddfac80b2c9a882241d008bb41c3"
|
LIC_FILES_CHKSUM = "file://LICENSE;md5=bddeddfac80b2c9a882241d008bb41c3"
|
||||||
@@ -128,16 +126,10 @@ do_install_append_class-target() {
|
|||||||
-e 's,".*/configure","configure",g' ${D}${datadir}/apache2/build/config.nice
|
-e 's,".*/configure","configure",g' ${D}${datadir}/apache2/build/config.nice
|
||||||
|
|
||||||
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
|
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
|
||||||
install -d ${D}${sysconfdir}/tmpfiles.d/
|
|
||||||
install -m 0644 ${WORKDIR}/apache2-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
|
|
||||||
|
|
||||||
install -d ${D}${systemd_unitdir}/system
|
install -d ${D}${systemd_unitdir}/system
|
||||||
install -m 0644 ${WORKDIR}/apache2.service ${D}${systemd_unitdir}/system
|
install -m 0644 ${WORKDIR}/apache2.service ${D}${systemd_unitdir}/system
|
||||||
sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/apache2.service
|
sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/apache2.service
|
||||||
sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/apache2.service
|
sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/apache2.service
|
||||||
elif ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
|
|
||||||
install -d ${D}${sysconfdir}/default/volatiles
|
|
||||||
install -m 0644 ${WORKDIR}/volatiles.04_apache2 ${D}${sysconfdir}/default/volatiles/04_apache2
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf ${D}${localstatedir} ${D}${sbindir}/envvars*
|
rm -rf ${D}${localstatedir} ${D}${sbindir}/envvars*
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
d /var/run/apache2 0755 root root -
|
|
||||||
d /var/log/apache2 0755 root root -
|
|
||||||
@@ -5,6 +5,10 @@ After=network.target remote-fs.target nss-lookup.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Environment=LANG=C
|
Environment=LANG=C
|
||||||
|
ExecStartPre=mkdir -p /var/log/apache2
|
||||||
|
ExecStartPre=mkdir -p /var/run/apache2
|
||||||
|
ExecStartPre=chmod -R 0755 /var/log/apache2
|
||||||
|
ExecStartPre=chmod -R 0755 /var/run/apache2
|
||||||
ExecStart=@SBINDIR@/httpd -DFOREGROUND -D SSL -D PHP5 -k start
|
ExecStart=@SBINDIR@/httpd -DFOREGROUND -D SSL -D PHP5 -k start
|
||||||
ExecStop=@BASE_BINDIR@/kill -WINCH ${MAINPID}
|
ExecStop=@BASE_BINDIR@/kill -WINCH ${MAINPID}
|
||||||
KillSignal=SIGCONT
|
KillSignal=SIGCONT
|
||||||
|
|||||||
@@ -97,6 +97,11 @@ do_start()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p /var/log/apache2
|
||||||
|
chmod -R 0755 /var/log/apache2
|
||||||
|
mkdir -p /var/run/apache2
|
||||||
|
chmod -R 0755 /var/run/apache2
|
||||||
|
|
||||||
if apache_conftest ; then
|
if apache_conftest ; then
|
||||||
$APACHECTL start
|
$APACHECTL start
|
||||||
apache_wait_start $?
|
apache_wait_start $?
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# <type> <owner> <group> <mode> <path> <linksource>
|
|
||||||
d root root 0755 /var/run/apache2 none
|
|
||||||
d root root 0755 /var/log/apache2 none
|
|
||||||
Reference in New Issue
Block a user