wok-current rev 10818

busybox: add HTTPD_OPTIONS and start httpd as www user (+ add files forgot in previews commit)
author Christophe Lincoln <pankso@slitaz.org>
date Mon Jun 06 00:44:11 2011 +0200 (2011-06-06)
parents 481d1e820d85
children 5f0378f7067c
files busybox/receipt busybox/stuff/applications/httpd-cgi.desktop busybox/stuff/applications/httpd.desktop busybox/stuff/httpd.conf busybox/stuff/www/cgi-env.sh busybox/stuff/www/index.html busybox/stuff/www/style.css slitaz-base-files/receipt
line diff
     1.1 --- a/busybox/receipt	Mon Jun 06 00:30:06 2011 +0200
     1.2 +++ b/busybox/receipt	Mon Jun 06 00:44:11 2011 +0200
     1.3 @@ -137,6 +137,23 @@
     1.4  		mv $1$i-busybox-install $1$i
     1.5  	done < $1$INSTALLED/$PACKAGE/files.list
     1.6  	chmod 4755 $1/bin/busybox
     1.7 +
     1.8 +	# /etc/daemons.conf (tftp + dnsd + httpd may not be present)
     1.9 +	if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
    1.10 +		echo '# Domain name server options.' >> $root/etc/daemons.conf
    1.11 +		echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
    1.12 +		echo '' >> $root/etc/daemons.conf
    1.13 +	fi
    1.14 +	if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
    1.15 +		echo '# Tftp daemon options.' >> $root/etc/daemons.conf
    1.16 +		echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
    1.17 +		echo '' >> $root/etc/daemons.conf
    1.18 +	fi
    1.19 +	if ! grep -q ^HTTPD_OPTIONS $root/etc/daemons.conf; then
    1.20 +		echo '# Busybox HTTP web server options.' >> $root/etc/daemons.conf
    1.21 +		echo 'HTTPD_OPTIONS="-u www"' >> $root/etc/daemons.conf
    1.22 +		echo '' >> $root/etc/daemons.conf
    1.23 +	fi
    1.24  }
    1.25  
    1.26  pre_remove()
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/busybox/stuff/applications/httpd-cgi.desktop	Mon Jun 06 00:44:11 2011 +0200
     2.3 @@ -0,0 +1,7 @@
     2.4 +[Desktop Entry]
     2.5 +Encoding=UTF-8
     2.6 +Name=CGI SHell Environment
     2.7 +Exec=browser http://localhost/cgi-env.sh
     2.8 +Icon=text-x-script
     2.9 +Type=Application
    2.10 +Categories=Application;Development;
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/busybox/stuff/applications/httpd.desktop	Mon Jun 06 00:44:11 2011 +0200
     3.3 @@ -0,0 +1,7 @@
     3.4 +[Desktop Entry]
     3.5 +Encoding=UTF-8
     3.6 +Name=HTTP Web server
     3.7 +Exec=browser http://localhost/
     3.8 +Icon=network
     3.9 +Type=Application
    3.10 +Categories=Application;System;
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/busybox/stuff/httpd.conf	Mon Jun 06 00:44:11 2011 +0200
     4.3 @@ -0,0 +1,34 @@
     4.4 +# /etc/httpd.conf: Busybox HTTP web server configuration file.
     4.5 +
     4.6 +# Server root.
     4.7 +H:/var/www
     4.8 +
     4.9 +# Allow address.
    4.10 +A:0.0.0.0/0
    4.11 +
    4.12 +# File to open by default.
    4.13 +#I:index.html      
    4.14 +
    4.15 +# Path to the 404 error page.
    4.16 +#E404:/path/404.html 
    4.17 +
    4.18 +# Require user root, password root on urls starting with /adm/.
    4.19 +#/adm:root:root
    4.20 +
    4.21 +# Reverse proxy.
    4.22 +#P:/url:[http://]hostname[:port]/new/path
    4.23 +
    4.24 +# CGI interpreter path.
    4.25 +*.sh:/bin/sh
    4.26 +*.cgi:/bin/sh
    4.27 +#*.php:/usr/bin/php-cgi
    4.28 +
    4.29 +# MIME type.
    4.30 +.txt:text/plain
    4.31 +.css:text/css
    4.32 +.xml:text/xml
    4.33 +.png:image/png
    4.34 +.jpg:image/jpeg
    4.35 +.tgz:application/x-tgz
    4.36 +.tar.gz:application/x-tgz
    4.37 +.tazpkg:application/x-tazpkg
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/busybox/stuff/www/cgi-env.sh	Mon Jun 06 00:44:11 2011 +0200
     5.3 @@ -0,0 +1,46 @@
     5.4 +#!/bin/sh
     5.5 +. /usr/bin/httpd_helper.sh
     5.6 +header
     5.7 +
     5.8 +cat << EOT
     5.9 +<!DOCTYPE html>
    5.10 +<html xmlns="http://www.w3.org/1999/xhtml">
    5.11 +<head>
    5.12 +	<title>CGI SHell Environment</title>
    5.13 +	<meta charset="utf-8" />
    5.14 +	<link rel="stylesheet" type="text/css" href="style.css" />
    5.15 +</head>
    5.16 +<body>
    5.17 +
    5.18 +<!-- Header -->
    5.19 +<div id="header">
    5.20 +	<h1>CGI SHell Environment</h1>
    5.21 +</div>
    5.22 +
    5.23 +<!-- Content -->
    5.24 +<div id="content">
    5.25 +
    5.26 +<p>
    5.27 +	Welcome to SliTaz web server CGI Shell environment. Let the power of
    5.28 +	SHell script meet the web! Here you can check HTTP info and try some
    5.29 +	requests. Including /usr/bin/httpd_helper.sh in your scripts let you
    5.30 +	use PHP alike syntax such as: \$(GET var)
    5.31 +</p>
    5.32 +<p>
    5.33 +	QUERY_STRING test: 
    5.34 +	<a href="$SCRIPT_NAME?var=value">$SCRIPT_NAME?var=value</a>
    5.35 +</p>
    5.36 +
    5.37 +<h2>HTTP Info</h2>
    5.38 +<pre>
    5.39 +$(httpinfo)
    5.40 +</pre>
    5.41 +
    5.42 +<!-- End content -->
    5.43 +</div>
    5.44 +
    5.45 +</body>
    5.46 +</html>
    5.47 +EOT
    5.48 +
    5.49 +exit 0
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/busybox/stuff/www/index.html	Mon Jun 06 00:44:11 2011 +0200
     6.3 @@ -0,0 +1,38 @@
     6.4 +<!DOCTYPE html>
     6.5 +<html xmlns="http://www.w3.org/1999/xhtml">
     6.6 +<head>
     6.7 +	<title>SliTaz Web Server</title>
     6.8 +	<meta charset="utf-8" />
     6.9 +	<link rel="stylesheet" type="text/css" href="style.css" />
    6.10 +</head>
    6.11 +<body>
    6.12 +
    6.13 +<!-- Header -->
    6.14 +<div id="header">
    6.15 +	<h1>SliTaz Web Server</h1>
    6.16 +</div>
    6.17 +
    6.18 +<!-- Content -->
    6.19 +<div id="content">
    6.20 +<h2>Index of /</h2>
    6.21 +
    6.22 +<p>
    6.23 +	Welcome to SliTaz Busybox HTTP web server. You can delete or modify this
    6.24 +	page to put your own xHTML pages, web sites, CGI or PHP scripts. The server
    6.25 +	configuration file is: /etc/httpd.conf. CGI support is activated by default
    6.26 +	using the SHell interpreter for *.sh and *.cgi files. This page is located
    6.27 +	in the server root directory: /var/www. Default configuration is to allow
    6.28 +	connection only from localhost so the port 80 is not open for security
    6.29 +	reason.
    6.30 +</p>
    6.31 +
    6.32 +<!-- End content -->
    6.33 +</div>
    6.34 +
    6.35 +<!-- Footer -->
    6.36 +<div id="footer">
    6.37 +    Copyright &copy; 2011 <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
    6.38 +</div>
    6.39 +
    6.40 +</body>
    6.41 +</html>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/busybox/stuff/www/style.css	Mon Jun 06 00:44:11 2011 +0200
     7.3 @@ -0,0 +1,44 @@
     7.4 +/* CSS style for SliTaz GNU/Linux. */
     7.5 +
     7.6 +html { min-height: 102%; }
     7.7 +
     7.8 +body {
     7.9 +	background: #ffffff;
    7.10 +	color: black;
    7.11 +	font: 13px sans-serif, vernada, arial;
    7.12 +	margin: 0;
    7.13 +	min-width: 640px;
    7.14 +}
    7.15 +
    7.16 +a { text-decoration: underline; color: #215090; }
    7.17 +a:hover { text-decoration: none; color: blue; }
    7.18 +img { border: 0pt none; vertical-align: middle; }
    7.19 +h2 { color: #444; }
    7.20 +h3 { color: #666; font-size: 140%; }
    7.21 +
    7.22 +#header {
    7.23 +	height: 40px;
    7.24 +	background: #351a0a;
    7.25 +	border-bottom: 8px solid #d66018;
    7.26 +}
    7.27 +
    7.28 +#header h1 {
    7.29 +	margin: 0;
    7.30 +	padding: 8px 0 0 8px;
    7.31 +	color: white;
    7.32 +	font-size: 20px;
    7.33 +}
    7.34 +
    7.35 +#content {
    7.36 +	padding: 30px 80px;
    7.37 +	text-align: justify;
    7.38 +}
    7.39 +
    7.40 +#footer {
    7.41 +	text-align: center;
    7.42 +	border-top: 1px solid #ddd;
    7.43 +	padding: 40px;
    7.44 +	color: #666;
    7.45 +}
    7.46 +
    7.47 +#footer a { color: #666; padding: 0 2px; }
     8.1 --- a/slitaz-base-files/receipt	Mon Jun 06 00:30:06 2011 +0200
     8.2 +++ b/slitaz-base-files/receipt	Mon Jun 06 00:44:11 2011 +0200
     8.3 @@ -100,18 +100,6 @@
     8.4  	if ! grep -q audio $root/etc/group; then
     8.5  		chroot $root/ /bin/addgroup -g 20 audio
     8.6  	fi
     8.7 -
     8.8 -	# daemons.conf (tftp + dnsd)
     8.9 -	if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
    8.10 -		echo '# Tftp daemon options.' >> $root/etc/daemons.conf
    8.11 -		echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
    8.12 -		echo '' >> $root/etc/daemons.conf
    8.13 -	fi
    8.14 -	if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
    8.15 -		echo '# Domain name server options.' >> $root/etc/daemons.conf
    8.16 -		echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
    8.17 -		echo '' >> $root/etc/daemons.conf
    8.18 -	fi
    8.19  }
    8.20  
    8.21  pre_remove()