turtl.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/bin/bash
  2. # Slackware build script for turtl
  3. # Copyright 2019 Jeff Parent <jeff+SBo@sh0.xyz>
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. cd $(dirname $0) ; CWD=$(pwd)
  23. PRGNAM=turtl
  24. VERSION=${VERSION:-0.7.2.6}
  25. SUFFIX=-pre-sync-fix
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. case "$( uname -m )" in
  30. x86_64)
  31. OS="linux64"
  32. ARCH="x86_64"
  33. ;;
  34. i?86)
  35. OS="linux32"
  36. ARCH="i586"
  37. ;;
  38. esac
  39. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  40. # the name of the created package would be, and then exit. This information
  41. # could be useful to other scripts.
  42. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  43. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  44. exit 0
  45. fi
  46. TMP=${TMP:-/tmp/SBo}
  47. PKG=$TMP/package-$PRGNAM
  48. OUTPUT=${OUTPUT:-/tmp}
  49. set -e
  50. echo "Decompressing archive"
  51. rm -rf $PKG
  52. mkdir -p $TMP $PKG $OUTPUT
  53. cd $TMP
  54. rm -rf $PRGNAM-$VERSION-$OS
  55. tar xvf $CWD/$PRGNAM-$VERSION$SUFFIX-$OS.tar.bz2
  56. cd $PRGNAM-$OS
  57. HERE=$(dirname $(readlink -e ./install.sh))
  58. echo "Preparing pkg dir"
  59. # Install
  60. ROOT=$PKG/opt/turtl
  61. BIN_DIR=$PKG/usr/bin
  62. SHARE=$PKG/usr/share
  63. DESKTOP_DIR=${SHARE}/applications
  64. DESKTOP_FILE=${DESKTOP_DIR}/turtl.desktop
  65. ICON_DIR=${SHARE}/icons/hicolor/128x128/apps
  66. ICON_FILE=${ICON_DIR}/turtl.png
  67. mkdir -p "${ROOT}"
  68. mkdir -p "${BIN_DIR}"
  69. mkdir -p "${SHARE}"
  70. mkdir -p "${DESKTOP_DIR}"
  71. mkdir -p "${ICON_DIR}"
  72. echo "Making Desktop file"
  73. cat >${DESKTOP_FILE} <<EOF
  74. [Desktop Entry]
  75. Type=Application
  76. Name=Turtl
  77. GenericName=Secture notes
  78. Comment=Private notes and bookmarks with collaboration.
  79. Exec=${ROOT}/turtl
  80. Path=${ROOT}
  81. Icon=${ROOT}/icon.png
  82. Terminal=false
  83. Categories=Office;Utility;
  84. Keywords=secure;security;privacy;private;notes;bookmarks;collaborate;research;
  85. StartupNotify=true
  86. EOF
  87. echo "Copying files"
  88. pushd "${HERE}/turtl" > /dev/null
  89. cp -R . ${ROOT}
  90. chmod 755 ${ROOT}
  91. pushd ${ROOT} >/dev/null
  92. find . -type d -exec chmod 755 {} \;
  93. find . -type f -exec chmod 644 {} \;
  94. chmod 755 turtl
  95. popd >/dev/null
  96. mkdir -p "$(dirname "${DESKTOP_FILE}")"
  97. echo "${DESKTOP}" > "${DESKTOP_FILE}"
  98. mkdir -p "${ICON_DIR}"
  99. cp "${HERE}/turtl/icon.png" "${ICON_FILE}"
  100. ln -sf /opt/turtl/turtl ${BIN_DIR}/turtl
  101. echo "Setting permissions"
  102. find "${ROOT}" -perm 700 -exec chmod 755 '{}' \;
  103. find "${ROOT}" -perm 600 -exec chmod 644 '{}' \;
  104. echo "Stripping"
  105. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  106. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  107. echo "Docs"
  108. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  109. cat ${HERE}/turtl/LICENSE > $PKG/usr/doc/$PRGNAM-$VERSION/LICENSE
  110. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  111. echo "Install files"
  112. mkdir -p $PKG/install
  113. cat $CWD/slack-desc > $PKG/install/slack-desc
  114. echo "Making package"
  115. cd $PKG
  116. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE