#!/bin/bash # Slackware build script for nvidia-fabricmanager # Copyright 2024 GUAN Xin from Beijing # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # 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=nvidia-fabricmanager VERSION=${VERSION:-550.54.14} SRCVER=${SRCVER:-$(printf "%s_%s-1" `echo $VERSION | cut -d. -f1,1` $VERSION)} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$PKGVER-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "x86_64" ]; then SRCARCH=amd64 else echo "$ARCH is not supported" exit 1 fi set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $PKG ar p $CWD/$PRGNAM-${SRCVER}_$SRCARCH.deb data.tar.xz | tar -Jxv # This file should really be under /etc but let's keep it as is for the # least surpise of users migrated from other distributions to Slackware: mv $PKG/usr/share/nvidia/nvswitch/fabricmanager.cfg $PKG/usr/share/nvidia/nvswitch/fabricmanager.cfg.new # Replace systemd files with sysvinit script rm -fr $PKG/lib mkdir -p $PKG/etc/rc.d cat $CWD/rc.nvidia-fabricmanager > $PKG/etc/rc.d/rc.nvidia-fabricmanager chmod 755 $PKG/etc/rc.d/rc.nvidia-fabricmanager mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION mv -t $PKG/usr/doc/$PRGNAM-$VERSION $PKG/usr/share/doc/$PRGNAM/* rm -fr $PKG/usr/share/doc cp -t $PKG/usr/doc/$PRGNAM-$VERSION $CWD/README* cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE