Files
BMLFS/build-scripts/Linux-PAM.build
Derrick a56ca22d69 Upgraded Linux-PAM to 1.5.2
Updated build as MLFS will have /bin:/sbin:/lib linked to /usr
2021-11-17 10:36:29 -06:00

108 lines
3.9 KiB
Bash

#! /bin/bash
# Linux-PAM-1.5.2
# Source: https://github.com/linux-pam/linux-pam/releases/download/v1.5.2/Linux-PAM-1.5.2.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 "
# disable insecure modules
sed -e 's/pam_rhosts//g' -i modules/Makefile.am
autoreconf -fvi &&
# Enable utmps support
patch -Np1 -i ../patches/Linux-PAM-adelie/use-utmpx.patch
ac_cv_search_crypt=no \
./configure --prefix=/usr \
--sysconfdir=/etc \
--libdir=/usr/lib \
--enable-securedir=/lib/security \
--docdir=/usr/share/doc/Linux-PAM-1.5.2 \
--disable-nls \
--disable-audit $BUILDTUPLE &&
read -p "Compile? " && make -j2 &&
read -p "Press Enter to install" &&
# if not using a package manager:
# make install
# if using pkgtools from Slackware, then:
su -c "make DESTDIR=$BUILD install"
su -c "install -vdm755 ${BUILD}/etc/pam.d"
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
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/" &&
# lib is now linked to /usr/lib
#for file in pam_misc pamc
#do
# su -c "mv -v usr/lib/lib${file}.so.* lib/" &&
# su -c "ln -sfv ../../lib/lib${file}.so.0.82.1 usr/lib/lib${file}.so"
# su -c "rm -v usr/lib/lib${file}.so.0"
# su -c "ln -sfv ../../lib/lib${file}.so.0.82.1 usr/lib/lib${file}.so.0"
#done
# lib is now linked to /usr/lib
#su -c "mv -v usr/lib/libpam.so.0.85.1 lib/"
#su -c "rm -v usr/lib/libpam.so usr/lib/libpam.so.0"
#su -c "ln -sfv ../../lib/libpam.so.0.85.1 usr/lib/libpam.so"
#su -c "ln -sfv ../../lib/libpam.so.0.85.1 usr/lib/libpam.so.0"
#su -c "ln -sfv libpam.so.0.85.1 lib/libpam.so.0"
# sbin is now linked to /usr/sbin
su -c "mv -v sbin usr/"
read -p "Enter to build package" &&
su -c "makepkg -l y -c n $PKGS/linux-pam-1.5.2-$(uname -m)-mlfs.txz" &&
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.5.2-$(uname -m)-mlfs.txz" &&
su -c "rm -rf ${BUILD}/*"