google-earth-legacy.SlackBuild 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #!/bin/bash
  2. # Slackware build script for google-earth-legacy
  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-legacy
  30. VERSION=${VERSION:-7.3.0.3832}
  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" = "i586" ]; then
  51. SRCARCH="i386"
  52. elif [ "$ARCH" = "x86_64" ]; then
  53. SRCARCH="amd64"
  54. else
  55. echo "This system is unsupported. Aborting."
  56. exit 1
  57. fi
  58. # No flags/configure needed as it is just a binary repackaging.
  59. set -e
  60. rm -rf $PKG
  61. mkdir -p $TMP $PKG $OUTPUT
  62. cd $PKG
  63. ar p $CWD/google-earth-pro-stable_${VERSION}-r0_${SRCARCH}.deb data.tar.xz | tar xJv
  64. cd $PKG
  65. chown -R root:root .
  66. # Fix Google braindeadness (and mine)
  67. find . -type d -exec chmod 0755 {} \;
  68. find -L . \
  69. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  70. -o -perm 511 \) -exec chmod 755 {} \; -o \
  71. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  72. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  73. # Sadly (by lack of a more polite word), Google has some inconsistent
  74. # permissions for normal files; this should deal with them rather nicely.
  75. find -L . \( -name "*.png" -o -name "*.kml" -o -name "*.xml" \) -exec chmod 0644 {} \;
  76. # Install a .desktop launcher:
  77. mv $PKG/opt/google/earth/pro/google-earth-pro.desktop $PKG/usr/share/applications/google-earth.desktop
  78. # Copy icons to /usr/share/icons
  79. for icon in 16 22 24 32 48 64 128 256; do
  80. install -D $PKG/opt/google/earth/pro/product_logo_${icon}.png \
  81. $PKG/usr/share/icons/hicolor/${icon}x${icon}/apps/${PRGNAM}-pro.png
  82. done
  83. # Install mimetypes
  84. mkdir -p $PKG/usr/share/mime/packages/
  85. cat $CWD/google-earth-mimetypes.xml > $PKG/usr/share/mime/packages/$PRGNAM-mimetypes.xml
  86. # Let's take care of documentation
  87. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  88. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  89. # Clean up cruft/unneeded directories.The cron job in /etc is for Debian/Ubuntu only:
  90. rm -rf $PKG/etc
  91. rm -rf $PKG/usr/share/{man,menu,gnome-control-center}
  92. mkdir -p $PKG/install
  93. cat $CWD/slack-desc > $PKG/install/slack-desc
  94. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  95. # Add ld-lsb.so symlink creation to doinst.sh
  96. if [ "$ARCH" = "x86_64" ]; then
  97. cat >> $PKG/install/doinst.sh << "EOF"
  98. # Create ld-lsb symlink
  99. ( cd lib64
  100. if [ ! -e ld-lsb-x86-64.so.3 ]; then
  101. ln -sf ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3
  102. fi
  103. )
  104. EOF
  105. else
  106. cat >> $PKG/install/doinst.sh << "EOF"
  107. # Create ld-lsb symlink
  108. ( cd lib
  109. if [ ! -e ld-lsb.so.3 ]; then
  110. ln -sf ld-linux.so.2 ld-lsb.so.3
  111. fi
  112. )
  113. EOF
  114. fi
  115. cd $PKG
  116. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE