#!/bin/bash # Slackware build script for snapper # Copyright 2026 Patrick J. Verner, Waupaca, WI, USA # 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=snapper VERSION=${VERSION:-0.13.2} BUILD=${BUILD:-1} TAG=${TAG:-_pmagic} PKGTYPE=${PKGTYPE:-txz} ARCH=x86_64 TMP=${TMP:-/tmp/pmagic} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/build} set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.gz 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 {} \+ # The release tarball ships no configure script (and no autogen.sh); snapper # expects the tree to be bootstrapped. autoreconf does it. autoreconf -fi # No systemd, no zypp, no PAM stack and no SELinux in this image, so none of # those halves of snapper are built. Btrfs only: the LVM and ext4 backends # would pull tooling the image does not carry for them. CXXFLAGS="-O2 -fPIC" \ ./configure \ --prefix=/usr \ --libdir=/usr/lib64 \ --sysconfdir=/etc \ --mandir=/usr/man \ --docdir=/usr/doc/$PRGNAM-$VERSION \ --disable-zypp \ --disable-systemd \ --disable-pam \ --disable-selinux \ --disable-ext4 \ --build=$ARCH-slackware-linux # Patrick's rule: -j8 on the build line, not on install. make -j8 make install DESTDIR=$PKG # Things that cannot work on this image: SUSE's hourly cron job and the # systemd helper. rm -f $PKG/etc/cron.hourly/suse.de-snapper rm -rf $PKG/usr/lib/snapper/systemd-helper rmdir $PKG/etc/cron.hourly 2>/dev/null || true # The D-Bus activation file STAYS. It looks like systemd wiring and is not: # dbus-daemon starts snapperd from it on demand, and without it Btrfs # Assistant's Snapper tab is empty even when snapper works on the command # line (found on the bench, 2026-09-18, by removing it). # A rescue disk does not need 40 translations or the development headers, # the upstream testsuite fixtures, or a libtool archive (this image ships no # .la files -- lt_dlopenext falls back to the .so). rm -rf $PKG/usr/share/locale rm -rf $PKG/usr/include rm -rf $PKG/usr/lib64/snapper/testsuite rm -f $PKG/usr/lib64/*.la rmdir $PKG/usr/lib64/snapper 2>/dev/null || true 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 find $PKG/usr/man -type f -exec gzip -9 {} \+ 2>/dev/null || true # Upstream leaves /etc/sysconfig/snapper to the distribution's packaging (it is # EXTRA_DIST, not installed), and snapper refuses to do anything without it -- # "reading sysconfig-file failed". Ship the stock template. install -D -m 644 data/sysconfig.snapper $PKG/etc/sysconfig/snapper.new mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a COPYING AUTHORS README.md $PKG/usr/doc/$PRGNAM-$VERSION 2>/dev/null || true 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