wok rev 3999

Add get-virtualbox
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Aug 31 01:21:30 2009 +0200 (2009-08-31)
parents dbdd0768c3ab
children e97ec0509d5c
files get-virtualbox/receipt get-virtualbox/stuff/get-virtualbox
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/get-virtualbox/receipt	Mon Aug 31 01:21:30 2009 +0200
     1.3 @@ -0,0 +1,16 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="get-virtualbox"
     1.7 +VERSION="1.00"
     1.8 +CATEGORY="non-free"
     1.9 +SHORT_DESC="Get a x86 virtualization software."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +WEB_SITE="http://www.virtualbox.org/"
    1.12 +
    1.13 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.14 +genpkg_rules()
    1.15 +{
    1.16 +	mkdir -p $fs/usr/bin
    1.17 +	cp stuff/get-virtualbox $fs/usr/bin
    1.18 +}
    1.19 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/get-virtualbox/stuff/get-virtualbox	Mon Aug 31 01:21:30 2009 +0200
     2.3 @@ -0,0 +1,93 @@
     2.4 +#!/bin/sh -e
     2.5 +
     2.6 +ROOT="$1"
     2.7 +PACKAGE=${0#*get-}
     2.8 +
     2.9 +if test $(id -u) != 0 ; then
    2.10 +	echo -e "\nYou must be root to run `basename $0`."
    2.11 +	echo -e "Please type 'su' and root password to become super-user.\n"
    2.12 +	exit 0
    2.13 +fi
    2.14 +
    2.15 +if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    2.16 +  [ -n "$ROOT" ] && exit 1
    2.17 +  tazpkg remove $PACKAGE
    2.18 +  [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
    2.19 +fi
    2.20 +[ -d $ROOT/usr/share/$PACKAGE ] && rm -rf $ROOT/usr/share/$PACKAGE
    2.21 +
    2.22 +WEB_SITE=http://www.virtualbox.org/
    2.23 +SHORT_DESC="x86 virtualization."
    2.24 +dl_url()
    2.25 +{
    2.26 +   wget -O - ${WEB_SITE}wiki/Linux_Downloads 2> /dev/null | \
    2.27 +   	 grep Linux_x86.run | sed 's|.*href="\(.*Linux_x86.run\).*|\1|'
    2.28 +}
    2.29 +
    2.30 +TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
    2.31 +CUR_DIR=$(pwd)
    2.32 +mkdir -p $TMP_DIR && cd $TMP_DIR
    2.33 +
    2.34 +url=$(dl_url)
    2.35 +TARBALL=$(basename $url)
    2.36 +wget $url
    2.37 +
    2.38 +if [ ! -f "$TARBALL" ]; then
    2.39 +	cd $CUR_DIR
    2.40 +	rm -rf $TMP_DIR
    2.41 +	echo "Could not download $TARBALL. Exiting."
    2.42 +	exit 1
    2.43 +fi
    2.44 +
    2.45 +VERSION=${TARBALL%-Linux_x86.run*}
    2.46 +VERSION=${VERSION#VirtualBox-}
    2.47 +
    2.48 +sed -i 's/df -kP/df -k/' $TARBALL
    2.49 +
    2.50 +# Extract
    2.51 +sh $TARBALL --noexec --keep
    2.52 +
    2.53 +BUILD_DEPENDS="slitaz-toolchain bzip2 linux-source python python-dev"
    2.54 +for i in $BUILD_DEPENDS; do
    2.55 +	[ -d /var/lib/tazpkg/installed/$i ] && continue
    2.56 +	yes y | tazpkg get-install $i
    2.57 +done
    2.58 +
    2.59 +# Install files
    2.60 +cd install 
    2.61 +[ -d /usr/share/VirtualBox ] && ./uninstall.sh
    2.62 +find /usr /etc > ../before
    2.63 +./install.sh install /usr/share/VirtualBox 
    2.64 +cd ..
    2.65 +find /usr /etc > after
    2.66 +mkdir -p $PACKAGE-$VERSION/fs
    2.67 +diff -U0 before after | grep ^+/ | sed 's|^\+/||' | \
    2.68 +( cd / ; cpio -o -H newc ) | ( cd $PACKAGE-$VERSION/fs ; cpio -idm )
    2.69 +
    2.70 +# Create pseudo package
    2.71 +cat > $PACKAGE-$VERSION/receipt <<EOT
    2.72 +# SliTaz package receipt.
    2.73 +
    2.74 +PACKAGE="$PACKAGE"
    2.75 +VERSION="$VERSION"
    2.76 +EXTRAVERSION=_$(uname -r | sed 's/-slitaz//')
    2.77 +CATEGORY="non-free"
    2.78 +SHORT_DESC="$SHORT_DESC"
    2.79 +WEB_SITE="$WEB_SITE"
    2.80 +DEPENDS="libsdl fontconfig gcc-lib-base glib libpng python udev"
    2.81 +
    2.82 +post_install()
    2.83 +{
    2.84 +$(grep '  udev[atp]' install/install.sh)
    2.85 +}
    2.86 +EOT
    2.87 +
    2.88 +# Pack
    2.89 +tazpkg pack $PACKAGE-$VERSION
    2.90 +
    2.91 +# Install pseudo package
    2.92 +tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
    2.93 +
    2.94 +# Clean
    2.95 +cd $CUR_DIR
    2.96 +rm -rf $TMP_DIR