wok-current view get-virtualbox/stuff/get-virtualbox @ rev 14267

syslinux/iso2exe: add boot error message
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Apr 02 08:37:23 2013 +0200 (2013-04-02)
parents 76814f25dbcf
children
line source
1 #!/bin/sh -e
3 PACKAGE=${0#*get-}
4 WEB_SITE=http://www.virtualbox.org/
5 SHORT_DESC="x86 virtualization."
6 DEPENDS="libsdl fontconfig gcc-lib-base glib libpng python udev mesa libglu-mesa"
7 BUILD_DEPENDS="slitaz-toolchain bzip2 linux-source linux-module-headers python python-dev coreutils-command"
9 ROOT="$1"
11 if test $(id -u) != 0 ; then
12 echo -e "\nYou must be root to run `basename $0`."
13 echo -e "Please type 'su' and root password to become super-user.\n"
14 exit 0
15 fi
17 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
18 [ -n "$ROOT" ] && exit 1
19 tazpkg remove $PACKAGE
20 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
21 fi
22 [ -d $ROOT/usr/share/$PACKAGE ] && rm -rf $ROOT/usr/share/$PACKAGE
24 case "$(uname -m)" in
25 i?86) linux_run="Linux_x86.run" ;;
26 x86_64) linux_run="Linux_amd64.run" ;;
27 esac
29 dl_url()
30 {
31 wget --no-check-certificate -O - \
32 ${WEB_SITE}wiki/Linux_Downloads 2> /dev/null | \
33 grep $linux_run | sed 's|.*href="\(.*'$linux_run'\).*|\1|'
34 }
36 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
37 CUR_DIR=$(pwd)
38 mkdir -p $TMP_DIR && cd $TMP_DIR
40 url=$(dl_url)
41 TARBALL="$PACKAGE files"
42 if [ -n "$url" ]; then
43 TARBALL=$(basename $url)
44 wget $url
45 fi
47 if [ ! -f "$TARBALL" ]; then
48 cd $CUR_DIR
49 rm -rf $TMP_DIR
50 echo "Could not download $TARBALL. Exiting."
51 exit 1
52 fi
54 VERSION=${TARBALL%-$linux_run*}
55 VERSION=${VERSION#VirtualBox-}
57 sed -i 's/df -kP/df -k/' $TARBALL
59 # Extract
60 sh $TARBALL --noexec --keep
62 for i in $BUILD_DEPENDS; do
63 [ -d /var/lib/tazpkg/installed/$i ] && continue
64 yes y | tazpkg get-install $i
65 done
66 [ -d /lib/modules/$(uname -r)/source ] || get-linux-source
67 [ -d /lib/modules/$(uname -r)/build ] ||
68 cp -a /lib/modules/$(uname -r)/source /lib/modules/$(uname -r)/build
70 # Install files
71 cd install
72 [ -d /usr/share/VirtualBox -o -d /opt/VirtualBox ] && ./uninstall.sh
73 [ -d /opt ] || mkdir /opt
74 find /usr /etc /lib /opt > ../before
75 ./install.sh install
76 cd ..
77 find /usr /etc /lib /opt > after
78 sed -i 's/ps -U/ps | grep/' /opt/VirtualBox/VBox.sh
79 chmod 644 /opt/VirtualBox/VBoxVMM.so
80 echo 'lsmod | grep -q vboxdrv || modprobe vboxdrv' >> /etc/vbox/vbox.cfg
81 mkdir -p $PACKAGE-$VERSION/fs
82 diff -U0 before after | grep ^+/ | sed 's|^\+/||' | \
83 ( cd / ; cpio -o -H newc ) | ( cd $PACKAGE-$VERSION/fs ; cpio -idm )
85 MODULE_LIST="vboxdrv vboxnetadp vboxnetflt"
86 # Create pseudo package
87 cat > $PACKAGE-$VERSION/receipt <<EOT
88 # SliTaz package receipt.
90 PACKAGE="$PACKAGE"
91 VERSION="$VERSION"
92 EXTRAVERSION=_$(uname -r | sed 's/-slitaz//')
93 CATEGORY="non-free"
94 SHORT_DESC="$SHORT_DESC"
95 WEB_SITE="$WEB_SITE"
96 DEPENDS="$DEPENDS"
98 pre_remove()
99 {
100 sed -i 's/$MODULE_LIST //' \$1/etc/rcS.conf
101 chroot "\$1/" delgroup vboxusers
102 }
104 post_install()
105 {
106 $(grep ' udev[atp]' install/install.sh)
107 chroot "\$1/" depmod -a $(uname -r)
108 [ -n "\$1" ] || for i in $MODULE_LIST; do modprobe \$i ; done
109 grep -qs vboxdrv \$1/etc/rcS.conf ||
110 sed -i 's/^LOAD_MODULES="/&$MODULE_LIST /' \$1/etc/rcS.conf
112 # Add vboxusers group
113 grep -qs ^vboxusers \$1/etc/group ||
114 chroot "\$1/" addgroup vboxusers
115 }
116 EOT
118 # Pack
119 tazpkg pack $PACKAGE-$VERSION
121 # Install pseudo package
122 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
123 case " $@ " in
124 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
125 esac
127 # Clean
128 cd $CUR_DIR
129 rm -rf $TMP_DIR