view security/linux-pam/linux-pam.sh @ 1218:57dc83a39b13

misc: switch back to standard FHS
author David Demelier <markand@malikania.fr>
date Thu, 30 Sep 2021 08:58:34 +0200
parents 27d1a83dc8d6
children 4ccc42bf0284
line wrap: on
line source

#!/bin/sh
#
# Copyright (c) 2019 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

PKGNAME=linux-pam
PKGVERSION=1.3.1
PKGREVISION=1
PKGLICENSE="BSD"
PKGSUMMARY="pluggable authentication modules"
PKGDOWNLOAD="https://github.com/linux-pam/linux-pam/releases/download/v$PKGVERSION/Linux-PAM-$PKGVERSION.tar.xz"
PKGOPTIONS="NLS SELINUX"
PKGPROTECT="etc/environment
            etc/pam.d/other
            etc/pam.d/system-account
            etc/pam.d/system-auth
            etc/pam.d/system-password
            etc/pam.d/system-session
            etc/security/access.conf
            etc/security/group.conf
            etc/security/limits.conf
            etc/security/namespace.conf
            etc/security/namespace.init
            etc/security/pam_env.conf
            etc/security/time.conf"

: ${CHOST:=$(uname -m)-linux-musl}
: ${CBUILD:=$(uname -m)-linux-musl}
: ${CC:=clang}
: ${CFLAGS:=-O2}
: ${LDFLAGS:=}
: ${LIBS:=}
: ${NLS:=yes}
: ${SELINUX:=no}

if [ "$NLS" = "yes" ]; then
	PKGDEPENDS="gettext $PKGDEPENDS"
	with_nls="--enable-nls"
else
	with_nls="--disable-nls"
fi

if [ "$SELINUX" = "yes" ]; then
	with_selinux="--enable-selinux"
else
	with_selinux="--disable-selinux"
fi

rm -rf Linux-PAM-$PKGVERSION
tar xvf Linux-PAM-$PKGVERSION.tar.xz
cd Linux-PAM-$PKGVERSION

# https://git.alpinelinux.org/aports/tree/main/linux-pam/APKBUILD#n32
sed -i -e 's/pam_rhosts//g' modules/Makefile.am

# https://git.alpinelinux.org/aports/plain/main/linux-pam/musl-fix-pam_exec.patch
# https://git.alpinelinux.org/aports/plain/main/linux-pam/fix-compat.patch
patch -p0 < ../musl.patch

autoreconf -vif
CC="$CC" \
CFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" \
LIBS="$LIBS" \
./configure \
	--build=$CBUILD \
	--host=$CHOST \
	--prefix=/usr \
	--sbindir=/bin \
	--includedir=/include/security \
	--disable-db \
	--libdir=/lib \
	--docdir=/share/doc/linux-pam \
	$with_nls \
	$with_selinux
make
make install DESTDIR=$DESTDIR
install -Dm0600 ../other $DESTDIR/etc/pam.d/other
install -Dm0600 ../system-account $DESTDIR/etc/pam.d/system-account
install -Dm0600 ../system-auth $DESTDIR/etc/pam.d/system-auth
install -Dm0600 ../system-password $DESTDIR/etc/pam.d/system-password
install -Dm0600 ../system-session $DESTDIR/etc/pam.d/system-session
find $DESTDIR -type f -name "*.la" -delete

cd ..
rm -rf Linux-PAM-$PKGVERSION