summaryrefslogtreecommitdiffstats
path: root/meta-webserver/recipes-httpd/sthttpd
diff options
context:
space:
mode:
authorJack Mitchell <jmitchell@cbnl.com>2014-06-16 17:40:29 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2014-06-21 10:36:53 +0200
commit117716e668fee5910df7f06a9b2b57bf0ad5285a (patch)
tree30ac9a3d358d901b5f674f2be54a6554a182a091 /meta-webserver/recipes-httpd/sthttpd
parenta6eaef942529ed9fc511bd86dd00369862297b26 (diff)
downloadmeta-openembedded-117716e668fee5910df7f06a9b2b57bf0ad5285a.tar.gz
sthttpd: improve init scripts to use config file
Rather than put hardcoded values into the init scripts, use a config file. The SRV_DIR is a special value as it should be used in the conifg file and also passed to make so it can put the html files in the correct directory. Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-webserver/recipes-httpd/sthttpd')
-rw-r--r--meta-webserver/recipes-httpd/sthttpd/sthttpd/init6
-rw-r--r--meta-webserver/recipes-httpd/sthttpd/sthttpd/thttpd.conf1
-rw-r--r--meta-webserver/recipes-httpd/sthttpd/sthttpd/thttpd.service2
-rw-r--r--meta-webserver/recipes-httpd/sthttpd/sthttpd_2.26.4.bb15
4 files changed, 15 insertions, 9 deletions
diff --git a/meta-webserver/recipes-httpd/sthttpd/sthttpd/init b/meta-webserver/recipes-httpd/sthttpd/sthttpd/init
index 70f6797a7..f5f7b0124 100644
--- a/meta-webserver/recipes-httpd/sthttpd/sthttpd/init
+++ b/meta-webserver/recipes-httpd/sthttpd/sthttpd/init
@@ -18,7 +18,7 @@ test -x "$thttpd" || exit 0
18case "$1" in 18case "$1" in
19 start) 19 start)
20 echo -n "Starting thttpd" 20 echo -n "Starting thttpd"
21 start-stop-daemon --start --quiet --exec $thttpd -- -d @@SRVDIR 21 start-stop-daemon --start --quiet --exec $thttpd -- -C @@CONFFILE
22 echo "." 22 echo "."
23 ;; 23 ;;
24 stop) 24 stop)
@@ -31,7 +31,7 @@ case "$1" in
31 ;; 31 ;;
32 restart) 32 restart)
33 echo -n "Stopping thttpd" 33 echo -n "Stopping thttpd"
34 start-stop-daemon --stop --quiet --exec $thttpd -- -d @@SRVDIR 34 start-stop-daemon --stop --quiet --exec $thttpd -- -C @@CONFFILE
35 echo "." 35 echo "."
36 echo -n "Waiting for thttpd to die off" 36 echo -n "Waiting for thttpd to die off"
37 for i in 1 2 3 ; 37 for i in 1 2 3 ;
@@ -41,7 +41,7 @@ case "$1" in
41 done 41 done
42 echo "" 42 echo ""
43 echo -n "Starting thttpd" 43 echo -n "Starting thttpd"
44 start-stop-daemon --start --quiet --exec $thttpd -- -d @@SRVDIR 44 start-stop-daemon --start --quiet --exec $thttpd -- -C @@CONFFILE
45 echo "." 45 echo "."
46 ;; 46 ;;
47 *) 47 *)
diff --git a/meta-webserver/recipes-httpd/sthttpd/sthttpd/thttpd.conf b/meta-webserver/recipes-httpd/sthttpd/sthttpd/thttpd.conf
new file mode 100644
index 000000000..397984f36
--- /dev/null
+++ b/meta-webserver/recipes-httpd/sthttpd/sthttpd/thttpd.conf
@@ -0,0 +1 @@
dir=@@SRVDIR
diff --git a/meta-webserver/recipes-httpd/sthttpd/sthttpd/thttpd.service b/meta-webserver/recipes-httpd/sthttpd/sthttpd/thttpd.service
index e2dae61fd..f1095007c 100644
--- a/meta-webserver/recipes-httpd/sthttpd/sthttpd/thttpd.service
+++ b/meta-webserver/recipes-httpd/sthttpd/sthttpd/thttpd.service
@@ -3,7 +3,7 @@ Description=Tiny/Turbo/Throttling Web Server
3 3
4[Service] 4[Service]
5Type=forking 5Type=forking
6ExecStart=/usr/sbin/thttpd -d @@SRVDIR -c cgi-bin/* -i /var/run/thttpd.pid 6ExecStart=/usr/sbin/thttpd -C @@CONFFILE -c cgi-bin/* -i /var/run/thttpd.pid
7PIDFile=/var/run/thttpd.pid 7PIDFile=/var/run/thttpd.pid
8 8
9[Install] 9[Install]
diff --git a/meta-webserver/recipes-httpd/sthttpd/sthttpd_2.26.4.bb b/meta-webserver/recipes-httpd/sthttpd/sthttpd_2.26.4.bb
index 0abd13169..703492167 100644
--- a/meta-webserver/recipes-httpd/sthttpd/sthttpd_2.26.4.bb
+++ b/meta-webserver/recipes-httpd/sthttpd/sthttpd_2.26.4.bb
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://src/thttpd.c;beginline=1;endline=26;md5=0c5762c2c34dc
6 6
7SRC_URI = "http://opensource.dyc.edu/pub/sthttpd/sthttpd-${PV}.tar.gz \ 7SRC_URI = "http://opensource.dyc.edu/pub/sthttpd/sthttpd-${PV}.tar.gz \
8 file://thttpd.service \ 8 file://thttpd.service \
9 file://thttpd.conf \
9 file://init" 10 file://init"
10 11
11SRC_URI[md5sum] = "e645a85a97d3cb883011a35bc2211815" 12SRC_URI[md5sum] = "e645a85a97d3cb883011a35bc2211815"
@@ -15,19 +16,23 @@ S = "${WORKDIR}/sthttpd-${PV}"
15 16
16inherit autotools update-rc.d systemd 17inherit autotools update-rc.d systemd
17 18
18EXTRA_OEMAKE += "'WEBDIR=${servicedir}/www'" 19SRV_DIR ?= "${servicedir}/www"
20
21EXTRA_OEMAKE += "'WEBDIR=${SRV_DIR}'"
19 22
20do_install_append () { 23do_install_append () {
21 install -d ${D}${sysconfdir}/init.d 24 install -d ${D}${sysconfdir}/init.d
22 install -c -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/thttpd 25 install -c -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/thttpd
23 sed -i -e 's,@@SRVDIR,${servicedir}/www,g' ${D}${sysconfdir}/init.d/thttpd 26 install -c -m 755 ${WORKDIR}/thttpd.conf ${D}${sysconfdir}
27 sed -i -e 's,@@CONFFILE,${sysconfdir}/thttpd.conf,g' ${D}${sysconfdir}/init.d/thttpd
28 sed -i -e 's,@@SRVDIR,${SRV_DIR},g' ${D}${sysconfdir}/thttpd.conf
24 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/thttpd 29 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/thttpd
25 30
26 install -d ${D}${systemd_unitdir}/system 31 install -d ${D}${systemd_unitdir}/system
27 install -m 0644 ${WORKDIR}/thttpd.service ${D}${systemd_unitdir}/system 32 install -m 0644 ${WORKDIR}/thttpd.service ${D}${systemd_unitdir}/system
28 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${systemd_unitdir}/system/thttpd.service 33 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${systemd_unitdir}/system/thttpd.service
29 sed -i 's!/var/!${localstatedir}/!g' ${D}${systemd_unitdir}/system/thttpd.service 34 sed -i 's!/var/!${localstatedir}/!g' ${D}${systemd_unitdir}/system/thttpd.service
30 sed -i -e 's,@@SRVDIR,${servicedir}/www,g' ${D}${systemd_unitdir}/system/thttpd.service 35 sed -i -e 's,@@CONFFILE,${sysconfdir}/thttpd.conf,g' ${D}${systemd_unitdir}/system/thttpd.service
31} 36}
32 37
33INITSCRIPT_NAME = "thttpd" 38INITSCRIPT_NAME = "thttpd"
@@ -35,6 +40,6 @@ INITSCRIPT_PARAMS = "defaults"
35 40
36SYSTEMD_SERVICE_${PN} = "thttpd.service" 41SYSTEMD_SERVICE_${PN} = "thttpd.service"
37 42
38FILES_${PN} += "${servicedir}" 43FILES_${PN} += "${SRV_DIR}"
39FILES_${PN}-dbg += "${servicedir}/www/cgi-bin/.debug" 44FILES_${PN}-dbg += "${SRV_DIR}/cgi-bin/.debug"
40 45