#!/bin/bash # Extract list of variables supported by su/runuser. # # If you edit this file, you will probably need to edit # shadow-login_defs-check.sh from shadow sources in a similar way. set -o errexit echo -n "Checking login.defs variables in util-linux... " >&2 ( grep -rh getlogindefs . | sed -n 's/^.*getlogindefs[a-z_]*("\([A-Z0-9_]*\)".*$/\1/p' grep -rh logindefs_setenv . | sed -n 's/^.*logindefs_setenv*("[A-Z0-9_]*", "\([A-Z0-9_]*\)".*$/\1/p' ) | LC_ALL=C sort -u >util-linux-login_defs-vars.lst if test $(sha1sum util-linux-login_defs-vars.lst | sed 's/ .*$//') != 8516ca34e059b2dee1d4421a3ab07e88331b1674 ; then echo "does not match!" >&2 echo "Checksum is: $(sha1sum util-linux-login_defs-vars.lst | sed 's/ .*$//')" >&2 cat >&2 <&2 ( grep -rh getlogindefs login-utils/su-common.c | sed -n 's/^.*getlogindefs[a-z_]*("\([A-Z0-9_]*\)".*$/\1/p' grep -rh logindefs_setenv login-utils/su-common.c | sed -n 's/^.*logindefs_setenv*("[A-Z0-9_]*", "\([A-Z0-9_]*\)".*$/\1/p' ) | LC_ALL=C sort -u | tr '\n' ' ' | sed 's/ /, /g;s/, $//' >&2 echo -e '\n' >&2 exit 1 else echo "OK" >&2 fi