Files
BMLFS/build-scripts/Linux-PAM.build
2025-06-15 13:37:06 -05:00

84 lines
3.1 KiB
Bash

#! /bin/bash
# Linux-PAM
# Source: https://github.com/linux-pam/linux-pam/releases/download/v1.7.0/Linux-PAM-1.7.0.tar.xz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: None
# Optional: Berkeley DB, libnsl, libtirpc, libaudit, and Prelude
# Optional for docs: docbook-xml, docbook-xsl, fop, libxslt and either Lynx or W3m
# If optimizing, use these flags
export CFLAGS="-march=native -mtune=native -pipe "
export CFLAGS+="-O3 -ffat-lto-objects -flto=4 "
export CFLAGS+="-fstack-protector-strong -fzero-call-used-regs=used "
export LDFLAGS="-Wl,-O2 -Wl,--as-needed "
# For CMLFS, examples don't build
#patch -Np1 -i ../patches/linux-pam-chimera/no-examples.patch
meson setup --prefix=/usr --buildtype=release \
-D docdir=/usr/share/doc/Linux-PAM-1.7.0 OUT
read -p "Compile? " && ninja -C OUT -j2 &&
read -p "Press Enter to install" &&
# if not using a package manager:
# ninja -C OUT install
# if using pkgtools from Slackware, then:
su -c "DESTDIR=$BUILD ninja -C OUT install"
su -c "chmod -v 4755 $BUILD/usr/sbin/unix_chkpwd"
su -c "install -vdm755 ${BUILD}/etc/pam.d"
# Create the configuration files:
for f in other system-account system-auth system-password system-session
do
su -c "cp -v ../files/Linux-PAM-lfs/$f ${BUILD}/etc/pam.d/"
done
# Per LFS,remove an unneeded directory
su -c "rm -rf $BUILD/usr/lib/systemd"
read -p "Press Enter to create pakage description."
cd $BUILD && su -c "mkdir -v install" &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
linux-pam: linux-pam (Pluggable Authentication Modules)
linux-pam:
linux-pam: Linux-PAM is a library that enables the local system administrator
linux-pam: to choose how individual applications authenticate users. The purpose
linux-pam: of the Linux-PAM project is to liberate the development of privilege
linux-pam: granting software from the development of secure and appropriate
linux-pam: authentication schemes.
linux-pam:
linux-pam: Homepage: https://github.com/linux-pam/linux-pam
linux-pam:
linux-pam:
EOF
su -c "mv /tmp/slack-desc install/" &&
read -p "Enter to build package" &&
su -c "makepkg -l y -c n $PKGS/linux-pam-1.7.0-$PSUFFIX" &&
cp -v install/doinst.sh /tmp/
cat >> /tmp/doinst.sh << "EOF"
chmod -v 4755 /sbin/unix_chkpwd
echo ">>Recommended to re-install shadow with PAM support.<<"
EOF
su -c "mv -v /tmp/doinst.sh install/"
su -c "makepkg -l y -c n $PKGS/linux-pam-1.7.0-$PSUFFIX" &&
su -c "rm -rf ${BUILD}/*"