wok view lighttpd-ssl/receipt @ rev 1789
lighttpd-ssl: generate default certificate
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Nov 30 16:32:22 2008 +0000 (2008-11-30) |
parents | dcc4ea6cb102 |
children | 91c5b6acc053 |
line source
1 # SliTaz package receipt.
3 PACKAGE="lighttpd-ssl"
4 VERSION="1.4.20"
5 CATEGORY="network"
6 SHORT_DESC="Fast and light HTTP Web server with SSL support."
7 MAINTAINER="pankso@slitaz.org"
8 DEPENDS="pcre openssl"
9 BUILD_DEPENDS="pcre-dev bzip2-dev openssl-dev"
10 SUGGESTED="lighttpd-modules php perl python"
11 SOURCE="lighttpd"
12 TARBALL="$SOURCE-$VERSION.tar.gz"
13 WEB_SITE="http://www.lighttpd.net/"
14 #WGET_URL="http://www.lighttpd.net/download/$TARBALL"
15 WGET_URL="http://mirror.slitaz.org/sources/packages/l/$TARBALL"
16 CONFIG_FILES="/etc/lighttpd/lighttpd.conf /etc/lighttpd/vhosts.conf"
17 PROVIDE="lighttpd"
18 BASE_MODULES="
19 access
20 accesslog
21 alias
22 cgi
23 dirlisting
24 indexfile
25 staticfile
26 rewrite
27 status
28 userdir"
30 # Rules to configure and make the package.
31 compile_rules()
32 {
33 cd $src
34 if [ ! done.fastcgi_detach.patch ]; then
35 patch -i ../stuff/fastcgi_detach.patch || exit 1
36 touch done.fastcgi_detach.patch
37 fi
38 ./configure \
39 --enable-shared \
40 --disable-ipv6 \
41 --with-openssl \
42 --prefix=/usr \
43 --libdir=/usr/lib/lighttpd \
44 --mandir=/usr/share/man \
45 $CONFIGURE_ARGS &&
46 make &&
47 make DESTDIR=$PWD/_pkg install
48 }
50 # Rules to gen a SliTaz package suitable for Tazpkg.
51 # On SliTaz Lighttpd runs as user/group : www/www or 80/80.
52 genpkg_rules()
53 {
54 mkdir -p $fs/usr
55 cp -a $_pkg/usr/bin $fs/usr
56 cp -a $_pkg/usr/sbin $fs/usr
58 # Modules.
59 mkdir -p $fs/usr/lib/lighttpd
60 for module in $BASE_MODULES
61 do
62 cp $_pkg/usr/lib/lighttpd/mod_${module}.so $fs/usr/lib/lighttpd
63 echo -n "Copying : mod_${module}.so" && status
64 done
65 strip -s $fs/usr/bin/*
66 strip -s $fs/usr/sbin/*
67 strip -s $fs/usr/lib/lighttpd/*
69 # Server root and config file.
70 cp -a stuff/var $fs
71 cp -a stuff/etc $fs
72 chown -R 0.0 $fs/var/www
73 chown -R 0.0 $fs/etc
74 mkdir $fs/etc/ssl/lighttpd
75 cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
77 # Enable HTTPS support
78 #
79 $SERVER["socket"] == ":443" {
80 protocol = "https://"
81 ssl.engine = "enable"
82 ssl.pemfile = "/etc/ssl/lighttpd/lighttpd.pem"
83 }
84 EOT
86 # Logs directory.
87 mkdir -p $fs/var/log/lighttpd
88 chown 80.80 $fs/var/log/lighttpd
89 }
91 # Pre and post install commands for Tazpkg.
92 # We stop the server by default in case of upgarde.
93 pre_install()
94 {
95 echo "Processing pre-install commands..."
96 [ -f /etc/init.d/lighttpd ] && /etc/init.d/lighttpd stop
97 }
98 post_install()
99 {
100 local root
101 root=$1
102 echo "Processing post-install commands..."
103 if [ ! -f $1/etc/ssl/lighttpd/lighttpd.pem ]; then
104 openssl req -new -x509 \
105 -keyout $1/etc/ssl/lighttpd/lighttpd.pem \
106 -out $1/etc/ssl/lighttpd/lighttpd.pem \
107 -days 3650 -nodes <<EOT
108 $(. /etc/locale.conf ; echo ${LANG#*_})
109 $(cat /etc/TZ)
111 $(cat /etc/hostname)
115 EOT
116 fi
117 # Just in case.
118 chown www.www $root/var/log/lighttpd
119 /etc/init.d/lighttpd start
120 }