google-musicmanager.SlackBuild 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/bin/bash
  2. # Slackware build script for google-musicmanager
  3. # Written by Steven Pledger <spledger91@yahoo.com>
  4. # Based on google-chrome.SlackBuild from Slackware
  5. # Copyright 2009-2010,2014-2015 Erik Hanson, Minneapolis, MN, USA
  6. # Copyright 2011 Patrick J. Volkerding, Sebeka, MN, USA
  7. # Copyright 2011 Steven Pledger, Vacaville, CA, USA
  8. # All rights reserved.
  9. #
  10. # Redistribution and use of this script, with or without modification, is
  11. # permitted provided that the following conditions are met:
  12. #
  13. # 1. Redistributions of this script must retain the above copyright
  14. # notice, this list of conditions and the following disclaimer.
  15. #
  16. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  17. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  19. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  22. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  23. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  24. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  25. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. # 20220322 bkw: Modified by SlackBuilds.org: fix 32-bit build.
  27. cd $(dirname $0) ; CWD=$(pwd)
  28. PRGNAM=google-musicmanager
  29. VERSION=${VERSION:-1.0.467.4929}
  30. BUILD=${BUILD:-1}
  31. TAG=${TAG:-_SBo}
  32. PKGTYPE=${PKGTYPE:-tgz}
  33. # 20220322 bkw: changed this stuff to allow building a 32-bit package
  34. # on x86_64 with 'export ARCH=i586', or build a 64-bit package on
  35. # 32-bit with 'export ARCH=x86_64'. Please leave it this way; it makes
  36. # testing ever so much simpler.
  37. if [ -z "$ARCH" ]; then
  38. case "$( uname -m )" in
  39. i?86) ARCH=i586 ;;
  40. arm*) ARCH=arm ;;
  41. *) ARCH=$( uname -m ) ;;
  42. esac
  43. fi
  44. case "$ARCH" in
  45. i?86) DEBARCH="i386" ; LIBDIRSUFFIX="" ; if [ "$VERSION" = "1.0.467.4929" ] ; then VERSION=1.0.243.1116 ; fi ;;
  46. x86_64) DEBARCH="amd64" ; LIBDIRSUFFIX="64" ;;
  47. *) echo "Package for $(uname -m) architecture is not available." ; exit 1 ;;
  48. esac
  49. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  50. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  51. exit 0
  52. fi
  53. TMP=${TMP:-/tmp/SBo}
  54. PKG=$TMP/package-$PRGNAM
  55. OUTPUT=${OUTPUT:-/tmp}
  56. RELEASE=${RELEASE:-beta} # stable, beta, or unstable
  57. # Get the version from the Debian/Ubuntu .deb (thanks to Fred Richards):
  58. SRCVER=$(ar p $PRGNAM-${RELEASE}_current_${DEBARCH}.deb control.tar.gz 2> /dev/null | tar zxO ./control 2> /dev/null | grep Version | awk '{print $2}' | cut -d- -f1)
  59. if [ "$VERSION" != "$SRCVER" ]; then
  60. cat <<EOF
  61. WARNING: The source version ($SRCVER) does not match the VERSION variable ($VERSION).
  62. To build anyway, run the SlackBuild like this:
  63. VERSION=$SRCVER ./$PRGNAM.SlackBuild
  64. exiting...
  65. EOF
  66. exit 1
  67. fi
  68. set -e
  69. rm -rf $PKG
  70. mkdir -p $TMP $PKG $OUTPUT
  71. cd $PKG
  72. # 20220322 bkw: 32-bit .deb has lzma compression, not xz. Handle either.
  73. DEB=$CWD/$PRGNAM-${RELEASE}_current_${DEBARCH}.deb
  74. for i in lzma xz; do
  75. ar -t "$DEB" | fgrep -q data.tar.$i && COMP=$i
  76. done
  77. ar p $DEB data.tar.$COMP | $COMP -d | tar xv
  78. # 20220218 bkw: absolute path symlink in deb, no good.
  79. rm -f usr/bin/$PRGNAM
  80. ln -s ../../opt/google/musicmanager/MusicManager usr/bin/$PRGNAM
  81. chown -R root:root .
  82. find -L . \
  83. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  84. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  85. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  86. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  87. # Make sure top-level perms are correct:
  88. chmod 0755 .
  89. # The cron job is for Debian/Ubuntu only:
  90. rm -rf etc
  91. # Nothing in here
  92. rm -rf usr/share/man
  93. # Install a .desktop launcher:
  94. sed -i -e "s#Icon=google-musicmanager#Icon=/opt/google/musicmanager/product_logo_128.png#" \
  95. $PKG/opt/google/musicmanager/google-musicmanager.desktop
  96. mkdir -p $PKG/usr/share/applications
  97. ln -s /opt/google/musicmanager/google-musicmanager.desktop \
  98. $PKG/usr/share/applications/google-musicmanager.desktop
  99. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  100. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  101. mkdir -p $PKG/install
  102. cat $CWD/slack-desc > $PKG/install/slack-desc
  103. cd $PKG
  104. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE