wok-6.x rev 18275

Add daloradius
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Aug 07 18:53:05 2015 +0200 (2015-08-07)
parents ca61db166b09
children 37d6a04a7668
files daloradius/receipt
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/daloradius/receipt	Fri Aug 07 18:53:05 2015 +0200
     1.3 @@ -0,0 +1,67 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="daloradius"
     1.7 +VERSION="0.9-9"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="A RADIUS web platform for managing Hotspots."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +LICENSE="GPL2"
    1.12 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.13 +WEB_SITE="http://www.daloradius.com/"
    1.14 +WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
    1.15 +
    1.16 +DEBENDS="php-gd php-mysql freeradius"
    1.17 +
    1.18 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.19 +genpkg_rules()
    1.20 +{
    1.21 +	mkdir -p $fs/usr/share/daloradius $fs/etc/mysql.d
    1.22 +	cp -a $src/* $fs/usr/share/daloradius
    1.23 +	mv $fs/usr/share/daloradius/library/daloradius.conf.php $fs/etc/
    1.24 +	ln -s /etc/daloradius.conf.php $fs/usr/share/daloradius/library/daloradius.conf.php
    1.25 +	cat > $fs/etc/mysql.d/daloradius <<EOT
    1.26 +#!/bin/sh
    1.27 +
    1.28 +mysqldump readius > /dev/null 2>&1 | grep -qi daloradius ||
    1.29 +mysql -u root radius < /usr/share/daloradius/contrib/db/mysql-daloradius.sql
    1.30 +chmod -x /etc/mysql.d/daloradius
    1.31 +EOT
    1.32 +	chmod 755 $fs/etc/mysql.d/daloradius
    1.33 +}
    1.34 +
    1.35 +post_install()
    1.36 +{
    1.37 +	# Configure lighttpd server
    1.38 +	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
    1.39 +		if ! grep -q /usr/share/daloradius/ $1/etc/lighttpd/lighttpd.conf; then
    1.40 +	    		sed -e 's|.*"/examples/" => "/usr/share/examples/",|    "/examples/" => "/usr/share/examples/",\n    "/daloradius/" => "/usr/share/daloradius/",|g' -i $1/etc/lighttpd/lighttpd.conf
    1.41 +			if [ -z "$1" ]; then
    1.42 +				# Start Web server.
    1.43 +				/etc/init.d/lighttpd stop
    1.44 +				/etc/init.d/lighttpd start
    1.45 +			fi
    1.46 +		fi
    1.47 +	fi
    1.48 +	# Configure apache server
    1.49 +	if [ -f $1/etc/apache/httpd.conf ]; then
    1.50 +		if [ ! -f $1/etc/apache/conf.d/daloradius ]; then
    1.51 +			cat > $1/etc/apache/conf.d/daloradius <<EOT
    1.52 +<IfModule mod_alias.c>
    1.53 +    Alias /daloradius /usr/share/daloradius
    1.54 +</IfModule>
    1.55 +<Directory /usr/share/daloradius/>
    1.56 +    DirectoryIndex index.php
    1.57 +    Options +FollowSymLinks
    1.58 +    AllowOverride None
    1.59 +    Order allow,deny
    1.60 +    Allow from all
    1.61 +</Directory>
    1.62 +EOT
    1.63 +			if [ -z "$1" ]; then
    1.64 +				# Start Web server.
    1.65 +				/etc/init.d/apache stop
    1.66 +				/etc/init.d/apache start
    1.67 +			fi
    1.68 +		fi
    1.69 +	fi
    1.70 +}