wok-stable view get-virtualbox/stuff/get-virtualbox @ rev 7222
Fix mesa-demos to install glxinfo and glxgears thats in PWD/_pkg/usr/bin folder.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Thu Nov 11 02:23:56 2010 +0000 (2010-11-11) |
parents | 7cd9a13064cd |
children | 14a02389406d |
line source
1 #!/bin/sh -e
3 ROOT="$1"
4 PACKAGE=${0#*get-}
6 if test $(id -u) != 0 ; then
7 echo -e "\nYou must be root to run `basename $0`."
8 echo -e "Please type 'su' and root password to become super-user.\n"
9 exit 0
10 fi
12 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
13 [ -n "$ROOT" ] && exit 1
14 tazpkg remove $PACKAGE
15 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
16 fi
17 [ -d $ROOT/usr/share/$PACKAGE ] && rm -rf $ROOT/usr/share/$PACKAGE
19 WEB_SITE=http://www.virtualbox.org/
20 SHORT_DESC="x86 virtualization."
21 dl_url()
22 {
23 wget -O - ${WEB_SITE}wiki/Linux_Downloads 2> /dev/null | \
24 grep Linux_x86.run | sed 's|.*href="\(.*Linux_x86.run\).*|\1|'
25 }
27 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
28 CUR_DIR=$(pwd)
29 mkdir -p $TMP_DIR && cd $TMP_DIR
31 url=$(dl_url)
32 TARBALL=$(basename $url)
33 wget $url
35 if [ ! -f "$TARBALL" ]; then
36 cd $CUR_DIR
37 rm -rf $TMP_DIR
38 echo "Could not download $TARBALL. Exiting."
39 exit 1
40 fi
42 VERSION=${TARBALL%-Linux_x86.run*}
43 VERSION=${VERSION#VirtualBox-}
45 sed -i 's/df -kP/df -k/' $TARBALL
47 # Extract
48 sh $TARBALL --noexec --keep
50 BUILD_DEPENDS="slitaz-toolchain bzip2 linux-source python python-dev"
51 for i in $BUILD_DEPENDS; do
52 [ -d /var/lib/tazpkg/installed/$i ] && continue
53 yes y | tazpkg get-install $i
54 done
56 # Install files
57 cd install
58 [ -d /usr/share/VirtualBox ] && ./uninstall.sh
59 find /usr /etc /lib > ../before
60 ./install.sh install /usr/share/VirtualBox
61 cd ..
62 find /usr /etc /lib > after
63 sed -i 's/ps -U/ps | grep/' /usr/share/VirtualBox/VBox.sh
64 echo 'lsmod | grep -q vboxdrv || modprobe vboxdrv' >> /etc/vbox/vbox.cfg
65 mkdir -p $PACKAGE-$VERSION/fs
66 diff -U0 before after | grep ^+/ | sed 's|^\+/||' | \
67 ( cd / ; cpio -o -H newc ) | ( cd $PACKAGE-$VERSION/fs ; cpio -idm )
69 MODULE_LIST="vboxdrv vboxnetadp vboxnetflt"
70 # Create pseudo package
71 cat > $PACKAGE-$VERSION/receipt <<EOT
72 # SliTaz package receipt.
74 PACKAGE="$PACKAGE"
75 VERSION="$VERSION"
76 EXTRAVERSION=_$(uname -r | sed 's/-slitaz//')
77 CATEGORY="non-free"
78 SHORT_DESC="$SHORT_DESC"
79 WEB_SITE="$WEB_SITE"
80 DEPENDS="libsdl fontconfig gcc-lib-base glib libpng python udev mesa libglu-mesa"
82 pre_remove()
83 {
84 sed -i 's/$MODULE_LIST //' \$1/etc/rcS.conf
85 chroot "\$1/" delgroup vboxusers
86 }
88 post_install()
89 {
90 $(grep ' udev[atp]' install/install.sh)
91 chroot "\$1/" depmod -a $(uname -r)
92 [ -n "\$1" ] || for i in $MODULE_LIST; do modprobe \$i ; done
93 grep -qs vboxdrv \$1/etc/rcS.conf ||
94 sed -i 's/LOAD_MODULES="/&$MODULE_LIST /' \$1/etc/rcS.conf
96 # Add vboxusers group
97 grep -qs ^vboxusers \$1/etc/group ||
98 chroot "\$1/" addgroup vboxusers
99 }
100 EOT
102 # Pack
103 tazpkg pack $PACKAGE-$VERSION
105 # Install pseudo package
106 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
108 # Clean
109 cd $CUR_DIR
110 rm -rf $TMP_DIR