#!/bin/bash # Slackware build script for x2goserver # Copyright 2015-2018 Elvio "HelLViS69" Basello # Copyright 2019 Marcus Moeller # 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) # x2goserver-20201227_08aa5e6.tar.xz # x2goserver-20230525_a166907.tar.xz PRGNAM=x2goserver #VERSION=${VERSION:-20230525_a166907} #VERSION=${VERSION:-20220808_1a6c81b} VERSION=${VERSION:-20201227_08aa5e6} #VERSION=${VERSION:-4.1.0.6} 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 the variable PRINT_PACKAGE_NAME is set, then this script will report what # the name of the created package would be, and then exit. This information # could be useful to other scripts. 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 LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then LIBDIRSUFFIX="64" else LIBDIRSUFFIX="" fi set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.?z cd $PRGNAM-$VERSION chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ -o -perm 511 \) -exec chmod 755 {} \; -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; # man2html hangs on some occasions and, BTW, html docs are not even installed sed -i "s|^MAN2HTML_BIN.*|MAN2HTML_BIN = |" */Makefile make PREFIX=/usr LIBDIR=/usr/lib${LIBDIRSUFFIX}/x2go SHAREDIR=/usr/share/x2go make install PREFIX=/usr LIBDIR=/usr/lib${LIBDIRSUFFIX}/x2go SHAREDIR=/usr/share/x2go DESTDIR=$PKG # Move man pages in the proper place and compress them mv $PKG/usr/share/man $PKG/usr find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) do ln -s $( readlink $i ).gz $i.gz rm $i done # .desktop files must not be executable chmod 0644 $PKG/usr/share/applications/*.desktop # xpm image corrupted in the original distribution cp $CWD/x2goagent.xpm $PKG/usr/share/pixmaps/x2goagent.xpm chmod 0644 $PKG/usr/share/pixmaps/x2goagent.xpm # Perl build leftovers. .packlist in particular has $PKG baked into every # path it lists. The X2Go perl modules are arch independent and get installed # in /usr/share/perl5/vendor_perl, so /usr/lib${LIBDIRSUFFIX}/perl5 is empty # once .packlist is gone and can be dropped as well. find $PKG \( -name perllocal.pod -o -name '.packlist' -o -name '*.bs' \) \ -exec rm -f {} \; find $PKG/usr/lib${LIBDIRSUFFIX}/perl5 -depth -type d -empty -delete 2>/dev/null || true # Upstream's x2goagent symlinks are Debian-centric and end up dangling here: # /usr/bin/x2goagent points at /usr/lib/x2go/../nx/bin/x2goagent, which is a # second symlink upstream drops into nx-libs' own directory. Point straight at # the nx-libs binary instead (argv[0] is still x2goagent, so nxagent still # starts in X2Go mode) and don't ship anything under /usr/lib${LIBDIRSUFFIX}/nx, # which belongs to nx-libs. Same for the VERSION file. rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/nx ln -sf /usr/lib${LIBDIRSUFFIX}/nx/bin/nxagent $PKG/usr/bin/x2goagent ln -sf /usr/share/nx/VERSION.nxagent \ $PKG/usr/share/x2go/versions/VERSION.x2goserver-x2goagent # /etc/x2go/Xresources is symlinked to /etc/X11/Xresources, a Debian path that # doesn't exist on Slackware, so the link is always dangling. Xsession only # merges the file when it's readable, so drop the link; an admin who wants # session-wide X resources can just create /etc/x2go/Xresources by hand. rm -f $PKG/etc/x2go/Xresources # Install init script install -D -m 0755 $CWD/rc.x2goserver $PKG/etc/rc.d/rc.x2goserver find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install 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