diff options
author | Yi Zhao <yi.zhao@windriver.com> | 2020-05-22 10:54:49 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2020-05-21 20:16:40 -0700 |
commit | 6f4d0dbfbc7d5ab8c5781379884f41d30cb6db25 (patch) | |
tree | 3f5eb568f7d003cc816d9b59d94424fb275c9bdf /meta-webserver | |
parent | 64469492b0c252457c9cf462c67373afeb33afc6 (diff) | |
download | meta-openembedded-6f4d0dbfbc7d5ab8c5781379884f41d30cb6db25.tar.gz |
apache2: create log/run directory via pkg_postinst
The commit e789c3837ca8d65abb4bac29dc2e5c595c8ce05b tries to create
log/run directory in initscript/systemd unit file. This is not a correct
method. We should create them in pkg_postinst.
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-webserver')
5 files changed, 23 insertions, 9 deletions
diff --git a/meta-webserver/recipes-httpd/apache2/apache2_2.4.43.bb b/meta-webserver/recipes-httpd/apache2/apache2_2.4.43.bb index 9b80bbff6..a7083d80e 100644 --- a/meta-webserver/recipes-httpd/apache2/apache2_2.4.43.bb +++ b/meta-webserver/recipes-httpd/apache2/apache2_2.4.43.bb | |||
@@ -20,7 +20,9 @@ SRC_URI = "${APACHE_MIRROR}/httpd/httpd-${PV}.tar.bz2 \ | |||
20 | SRC_URI_append_class-target = " \ | 20 | SRC_URI_append_class-target = " \ |
21 | file://0008-apache2-do-not-use-relative-path-for-gen_test_char.patch \ | 21 | file://0008-apache2-do-not-use-relative-path-for-gen_test_char.patch \ |
22 | file://init \ | 22 | file://init \ |
23 | file://apache2-volatile.conf \ | ||
23 | file://apache2.service \ | 24 | file://apache2.service \ |
25 | file://volatiles.04_apache2 \ | ||
24 | " | 26 | " |
25 | 27 | ||
26 | LIC_FILES_CHKSUM = "file://LICENSE;md5=bddeddfac80b2c9a882241d008bb41c3" | 28 | LIC_FILES_CHKSUM = "file://LICENSE;md5=bddeddfac80b2c9a882241d008bb41c3" |
@@ -126,10 +128,16 @@ do_install_append_class-target() { | |||
126 | -e 's,".*/configure","configure",g' ${D}${datadir}/apache2/build/config.nice | 128 | -e 's,".*/configure","configure",g' ${D}${datadir}/apache2/build/config.nice |
127 | 129 | ||
128 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | 130 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
131 | install -d ${D}${sysconfdir}/tmpfiles.d/ | ||
132 | install -m 0644 ${WORKDIR}/apache2-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ | ||
133 | |||
129 | install -d ${D}${systemd_unitdir}/system | 134 | install -d ${D}${systemd_unitdir}/system |
130 | install -m 0644 ${WORKDIR}/apache2.service ${D}${systemd_unitdir}/system | 135 | install -m 0644 ${WORKDIR}/apache2.service ${D}${systemd_unitdir}/system |
131 | sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/apache2.service | 136 | sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/apache2.service |
132 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/apache2.service | 137 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/apache2.service |
138 | elif ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
139 | install -d ${D}${sysconfdir}/default/volatiles | ||
140 | install -m 0644 ${WORKDIR}/volatiles.04_apache2 ${D}${sysconfdir}/default/volatiles/04_apache2 | ||
133 | fi | 141 | fi |
134 | 142 | ||
135 | rm -rf ${D}${localstatedir} ${D}${sbindir}/envvars* | 143 | rm -rf ${D}${localstatedir} ${D}${sbindir}/envvars* |
@@ -206,3 +214,13 @@ RDEPENDS_${PN}-scripts += "perl ${PN}" | |||
206 | RDEPENDS_${PN}-dev = "perl" | 214 | RDEPENDS_${PN}-dev = "perl" |
207 | 215 | ||
208 | BBCLASSEXTEND = "native" | 216 | BBCLASSEXTEND = "native" |
217 | |||
218 | pkg_postinst_${PN}() { | ||
219 | if [ -z "$D" ]; then | ||
220 | if type systemd-tmpfiles >/dev/null; then | ||
221 | systemd-tmpfiles --create | ||
222 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then | ||
223 | ${sysconfdir}/init.d/populate-volatile.sh update | ||
224 | fi | ||
225 | fi | ||
226 | } | ||
diff --git a/meta-webserver/recipes-httpd/apache2/files/apache2-volatile.conf b/meta-webserver/recipes-httpd/apache2/files/apache2-volatile.conf new file mode 100644 index 000000000..ff2c58704 --- /dev/null +++ b/meta-webserver/recipes-httpd/apache2/files/apache2-volatile.conf | |||
@@ -0,0 +1,2 @@ | |||
1 | d /var/run/apache2 0755 root root - | ||
2 | d /var/log/apache2 0755 root root - | ||
diff --git a/meta-webserver/recipes-httpd/apache2/files/apache2.service b/meta-webserver/recipes-httpd/apache2/files/apache2.service index 25d43acf8..9b5548c76 100644 --- a/meta-webserver/recipes-httpd/apache2/files/apache2.service +++ b/meta-webserver/recipes-httpd/apache2/files/apache2.service | |||
@@ -5,10 +5,6 @@ After=network.target remote-fs.target nss-lookup.target | |||
5 | [Service] | 5 | [Service] |
6 | Type=simple | 6 | Type=simple |
7 | Environment=LANG=C | 7 | Environment=LANG=C |
8 | ExecStartPre=mkdir -p /var/log/apache2 | ||
9 | ExecStartPre=mkdir -p /var/run/apache2 | ||
10 | ExecStartPre=chmod -R 0755 /var/log/apache2 | ||
11 | ExecStartPre=chmod -R 0755 /var/run/apache2 | ||
12 | ExecStart=@SBINDIR@/httpd -DFOREGROUND -D SSL -D PHP5 -k start | 8 | ExecStart=@SBINDIR@/httpd -DFOREGROUND -D SSL -D PHP5 -k start |
13 | ExecStop=@BASE_BINDIR@/kill -WINCH ${MAINPID} | 9 | ExecStop=@BASE_BINDIR@/kill -WINCH ${MAINPID} |
14 | KillSignal=SIGCONT | 10 | KillSignal=SIGCONT |
diff --git a/meta-webserver/recipes-httpd/apache2/files/init b/meta-webserver/recipes-httpd/apache2/files/init index 80a7ebfcb..758d133b9 100644 --- a/meta-webserver/recipes-httpd/apache2/files/init +++ b/meta-webserver/recipes-httpd/apache2/files/init | |||
@@ -97,11 +97,6 @@ do_start() | |||
97 | return 1 | 97 | return 1 |
98 | fi | 98 | fi |
99 | 99 | ||
100 | mkdir -p /var/log/apache2 | ||
101 | chmod -R 0755 /var/log/apache2 | ||
102 | mkdir -p /var/run/apache2 | ||
103 | chmod -R 0755 /var/run/apache2 | ||
104 | |||
105 | if apache_conftest ; then | 100 | if apache_conftest ; then |
106 | $APACHECTL start | 101 | $APACHECTL start |
107 | apache_wait_start $? | 102 | apache_wait_start $? |
diff --git a/meta-webserver/recipes-httpd/apache2/files/volatiles.04_apache2 b/meta-webserver/recipes-httpd/apache2/files/volatiles.04_apache2 new file mode 100644 index 000000000..922075b1b --- /dev/null +++ b/meta-webserver/recipes-httpd/apache2/files/volatiles.04_apache2 | |||
@@ -0,0 +1,3 @@ | |||
1 | # <type> <owner> <group> <mode> <path> <linksource> | ||
2 | d root root 0755 /var/run/apache2 none | ||
3 | d root root 0755 /var/log/apache2 none | ||