]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blobdiff - lighttpd/lighttpd.nm
lighttpd: Add scriptlet for systemd, fix tmpfiles directory.
[people/ms/ipfire-3.x.git] / lighttpd / lighttpd.nm
index 9d4ce5c272be283d7abef6af66a07a0d2ab599b2..1fb927d3778d9082a09abc9815e323d871b6476f 100644 (file)
@@ -5,7 +5,8 @@
 
 name       = lighttpd
 version    = 1.4.29
-release    = 1
+ver_major  = 1.4
+release    = 2
 
 maintainer = Michael Tremer <michael.tremer@ipfire.org>
 groups     = Networking/Webservers
@@ -14,15 +15,15 @@ license    = BSD
 summary    = Lightning fast webserver with light system requirements.
 
 description
-       Secure, fast, compliant and very flexible web-server which has been optimized \
-       for high-performance environments. It has a very low memory footprint compared \
-       to other webservers and takes care of cpu-load. Its advanced feature-set \
-       (FastCGI, CGI, Auth, Output-Compression, URL-Rewriting and many more) make \
-       it the perfect webserver-software for every server that is suffering load \
+       Secure, fast, compliant and very flexible web-server which has been optimized
+       for high-performance environments. It has a very low memory footprint compared
+       to other webservers and takes care of cpu-load. Its advanced feature-set
+       (FastCGI, CGI, Auth, Output-Compression, URL-Rewriting and many more) make
+       it the perfect webserver-software for every server that is suffering load
        problems.
 end
 
-source_dl  =
+source_dl  = http://download.lighttpd.net/lighttpd/releases-%{ver_major}.x/
 
 build
        requires
@@ -32,6 +33,7 @@ build
                openssl-devel
                pcre-devel
                pkg-config
+               shadow-utils
                zlib-devel
        end
 
@@ -40,19 +42,55 @@ build
                --with-ldap \
                --with-openssl
 
+       prepare_cmds
+               %{create_user}
+       end
+
        install_cmds
                mkdir -pv %{BUILDROOT}/etc
                cp -vf %{DIR_SOURCE}/%{name}.conf %{BUILDROOT}/etc/%{name}.conf
 
                mkdir -pv %{BUILDROOT}/var/log/%{name}
                touch %{BUILDROOT}/var/log/%{name}/{access,error}.log
-               chown nobody.nobody -R %{BUILDROOT}/var/log/%{name}
+               chown lighttpd.lighttpd -R %{BUILDROOT}/var/log/%{name}
                mkdir -pv %{BUILDROOT}/var/cache/lighttpd/compress
-               chown nobody.nobody -Rv %{BUILDROOT}/var/cache/lighttpd/
+               chown lighttpd.lighttpd -Rv %{BUILDROOT}/var/cache/lighttpd/
+
+               mkdir -pv %{BUILDROOT}/run/lighttpd
+               chown lighttpd.lighttpd -Rv %{BUILDROOT}/run/lighttpd/
        end
 end
 
+create_user
+       getent group lighttpd >/dev/null || /usr/sbin/groupadd -r lighttpd
+       getent passwd lighttpd >/dev/null || /usr/sbin/useradd -r -g lighttpd \
+               -d /var/www/lighttpd -s /sbin/nologin lighttpd
+end
+
 packages
        package %{name}
+               configfiles
+                       /etc/lighttpd.conf
+               end
+       
+               prerequires = shadow-utils systemd-units
+
+               script prein
+                       %{create_user}
+               end
+       
+               script postin
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+       
+               script preun
+                       /bin/systemctl --no-reload disable lighttpd.service >/dev/null 2>&1 || :
+                       /bin/systemctl stop lighttpd.service >/dev/null 2>&1 || :
+               end
+       
+               script postup
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+                       /bin/systemctl try-restart lighttpd.service >/dev/null 2>&1 || :
+               end
        end
 end