wok-stable rev 7738

Add phpvirtualbox
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 20 14:58:13 2010 +0100 (2010-12-20)
parents 48880e2d195b
children 917ae5062e8a
files phpvirtualbox/receipt phpvirtualbox/stuff/etc/init.d/vboxwebsrv
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/phpvirtualbox/receipt	Mon Dec 20 14:58:13 2010 +0100
     1.3 @@ -0,0 +1,78 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="phpvirtualbox"
     1.7 +VERSION="0.5"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="Virtualbox AJAX interface."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +TARBALL="$PACKAGE-$VERSION.zip"
    1.12 +WEB_SITE="http://code.google.com/$PACKAGE/"
    1.13 +WGET_URL="http://$PACKAGE.googlecode.com/files/$TARBALL"
    1.14 +DEPENDS="php-soap virtualbox"
    1.15 +
    1.16 +# Rules to configure and make the package.
    1.17 +compile_rules()
    1.18 +{
    1.19 +	cd $src
    1.20 +}
    1.21 +
    1.22 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.23 +genpkg_rules()
    1.24 +{
    1.25 +	mkdir -p $fs/usr/share $fs/etc
    1.26 +	cp -a $src $fs/usr/share/phpvirtualbox
    1.27 +	mv $fs/usr/share/phpvirtualbox/config.php $fs/etc/phpvirtualbox.php
    1.28 +	dos2unix $fs/etc/phpvirtualbox.php
    1.29 +	ln -s /etc/phpvirtualbox.php $fs/usr/share/phpvirtualbox/config.php
    1.30 +	cp -a stuff/* $fs/
    1.31 +}
    1.32 +
    1.33 +post_install()
    1.34 +{
    1.35 +	# Virtualbox OSE needs to disable authenication for vboxwebsrv
    1.36 +	[ -d $1/var/lib/tazpkg/installed/virtualbox ] ||
    1.37 +	chroot $1 VBoxManage setproperty websrvauthlibrary null 
    1.38 +
    1.39 +	# Configure lighttpd server
    1.40 +	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
    1.41 +		if ! grep -q /usr/share/phpvirtualbox/ $1/etc/lighttpd/lighttpd.conf; then
    1.42 +	    		sed -e 's|.*"/examples/" => "/usr/share/examples/",|    "/examples/" => "/usr/share/examples/",\n    "/phpvirtualbox/" => "/usr/share/phpvirtualbox/",|g' -i $1/etc/lighttpd/lighttpd.conf
    1.43 +			if [ -z "$1" ]; then
    1.44 +				# Start Web server.
    1.45 +				/etc/init.d/lighttpd stop
    1.46 +				/etc/init.d/lighttpd start
    1.47 +			fi
    1.48 +		fi
    1.49 +	fi
    1.50 +	# Configure apache server
    1.51 +	if [ -f $1/etc/apache/httpd.conf ]; then
    1.52 +		if [ ! -f $1/etc/apache/conf.d/phpvirtualbox ]; then
    1.53 +			cat > $1/etc/apache/conf.d/phpvirtualbox <<EOT
    1.54 +<IfModule mod_alias.c>
    1.55 +    Alias /phpvirtualbox /usr/share/phpvirtualbox
    1.56 +</IfModule>
    1.57 +<DirectoryMatch /usr/share/phpvirtualbox/>
    1.58 +    DirectoryIndex index.php
    1.59 +    Options +FollowSymLinks
    1.60 +    AllowOverride None
    1.61 +    Order allow,deny
    1.62 +    Allow from all
    1.63 +</DirectoryMatch>
    1.64 +EOT
    1.65 +			if [ -z "$1" ]; then
    1.66 +				# Start Web server.
    1.67 +				/etc/init.d/apache stop
    1.68 +				/etc/init.d/apache start
    1.69 +			fi
    1.70 +		fi
    1.71 +	fi
    1.72 +	[ -z "$1" ] && /etc/init.d/vboxwebsrv start
    1.73 +	cat <<EOT
    1.74 +Please configure /etc/phpvirtualbox.php now.
    1.75 +EOT
    1.76 +}
    1.77 +
    1.78 +pre_remove()
    1.79 +{
    1.80 +	/etc/init.d/vboxwebsrv stop
    1.81 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/phpvirtualbox/stuff/etc/init.d/vboxwebsrv	Mon Dec 20 14:58:13 2010 +0100
     2.3 @@ -0,0 +1,59 @@
     2.4 +#!/bin/sh
     2.5 +# Start, stop and restart vboxwebsrv deamon on SliTaz, at boot time or 
     2.6 +# with the command line.
     2.7 +#
     2.8 +# To start daemon at boot time, just put vboxwebsrv in the $RUN_DAEMONS
     2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    2.10 +#
    2.11 +. /etc/init.d/rc.functions
    2.12 +
    2.13 +NAME=$(basename $0)
    2.14 +DESC="$NAME deamon"
    2.15 +DAEMON=$(which $NAME)
    2.16 +OPTIONS="-b --logfile /dev/null"
    2.17 +eval $(grep -i ^${NAME}_OPTIONS /etc/daemons.conf | sed 's/.*_OPT/OPT/')
    2.18 +PIDFILE=/var/run/$NAME.pid
    2.19 +
    2.20 +case "$1" in
    2.21 +  start)
    2.22 +    if active_pidfile $PIDFILE $NAME ; then
    2.23 +      echo "$NAME is already running."
    2.24 +      exit 1
    2.25 +    fi
    2.26 +    echo -n "Starting $DESC: $NAME... "
    2.27 +    $DAEMON $OPTIONS > /dev/null 2>&1
    2.28 +    [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE
    2.29 +    active_pidfile $PIDFILE $NAME
    2.30 +    status
    2.31 +    ;;
    2.32 +  stop)
    2.33 +    if ! active_pidfile $PIDFILE $NAME ; then
    2.34 +      echo "$NAME is not running."
    2.35 +      exit 1
    2.36 +    fi
    2.37 +    echo -n "Stopping $DESC: $NAME... "
    2.38 +    kill `cat $PIDFILE`
    2.39 +    status
    2.40 +    ;;
    2.41 +  restart)
    2.42 +    if ! active_pidfile $PIDFILE $NAME ; then
    2.43 +      echo "$NAME is not running."
    2.44 +      exit 1
    2.45 +    fi
    2.46 +    echo -n "Restarting $DESC: $NAME... "
    2.47 +    kill `cat $PIDFILE`
    2.48 +    sleep 2
    2.49 +    $DAEMON $OPTIONS > /dev/null 2>&1
    2.50 +    [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE
    2.51 +    active_pidfile $PIDFILE $NAME
    2.52 +    status
    2.53 +    ;;
    2.54 +*)
    2.55 +    echo ""
    2.56 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    2.57 +    echo ""
    2.58 +    exit 1
    2.59 +    ;;
    2.60 +esac
    2.61 +
    2.62 +exit 0