wok diff get-google-earth/stuff/get-google-earth @ rev 21827

updated radvd (2.12 -> 2.18)
author Hans-G?nter Theisgen
date Fri Sep 13 15:28:12 2019 +0100 (2019-09-13)
parents a672e2117e22
children 0e12529acd24
line diff
     1.1 --- a/get-google-earth/stuff/get-google-earth	Thu Feb 25 11:17:18 2010 +0000
     1.2 +++ b/get-google-earth/stuff/get-google-earth	Fri Sep 13 15:28:12 2019 +0100
     1.3 @@ -1,80 +1,194 @@
     1.4 -#!/bin/sh -e
     1.5 +#!/bin/sh
     1.6 +#
     1.7 +# get-google-earth - create and install SliTaz package google-earth
     1.8 +#
     1.9 +# (C) 2019 SliTaz - GNU General Public License v3.
    1.10 +# Author : unknown
    1.11 +# modified by HGT on 2019-04-05
    1.12 +#
    1.13  
    1.14 -DEPENDS="mesa"
    1.15 -ROOT="$1"
    1.16 -PACKAGE="google-earth"
    1.17 +#	=== Initialisations ===
    1.18  
    1.19 -if test $(id -u) != 0 ; then
    1.20 -	echo -e "\nYou must be root to run `basename $0`."
    1.21 -	echo -e "Please type 'su' and root password to become super-user.\n"
    1.22 -	exit 0
    1.23 +PKGS_DB="/var/lib/tazpkg"	# packages database directory
    1.24 +PACKAGE="google-earth"		# package to create and install
    1.25 +WEB_SITE="https://google.com/earth/"
    1.26 +CATEGORY="non-free"
    1.27 +DEPENDS="libglu-mesa"
    1.28 +
    1.29 +# Declare functions check_root, status, ...
    1.30 +. /lib/libtaz.sh
    1.31 +# and make commandline options (if any) available as variables
    1.32 +
    1.33 +is_installed()
    1.34 +{
    1.35 +	 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
    1.36 +	  then	#package is deemed to be installed
    1.37 +	 	return 0
    1.38 +	  else
    1.39 +	 	return 1
    1.40 +	 fi
    1.41 +}
    1.42 +
    1.43 +
    1.44 +# Show commandline options, if requested by --help
    1.45 +if [ "$help" == "yes" ]
    1.46 +	then
    1.47 +	echo "Commandline options:
    1.48 +  $0
    1.49 +	--version=<version>
    1.50 +	--root=<path-to-root>
    1.51 +	--install=yes|no
    1.52 +	--keep=no|yes
    1.53 +	--tmpdir=<directory-to-build-package>"
    1.54 +	exit
    1.55  fi
    1.56  
    1.57 -if [ -d $ROOT/var/lib/tazpkg/installed/google-earth ]; then
    1.58 -  [ -n "$ROOT" ] && exit 1
    1.59 -  tazpkg remove google-earth
    1.60 -  [ -d /var/lib/tazpkg/installed/google-earth ] && exit 1
    1.61 +# Check for system administrator privileges
    1.62 +check_root
    1.63 +
    1.64 +title "Package $PACKAGE will be build as SliTaz package and installed"
    1.65 +
    1.66 +# Fetch latest version, unless version is set by option --version
    1.67 +[ -z "$version" ] && version="latest"
    1.68 +
    1.69 +# Install SliTaz package, unless inhibited by option --install=no
    1.70 +[ -z "$install" ] && install="yes"
    1.71 +
    1.72 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
    1.73 +# unless option --keep=yes is given
    1.74 +[ -z "$keep" ] && keep="no"
    1.75 +
    1.76 +# Directory for temporary files
    1.77 +[ -z "$tempdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
    1.78 +
    1.79 +# Logging file (unused by now)
    1.80 +LOG=$TMP_DIR/get-$PACKAGE.log
    1.81 +
    1.82 +cat <<EOT
    1.83 +Options in use:
    1.84 +  root           : $root/
    1.85 +  version        : $version
    1.86 +  install package: $install
    1.87 +  keep tazpkg    : $keep
    1.88 +  build directory: $TMP_DIR
    1.89 +
    1.90 +EOT
    1.91 +
    1.92 +separator; newline
    1.93 +
    1.94 +#	=== Remove package, if installed ===
    1.95 +if [ is_installed ]
    1.96 +	then
    1.97 +		action "Removing installed version..."
    1.98 +		tazpkg remove $PACKAGE --root="$root/"
    1.99 +		[ ! is_installed ] &&
   1.100 +		die "Can't remove installed version. Exiting."
   1.101  fi
   1.102  
   1.103 -TMP_DIR=/tmp/get-google-earth-$$-$RANDOM
   1.104 -CUR_DIR=$(pwd)
   1.105 -mkdir -p $TMP_DIR && cd $TMP_DIR
   1.106 +#	=== Fetch archive file, if not existing ===
   1.107  
   1.108 -# Download tarball
   1.109 -wget http://dl.google.com/earth/client/current/GoogleEarthLinux.bin
   1.110 -if [ ! -f GoogleEarthLinux.bin ]; then
   1.111 -	cd $CUR_DIR
   1.112 -	rm -rf $TMP_DIR
   1.113 -	echo "Could not download GoogleEarthLinux.bin. Exiting."
   1.114 -	exit 1
   1.115 +if [ "$version" == "latest" ]
   1.116 +	then
   1.117 +	  FILE="google-earth-stable_current_i386.deb"
   1.118 +	  WGET_URL="https://dl.google.com/dl/earth/client/current/$FILE"
   1.119 +	else
   1.120 +		# only available version is 7.3.0.3832-r0
   1.121 +	  FILE="google-earth-pro-stable_${version}_i386.deb"
   1.122 +	  V1=${version%%.*}
   1.123 +	  V3=${version%.*}
   1.124 +	  WGET_URL="https://dl.google.com/dl/earth/client/GE$V1/release_${V3//./_}/$FILE"
   1.125  fi
   1.126  
   1.127 -chmod +x GoogleEarthLinux.bin
   1.128 -sed -i 's/bzip2 -d/bunzip2/g' GoogleEarthLinux.bin
   1.129 +CUR_DIR=$(pwd)
   1.130 +mkdir -p $TMP_DIR
   1.131 +cd $TMP_DIR
   1.132 +if [ -f $FILE ]
   1.133 +	then
   1.134 +		echo "Using existing archive file $FILE"
   1.135 +	else
   1.136 +		action "Fetching the archive"
   1.137 +		newline
   1.138 +		wget	--no-check-certificate $WGET_URL
   1.139 +		if [ ! -f $FILE ]
   1.140 +		  then
   1.141 +			cd $CUR_DIR
   1.142 +			rm -rf $TMP_DIR
   1.143 +			echo "Could not transfer $FILE from $URL. Exiting."
   1.144 +			exit 1
   1.145 +		fi
   1.146 +fi
   1.147  
   1.148 -VERSION=$(head GoogleEarthLinux.bin | grep ^label | sed 's/.*Linux \(.*\)"/\1/')
   1.149 +#	=== Extract files from archive ===
   1.150 +action "Extracting the archive"
   1.151  
   1.152 -# Add depends
   1.153 -for i in $DEPENDS; do
   1.154 -	yes y | tazpkg get-install $i
   1.155 -done
   1.156 +mkdir $PACKAGE
   1.157 +# Extract metadata
   1.158 +dpkg-deb -e $FILE $PACKAGE/meta
   1.159 +# Extract files
   1.160 +dpkg-deb -x $FILE $PACKAGE/fs
   1.161 +status
   1.162  
   1.163 -# Extract
   1.164 -./GoogleEarthLinux.bin
   1.165 +# Remove archive file
   1.166 +rm -f $FILE
   1.167  
   1.168 -# extracted pkg can be removed: Save RAM
   1.169 -rm -rf GoogleEarthLinux.bin
   1.170 +#	=== Create SliTaz package ===
   1.171  
   1.172 -# Create pseudo package
   1.173 -while read file; do
   1.174 -	dest=google-earth-$VERSION/fs$(dirname $file)
   1.175 -	[ -d $dest ] || mkdir -p $dest
   1.176 -	cp -a $file $dest
   1.177 -done <<EOT
   1.178 -$(ls /*bin/googleearth /usr/*bin/googleearth 2> /dev/null)
   1.179 -$(ls /usr/share/applications/*googleearth*.desktop)
   1.180 -/usr/share/applications/defaults.list
   1.181 -$(ls -d /usr/*/google-earth)
   1.182 -EOT
   1.183 -cat > google-earth-$VERSION/receipt <<EOT
   1.184 -PACKAGE="google-earth"
   1.185 +# Prepare metadata for SliTaz package
   1.186 +sed '/^Description:/,$!d; /^Description:/d' $PACKAGE/meta/control \
   1.187 +	> $PACKAGE/description.txt
   1.188 +
   1.189 +SHORT_DESC="$(sed '/^Description:/!d; s/.*: //' $PACKAGE/meta/control)"
   1.190 +MAINTAINER="$(sed '/^Maintainer:/!d;  s/.*: //' $PACKAGE/meta/control)"
   1.191 +VERSION="$(   sed '/^Version:/!d;     s/.*: //' $PACKAGE/meta/control)"
   1.192 +VERSION=${VERSION%-*}	# remove -r* suffix
   1.193 + 
   1.194 +mv $PACKAGE $PACKAGE-$VERSION
   1.195 +
   1.196 +cd $PACKAGE-$VERSION
   1.197 +
   1.198 +# Create recipe for SliTaz package
   1.199 +cat > receipt <<EOT
   1.200 +# SliTaz package receipt.
   1.201 +
   1.202 +PACKAGE="$PACKAGE"
   1.203  VERSION="$VERSION"
   1.204 -CATEGORY="non-free"
   1.205 -SHORT_DESC="3D planet viewer."
   1.206 -WEB_SITE="http://earth.google.com/"
   1.207 +CATEGORY="$CATEGORY"
   1.208 +TAGS="maps"
   1.209 +SHORT_DESC="$SHORT_DESC"
   1.210 +MAINTAINER="$MAINTAINER"
   1.211 +LICENSE="non-free"
   1.212 +WEB_SITE="$WEB_SITE"
   1.213 +
   1.214  DEPENDS="$DEPENDS"
   1.215 +
   1.216 +post_install()
   1.217 +{
   1.218 +	# Due to different conventions in Debian
   1.219 +	[ -L /lib/ld-lsb.so.3 ] || ln -s ld-2.14.1.so /lib/ld-lsb.so.3
   1.220 +}
   1.221  EOT
   1.222  
   1.223 +# Copy desktop file
   1.224 +cp 	fs/opt/google/earth/pro/google-earth-pro.desktop \
   1.225 +	fs/usr/share/applications/$PACKAGE.desktop
   1.226 +
   1.227 +cd $TMP_DIR
   1.228 +
   1.229 +action "Creating the package $PACKAGE..."
   1.230  # Pack
   1.231  tazpkg pack $PACKAGE-$VERSION
   1.232  
   1.233 -# Clean to save RAM memory
   1.234 +# Remove package tree
   1.235  rm -rf $PACKAGE-$VERSION
   1.236  
   1.237 -# Install pseudo package
   1.238 -tazpkg install google-earth-$VERSION.tazpkg --root=$ROOT
   1.239 +#	=== Install the SliTaz package ===
   1.240 +[ "$install" == "yes" ] &&
   1.241 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
   1.242  
   1.243 -# Clean
   1.244 +#	=== Cleanup ===
   1.245 +# Preserve package file, if requested
   1.246 +[ "$keep" == "yes" ] && mv $PACKAGE-$VERSION.tazpkg $CUR_DIR
   1.247 +
   1.248 +# Remove temporary build directory
   1.249  cd $CUR_DIR
   1.250  rm -rf $TMP_DIR
   1.251 -