diff options
Diffstat (limited to 'system/osquery-bin/osquery-bin.SlackBuild')
-rw-r--r-- | system/osquery-bin/osquery-bin.SlackBuild | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/system/osquery-bin/osquery-bin.SlackBuild b/system/osquery-bin/osquery-bin.SlackBuild index e252f9eadd..dd35ebd18d 100644 --- a/system/osquery-bin/osquery-bin.SlackBuild +++ b/system/osquery-bin/osquery-bin.SlackBuild @@ -1,8 +1,9 @@ -#!/bin/sh +#!/bin/bash # Slackware build script for osquery-bin -# Copyright 2019-2020 Andrew Clemons, Wellington New Zealand +# Copyright 2019-2022 Andrew Clemons, Wellington New Zealand +# Copyright 2022-2024 Andrew Clemons, Tokyo Japan # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -22,11 +23,15 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +cd $(dirname $0) ; CWD=$(pwd) + PRGNAM=osquery-bin SRCNAM=${PRGNAM%-bin} -VERSION=${VERSION:-4.6.0} +VERSION=${VERSION:-5.11.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} +DEBBUILD=${DEBBUILD:-1} if [ -z "$ARCH" ]; then case "$( uname -m )" in @@ -36,25 +41,15 @@ if [ -z "$ARCH" ]; then esac fi -CWD=$(pwd) +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i586" ]; then - SLKCFLAGS="-O2 -march=i586 -mtune=i686" - LIBDIRSUFFIX="" -elif [ "$ARCH" = "i686" ]; then - SLKCFLAGS="-O2 -march=i686 -mtune=i686" - LIBDIRSUFFIX="" -elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="-O2 -fPIC" - LIBDIRSUFFIX="64" -else - SLKCFLAGS="-O2" - LIBDIRSUFFIX="" -fi - set -e rm -rf $PKG @@ -62,7 +57,9 @@ mkdir -p $TMP $PKG $OUTPUT cd $PKG if [ "$ARCH" = "x86_64" ]; then - tar xvf $CWD/$SRCNAM-$VERSION"_1.linux_x86_64.tar.gz" + ar p "$CWD/$SRCNAM"_"$VERSION-$DEBBUILD.linux_amd64.deb" data.tar.gz | tar xzv +elif [ "$ARCH" = "aarch64" ]; then + ar p "$CWD/$SRCNAM"_"$VERSION-$DEBBUILD.linux_arm64.deb" data.tar.gz | tar xzv else printf "$ARCH is not supported...\n" exit 1 @@ -75,14 +72,31 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -rm -rf .scripts +if [ "$ARCH" = "aarch64" ] ; then + find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs patchelf --set-interpreter /lib64/ld-linux-aarch64.so.1 2> /dev/null || true +fi mkdir etc/rc.d mv etc/init.d/osqueryd etc/rc.d/rc.osqueryd.new rm -rf etc/init.d -mv usr/local/* usr/ -rm -rf usr/lib usr/local +rm -rf usr/lib/systemd +rmdir usr/lib + +# make symlinks relative +( + cd "$PKG/usr/bin" + for lnk in osqueryctl osqueryd osqueryi ; do + rm -rf "$lnk" + + if [ "$lnk" = "osqueryi" ] ; then + ln -s "../../opt/osquery/bin/osqueryd" "$lnk" + else + ln -s "../../opt/osquery/bin/$lnk" "$lnk" + fi + done +) mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild @@ -92,4 +106,4 @@ cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE |