wok view get-google-earth/stuff/get-google-earth @ rev 3893

get-*: do not create empty packages
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Aug 14 10:01:38 2009 +0200 (2009-08-14)
parents e01dd228942a
children a672e2117e22
line source
1 #!/bin/sh -e
3 DEPENDS="mesa"
4 ROOT="$1"
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/google-earth ]; then
13 [ -n "$ROOT" ] && exit 1
14 tazpkg remove google-earth
15 [ -d /var/lib/tazpkg/installed/google-earth ] && exit 1
16 fi
18 TMP_DIR=/tmp/get-google-earth-$$-$RANDOM
19 CUR_DIR=$(pwd)
20 mkdir -p $TMP_DIR && cd $TMP_DIR
22 # Download tarball
23 wget http://dl.google.com/earth/client/current/GoogleEarthLinux.bin
24 if [ ! -f GoogleEarthLinux.bin ]; then
25 cd $CUR_DIR
26 rm -rf $TMP_DIR
27 echo "Could not download GoogleEarthLinux.bin. Exiting."
28 exit 1
29 fi
31 chmod +x GoogleEarthLinux.bin
32 sed -i 's/bzip2 -d/bunzip2/g' GoogleEarthLinux.bin
34 VERSION=$(head GoogleEarthLinux.bin | grep ^label | sed 's/.*Linux \(.*\)"/\1/')
36 # Add depends
37 for i in $DEPENDS; do
38 yes y | tazpkg get-install $i
39 done
41 # Extract
42 ./GoogleEarthLinux.bin
44 # Create pseudo package
45 while read file; do
46 dest=google-earth-$VERSION/fs$(dirname $file)
47 [ -d $dest ] || mkdir -p $dest
48 cp -a $file $dest
49 done <<EOT
50 $(ls /*bin/googleearth /usr/*bin/googleearth 2> /dev/null)
51 $(ls /usr/share/applications/*googleearth*.desktop)
52 /usr/share/applications/defaults.list
53 $(ls -d /usr/*/google-earth)
54 EOT
55 cat > google-earth-$VERSION/receipt <<EOT
56 PACKAGE="google-earth"
57 VERSION="$VERSION"
58 CATEGORY="non-free"
59 SHORT_DESC="3D planet viewer."
60 WEB_SITE="http://earth.google.com/"
61 DEPENDS="$DEPENDS"
62 EOT
64 # Pack
65 tazpkg pack google-earth-$VERSION
67 # Install pseudo package
68 tazpkg install google-earth-$VERSION.tazpkg --root=$ROOT
70 # Clean
71 cd $CUR_DIR
72 rm -rf $TMP_DIR