diff security/linux-pam/linux-pam.sh @ 385:3b0114bc7438

security/linux-pam: initial import, closes #1483
author David Demelier <markand@malikania.fr>
date Mon, 01 Apr 2019 20:10:00 +0200
parents
children 30c785bd1da0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/security/linux-pam/linux-pam.sh	Mon Apr 01 20:10:00 2019 +0200
@@ -0,0 +1,91 @@
+#!/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/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="core/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
+
+build()
+{
+	rm -rf Linux-PAM-$PKGVERSION
+	tar xvaf Linux-PAM-$PKGVERSION.tar.xz
+	pushd 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=/usr/sbin \
+		--disable-db \
+		--libdir=/usr/lib \
+		--docdir=/usr/share/doc/linux-pam \
+		$with_nls \
+		$with_selinux
+	make
+	make install DESTDIR=$DESTDIR
+	rm -f $DESTDIR/usr/lib/libpam{,c,_misc}.la
+	rm -f $DESTDIR/usr/lib/security/pam*.la
+
+	popd
+	rm -rf Linux-PAM-$PKGVERSION
+}