acetoneiso.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #!/bin/bash
  2. # Slackware build script for acetoneiso
  3. # Copyright 2016-2020 Edinaldo P. Silva, Rio de Janeiro, Brazil.
  4. # Copyright 2022 Vijay Marcel
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. cd $(dirname $0) ; CWD=$(pwd)
  24. PRGNAM=acetoneiso
  25. VERSION=${VERSION:-2.4.3}
  26. BUILD=${BUILD:-2}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86)
  32. DEBARCH=i386
  33. ARCH=i586
  34. LIBDIRSUFFIX=""
  35. ;;
  36. x86_64)
  37. DEBARCH=amd64
  38. ARCH=x86_64
  39. LIBDIRSUFFIX="64"
  40. ;;
  41. # unsupported
  42. *)
  43. echo "ARCH $( uname -m ) is unsupported"
  44. exit 1
  45. ;;
  46. esac
  47. else
  48. case "$ARCH" in
  49. i?86)
  50. DEBARCH=i386
  51. LIBDIRSUFFIX=""
  52. ;;
  53. x86_64)
  54. DEBARCH=amd64
  55. LIBDIRSUFFIX="64"
  56. ;;
  57. # unsupported
  58. *)
  59. echo "$ARCH is unsupported"
  60. exit 1
  61. ;;
  62. esac
  63. fi
  64. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  65. # the name of the created package would be, and then exit. This information
  66. # could be useful to other scripts.
  67. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  68. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  69. exit 0
  70. fi
  71. TMP=${TMP:-/tmp/SBo}
  72. PKG=$TMP/package-$PRGNAM
  73. OUTPUT=${OUTPUT:-/tmp}
  74. set -e
  75. trap 'echo "$0 FAILED at line $LINENO!" | tee -a $OUTPUT/error-${PRGNAM}.log' ERR
  76. rm -rf $PKG
  77. mkdir -p $TMP $PKG $OUTPUT
  78. cd $TMP
  79. rm -rf $PRGNAM-$VERSION
  80. mkdir -pv $PRGNAM
  81. cd $PRGNAM
  82. if [ "$DEBARCH" = "i386" ]; then
  83. mv -v $CWD/acetoneiso_2.4-3+b1_i386.deb $CWD/$PRGNAM-$VERSION.deb
  84. ar -x $CWD/$PRGNAM-$VERSION.deb
  85. tar xvf data.tar.xz -C $PKG
  86. elif [ "$DEBARCH" = "amd64" ]; then
  87. mv -v $CWD/acetoneiso_2.4-3+b1_amd64.deb $CWD/$PRGNAM-$VERSION.deb
  88. ar -x $CWD/$PRGNAM-$VERSION.deb
  89. tar xvf data.tar.xz -C $PKG
  90. else
  91. echo "This program is not supported for your System Architecture"
  92. fi
  93. cd $PKG
  94. chown -R root:root .
  95. find -L . \
  96. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  97. -o -perm 511 \) -exec chmod 755 {} \; -o \
  98. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  99. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  100. cd ..
  101. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  102. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  103. mv -v $PKG/usr/share/man $PKG/usr/
  104. rm -rvf $PKG/usr/share/man
  105. find $PKG/usr/man -type f -exec gzip -9 {} \;
  106. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  107. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  108. mv -v $PKG/usr/share/doc/acetoneiso/* $PKG/usr/doc/$PRGNAM-$VERSION
  109. rm -rvf $PKG/usr/share/doc/
  110. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  111. mkdir -p $PKG/install
  112. cat $CWD/slack-desc > $PKG/install/slack-desc
  113. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  114. cd $PKG
  115. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE