google-earth.SlackBuild 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/bin/bash
  2. # Slackware build script for google-earth
  3. # Copyright 2007-2013 Michiel van Wessem, Manchester, United Kingdom
  4. # Copyright 2016-2018 Willy Sudiarto Raharjo <willysr@slackbuilds.org>
  5. # Copyright 2021 Lenard Spencer, Orlando, Florida, USA
  6. # All rights reserved.
  7. #
  8. # Redistribution and use of this script, with or without modification, is
  9. # permitted provided that the following conditions are met:
  10. #
  11. # 1. Redistributions of this script must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  15. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  17. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  18. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  22. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  23. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. # 2013 - A lot of thanks to Willy Sudiarto Raharjo for his input and help
  25. # with converting the script to work with google's .deb packages.
  26. # Thanks to rworkman for the additional code and script cleanups
  27. # and to Daniel de Kok and Alan_Hicks for their comments.
  28. cd $(dirname $0) ; CWD=$(pwd)
  29. PRGNAM=google-earth
  30. VERSION=${VERSION:-7.3.4}
  31. BUILD=${BUILD:-1}
  32. TAG=${TAG:-_SBo}
  33. PKGTYPE=${PKGTYPE:-tgz}
  34. if [ -z "$ARCH" ]; then
  35. case "$( uname -m )" in
  36. i?86) ARCH=i586 ;;
  37. *) ARCH=$( uname -m ) ;;
  38. esac
  39. fi
  40. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  41. # the name of the created package would be, and then exit. This information
  42. # could be useful to other scripts.
  43. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  44. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  45. exit 0
  46. fi
  47. TMP=${TMP:-/tmp/SBo}
  48. PKG=$TMP/package-$PRGNAM
  49. OUTPUT=${OUTPUT:-/tmp}
  50. if [ "$ARCH" = "x86_64" ]; then
  51. SRCARCH="amd64"
  52. else
  53. echo "This architecture is unsupported. Aborting."
  54. exit 1
  55. fi
  56. # No flags/configure needed as it is just a binary repackaging.
  57. set -e
  58. FULLVERSION=$(ar p google-earth-pro-stable_${VERSION}_${SRCARCH}.deb control.tar.xz 2> /dev/null | tar JxO ./control 2> /dev/null | grep Version | awk '{print $2}' | cut -d- -f1)
  59. if [ -z "$FULLVERSION" ]; then # try to use control.tar.gz instead:
  60. FULLVERSION=$(ar p google-earth-pro-stable_${VERSION}_${SRCARCH}.deb control.tar.gz 2> /dev/null | tar zxO ./control 2> /dev/null | grep Version | awk '{print $2}' | cut -d- -f1)
  61. fi
  62. rm -rf $PKG
  63. mkdir -p $TMP $PKG $OUTPUT
  64. cd $PKG
  65. ar p $CWD/google-earth-pro-stable_${VERSION}_${SRCARCH}.deb data.tar.xz | tar xJv
  66. cd $PKG
  67. chown -R root:root .
  68. # Fix Google braindeadness (and mine)
  69. find . -type d -exec chmod 0755 {} \;
  70. find -L . \
  71. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  72. -o -perm 511 \) -exec chmod 755 {} \; -o \
  73. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  74. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  75. # Sadly (by lack of a more polite word), Google has some inconsistent
  76. # permissions for normal files; this should deal with them rather nicely.
  77. find -L . \( -name "*.png" -o -name "*.kml" -o -name "*.xml" \) -exec chmod 0644 {} \;
  78. # Install a .desktop launcher:
  79. mv $PKG/opt/google/earth/pro/google-earth-pro.desktop $PKG/usr/share/applications/google-earth.desktop
  80. # Copy icons to /usr/share/icons
  81. for icon in 16 22 24 32 48 64 128 256; do
  82. install -D $PKG/opt/google/earth/pro/product_logo_${icon}.png \
  83. $PKG/usr/share/icons/hicolor/${icon}x${icon}/apps/${PRGNAM}-pro.png
  84. done
  85. # Install mimetypes
  86. mkdir -p $PKG/usr/share/mime/packages/
  87. cat $CWD/google-earth-mimetypes.xml > $PKG/usr/share/mime/packages/$PRGNAM-mimetypes.xml
  88. # Let's take care of documentation
  89. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  90. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  91. # Clean up cruft/unneeded directories.The cron job in /etc is for Debian/Ubuntu only:
  92. rm -rf $PKG/etc
  93. rm -rf $PKG/usr/share/{man,menu,gnome-control-center}
  94. mkdir -p $PKG/install
  95. cat $CWD/slack-desc > $PKG/install/slack-desc
  96. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  97. cd $PKG
  98. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE