#!/bin/bash # Slackware build script for mokutil # Written 2026-10-14 for Parted Magic. New: no mokutil has shipped before and # there is no SBo recipe. A customer asked for it. # # mokutil queues Machine Owner Key requests for shim's MokManager (mmx64.efi, # which the ISO already carries in EFI/boot) and lists the Secure Boot # databases (PK, KEK, db, dbx, MokList, MokListX). It links openssl, efivar, # keyutils and libcrypt, all four already in the image. # # Pinned explicitly rather than left to configure: # --disable-strict upstream turns -Werror on only inside a git checkout; # say so, so a newer GCC warning cannot fail the build # bash completion the stock -current place; build strips # usr/share/bash-completion from the image anyway set -e cd "$(dirname "$0")" ; CWD=$(pwd) PRGNAM=mokutil VERSION=${VERSION:-0.7.2} BUILD=${BUILD:-1} TAG=${TAG:-_pmagic} PKGTYPE=${PKGTYPE:-txz} ARCH=${ARCH:-x86_64} if [ -n "${PRINT_PACKAGE_NAME:-}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"; exit 0 fi TMP=${TMP:-/tmp/pm-build} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-$TMP} NUMJOBS=${NUMJOBS:--j12} SLKCFLAGS="-O2 -fPIC" rm -rf "$PKG" "$TMP/$PRGNAM-$VERSION" mkdir -p "$TMP" "$PKG" "$OUTPUT" cd "$TMP" tar xzf "$CWD/$PRGNAM-$VERSION.tar.gz" cd "$PRGNAM-$VERSION" chown -R root:root . find . -perm /111 -a \! -perm 755 -exec chmod 755 {} \+ -o \ \! -perm /111 -a \! -perm 644 -exec chmod 644 {} \+ # The GitHub tag archive carries no configure script. NOCONFIGURE=1 ./autogen.sh CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --libdir=/usr/lib64 \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/man \ --disable-strict \ --with-bash-completion-dir=/usr/share/bash-completion/completions \ --build=$ARCH-slackware-linux make $NUMJOBS make install DESTDIR="$PKG" 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 {} \; mkdir -p "$PKG/usr/doc/$PRGNAM-$VERSION" # AUTHORS, ChangeLog and NEWS are empty in 0.7.2; take only what has content for f in AUTHORS COPYING ChangeLog NEWS README TODO; do [ -s "$f" ] && cp -a "$f" "$PKG/usr/doc/$PRGNAM-$VERSION/" done cp -a "$CWD/$PRGNAM.SlackBuild" "$CWD/$PRGNAM.info" "$PKG/usr/doc/$PRGNAM-$VERSION/" mkdir -p "$PKG/install" cat > "$PKG/install/slack-desc" <<'EOD' |-----handy-ruler------------------------------------------------------| mokutil: mokutil (manage Machine Owner Keys) mokutil: mokutil: mokutil lists the UEFI Secure Boot key databases (PK, KEK, db, dbx) mokutil: and shim's Machine Owner Key lists, and queues requests to enroll or mokutil: delete keys and hashes, which shim's MokManager carries out at the mokutil: next boot. It also turns shim's own signature checking on or off. mokutil: mokutil: Homepage: https://github.com/lcp/mokutil mokutil: mokutil: mokutil: EOD cd "$PKG" /sbin/makepkg -l y -c n "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"