You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
4.8 KiB

  1. #!/bin/bash
  2. # Slackware build script for ocfs2-tools
  3. # Copyright 2019 Mario Preksavec, Zagreb, Croatia
  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. # 20220210 bkw: Modified by SlackBuilds.org: use correct github download URL,
  23. # and update for v1.8.7 as the old version doesn't support 15.0's kernel.
  24. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=ocfs2-tools
  26. VERSION=${VERSION:-1.8.7}
  27. BUILD=${BUILD:-1}
  28. TAG=${TAG:-_SBo}
  29. PKGTYPE=${PKGTYPE:-tgz}
  30. if [ -z "$ARCH" ]; then
  31. case "$( uname -m )" in
  32. i?86) ARCH=i586 ;;
  33. arm*) ARCH=arm ;;
  34. *) ARCH=$( uname -m ) ;;
  35. esac
  36. fi
  37. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  38. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  39. exit 0
  40. fi
  41. TMP=${TMP:-/tmp/SBo}
  42. PKG=$TMP/package-$PRGNAM
  43. OUTPUT=${OUTPUT:-/tmp}
  44. if [ "$ARCH" = "i586" ]; then
  45. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  46. LIBDIRSUFFIX=""
  47. elif [ "$ARCH" = "i686" ]; then
  48. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  49. LIBDIRSUFFIX=""
  50. elif [ "$ARCH" = "x86_64" ]; then
  51. SLKCFLAGS="-O2 -fPIC"
  52. LIBDIRSUFFIX="64"
  53. else
  54. SLKCFLAGS="-O2"
  55. LIBDIRSUFFIX=""
  56. fi
  57. # GUI support, includes a desktop icon
  58. GUI=${GUI:-no}
  59. case ${GUI,,} in
  60. yes) ENABLE_GUI="--enable-ocfs2console=yes" ;;
  61. *) ENABLE_GUI="" ;;
  62. esac
  63. set -e
  64. rm -rf $PKG
  65. mkdir -p $TMP $PKG $OUTPUT
  66. cd $TMP
  67. rm -rf $PRGNAM-{$VERSION,$PRGNAM-$VERSION}
  68. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || tar xvf $CWD/$PRGNAM-$PRGNAM-$VERSION.tar.gz
  69. cd $PRGNAM-$VERSION || cd $PRGNAM-$PRGNAM-$VERSION
  70. chown -R root:root .
  71. find -L . \
  72. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  73. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  74. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  75. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  76. CFLAGS="$SLKCFLAGS" \
  77. CXXFLAGS="$SLKCFLAGS" \
  78. ./autogen.sh \
  79. --prefix=/usr \
  80. --libdir=/usr/lib${LIBDIRSUFFIX} \
  81. --sysconfdir=/etc \
  82. --localstatedir=/var \
  83. --mandir=/usr/man \
  84. $ENABLE_GUI \
  85. --build=$ARCH-slackware-linux
  86. make -j1
  87. make install DESTDIR=$PKG
  88. # Copy init scripts and fix them
  89. install -D -m0755 -oroot -groot vendor/common/o2cb.init $PKG/etc/rc.d/rc.o2cb.new
  90. install -D -m0755 -oroot -groot vendor/common/ocfs2.init $PKG/etc/rc.d/rc.ocfs2.new
  91. sed -e 's|/etc/redhat-release|/etc/init.d/functions|' \
  92. -i $PKG/etc/rc.d/rc.o2cb.new \
  93. -i $PKG/etc/rc.d/rc.ocfs2.new
  94. # Default settings, udev rules and sample configuration
  95. install -D -m0644 -oroot -groot vendor/common/o2cb.sysconfig \
  96. $PKG/etc/default/o2cb.new
  97. install -D -m0644 -oroot -groot vendor/common/51-ocfs2.rules \
  98. $PKG/lib/udev/rules.d/51-ocfs2.rules
  99. install -D -m0644 -oroot -groot documentation/samples/cluster.conf \
  100. $PKG/etc/ocfs2/cluster.conf.sample
  101. # More GUI stuff
  102. case ${GUI,,} in
  103. yes) install -D -m0644 -oroot -groot vendor/common/ocfs2console.desktop \
  104. $PKG/usr/share/applications/ocfs2console.desktop
  105. install -D -m0644 -oroot -groot vendor/common/ocfs2console.png \
  106. $PKG/usr/share/icons/hicolor/48x48/apps/ocfs2console.png
  107. sed -e 's#^\(Icon=\).*#\1/usr/share/icons/hicolor/48x48/apps/ocfs2console.png#' \
  108. -i $PKG/usr/share/applications/ocfs2console.desktop
  109. ;;
  110. esac
  111. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  112. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  113. find $PKG/usr/man -type f -exec gzip -9 {} \;
  114. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  115. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  116. cp CREDITS MAINTAINERS README.O2CB documentation/*.* $PKG/usr/doc/$PRGNAM-$VERSION
  117. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  118. cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
  119. mkdir -p $PKG/install
  120. cat $CWD/slack-desc > $PKG/install/slack-desc
  121. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  122. cd $PKG
  123. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE