wok-6.x view get-google-earth/stuff/get-google-earth @ rev 15007
connman: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Aug 11 10:21:02 2013 +0000 (2013-08-11) |
parents | 32959e7975fc |
children | d7b0fb9b6487 |
line source
1 #!/bin/sh -e
3 DEPENDS="mesa"
4 ROOT="$1"
5 PACKAGE="google-earth"
7 if test $(id -u) != 0 ; then
8 echo -e "\nYou must be root to run `basename $0`."
9 echo -e "Please type 'su' and root password to become super-user.\n"
10 exit 0
11 fi
13 if [ -d $ROOT/var/lib/tazpkg/installed/google-earth ]; then
14 [ -n "$ROOT" ] && exit 1
15 tazpkg remove google-earth
16 [ -d /var/lib/tazpkg/installed/google-earth ] && exit 1
17 fi
19 TMP_DIR=/tmp/get-google-earth-$$-$RANDOM
20 CUR_DIR=$(pwd)
21 mkdir -p $TMP_DIR && cd $TMP_DIR
23 # Download tarball
24 wget http://dl.google.com/earth/client/current/GoogleEarthLinux.bin
25 if [ ! -f GoogleEarthLinux.bin ]; then
26 cd $CUR_DIR
27 rm -rf $TMP_DIR
28 echo "Could not download GoogleEarthLinux.bin. Exiting."
29 exit 1
30 fi
32 chmod +x GoogleEarthLinux.bin
33 sed -i 's/bzip2 -d/bunzip2/g' GoogleEarthLinux.bin
35 VERSION=$(head GoogleEarthLinux.bin | grep ^label | sed 's/.*Linux \(.*\)"/\1/')
37 # Add depends
38 for i in $DEPENDS; do
39 yes y | tazpkg get-install $i
40 done
42 # Extract
43 ./GoogleEarthLinux.bin
45 # extracted pkg can be removed: Save RAM
46 rm -rf GoogleEarthLinux.bin
48 # Create pseudo package
49 while read file; do
50 dest=google-earth-$VERSION/fs$(dirname $file)
51 [ -d $dest ] || mkdir -p $dest
52 cp -a $file $dest
53 done <<EOT
54 $(ls /*bin/googleearth /usr/*bin/googleearth 2> /dev/null)
55 $(ls /usr/share/applications/*googleearth*.desktop)
56 /usr/share/applications/defaults.list
57 $(ls -d /usr/*/google-earth)
58 EOT
59 cat > google-earth-$VERSION/receipt <<EOT
60 PACKAGE="google-earth"
61 VERSION="$VERSION"
62 CATEGORY="non-free"
63 SHORT_DESC="3D planet viewer."
64 WEB_SITE="http://earth.google.com/"
65 DEPENDS="$DEPENDS"
66 EOT
68 # Pack
69 tazpkg pack $PACKAGE-$VERSION
71 # Clean to save RAM memory
72 rm -rf $PACKAGE-$VERSION
74 # Install pseudo package
75 tazpkg install google-earth-$VERSION.tazpkg --root=$ROOT
77 # Clean
78 cd $CUR_DIR
79 rm -rf $TMP_DIR