summaryrefslogtreecommitdiff
path: root/repo/system/shadow/shadow.xibuild
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
committerdavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
commit739c65c54cb0e957df5e9b76f93fb02554e5cac3 (patch)
tree09ddfa0a342f3ea9de136cb50abdd79821bf1b53 /repo/system/shadow/shadow.xibuild
parent4c585ad54388285500fd18a6aaa516894e0f2c16 (diff)
moved everything to new file formatting
Diffstat (limited to 'repo/system/shadow/shadow.xibuild')
-rw-r--r--repo/system/shadow/shadow.xibuild136
1 files changed, 136 insertions, 0 deletions
diff --git a/repo/system/shadow/shadow.xibuild b/repo/system/shadow/shadow.xibuild
new file mode 100644
index 0000000..22bd2f1
--- /dev/null
+++ b/repo/system/shadow/shadow.xibuild
@@ -0,0 +1,136 @@
+#!/bin/sh
+
+MAKEDEPS="make "
+DEPS="acl libcap libxcrypt"
+
+PKG_VER=4.11.1
+
+SOURCE=https://github.com/shadow-maint/shadow/releases/download/v$PKG_VER/shadow-$PKG_VER.tar.xz
+DESC="Password and account management tool suite with support for shadow files and PAM"
+ADDITIONAL="
+ chage.pamd
+ chpasswd.pamd
+ login.pamd
+ newusers.pamd
+ passwd.pamd
+ su.pamd
+"
+
+prepare () {
+
+ sed -i 's/groups$(EXEEXT) //' src/Makefile.in
+ find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
+ find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
+ find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
+
+ sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \
+ -e 's:/var/spool/mail:/var/mail:' \
+ -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \
+ -i etc/login.defs
+
+ mkdir -p $PKG_DEST/usr/bin
+ touch $PKG_DEST/usr/bin/passwd
+
+}
+
+build () {
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --disable-account-tools-setuid \
+ --disable-nls \
+ --without-audit \
+ --with-libpam \
+ --without-selinux \
+ --without-acl \
+ --without-attr \
+ --without-tcb \
+ --with-yescrypt \
+ --without-nscd \
+ --without-group-name-max-length \
+ --with-fcaps
+
+ make
+}
+
+package () {
+ make exec_prefix=/usr DESTDIR=$PKG_DEST install
+ make DESTDIR=$PKG_DEST -C man install-man
+ mkdir -p $PKG_DEST/etc/default
+
+ [ -d $PKG_DEST/etc/pam.d ] && rm -rf $PKG_DEST/etc/pam.d/*
+
+
+ install -m644 $PKG_DEST/etc/login.defs $PKG_DEST/etc/login.defs.orig &&
+ echo "USERGROUPS_ENAB yes"> $PKG_DEST/etc/login.defs
+
+ for f in $ADDITIONAL; do
+ case $f in
+ *.pamd)
+ cp $f $PKG_DEST/etc/pam.d/${f%.pamd}
+ ;;
+ esac
+ done
+ cp $PKG_DEST/etc/pam.d/su $PKG_DEST/etc/pam.d/su-l
+
+ for PROGRAM in chfn chgpasswd chsh groupadd groupdel \
+ groupmems groupmod useradd userdel usermod
+ do
+ install -m644 chage.pamd $PKG_DEST/etc/pam.d/${PROGRAM}
+ sed -i "s/chage/$PROGRAM/" $PKG_DEST/etc/pam.d/${PROGRAM}
+ done
+
+ [ -f $PKG_DEST/etc/login.access ] && mv $PKG_DEST/etc/login.access $PKG_DEST/etc/login.access.NOUSE || true
+ [ -f $PKG_DEST/etc/limits ] && mv $PKG_DEST/etc/limits $PKG_DEST/etc/limits.NOUSE || true
+
+ rm $PKG_DEST/usr/bin/su
+}
+
+postinstall () {
+
+ [ ! -f /etc/passwd ] &&
+ cat > /etc/passwd << "EOF"
+root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/dev/null:/usr/bin/false
+daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false
+messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/usr/bin/false
+uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false
+nobody:x:99:99:Unprivileged User:/dev/null:/usr/bin/false
+EOF
+
+ [ ! -f /etc/group ] &&
+ cat > /etc/group << "EOF"
+root:x:0:root
+bin:x:1:daemon
+sys:x:2:
+kmem:x:3:
+tape:x:4:
+tty:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+dialout:x:10:
+audio:x:11:
+video:x:12:
+utmp:x:13:
+usb:x:14:
+cdrom:x:15:
+adm:x:16:
+messagebus:x:18:
+input:x:24:
+mail:x:34:
+kvm:x:61:
+uuidd:x:80:
+wheel:x:97:
+nogroup:x:99:
+users:x:999:
+EOF
+ /usr/sbin/pwconv
+ /usr/sbin/grpconv
+ chmod 0640 /etc/shadow
+ mkdir -p /etc/default
+ /usr/sbin/useradd -D --gid 999
+}