util-linux/util-linux-login_defs-check.sh
Stanislav Brabec 644790947b Accepting request 833344 from home:sbrabec:branches:util-linux-multibuild
- Migrate multi-spec build to multibuild.
- Change packaging from per-partes build to mini+full build.
- Fix default permissions of wall and write.
- Build all python flavors.
- Fix error in scriptlets after migration to /usr/etc.
- Update to version 2.36...
- Refresh Add-documentation-on-blacklisted-modules-to-mount-8-.patch.
- Drop upstreamed libeconf.patch,
  libmount-Avoid-triggering-autofs-in-lookup_umount_fs.patch.
- util-linux-login_defs-check.sh: Perform all steps to integrate
  MOTD_FIRSTONLY.
- Update baselibs.conf.

OBS-URL: https://build.opensuse.org/request/show/833344
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=433
2020-09-09 23:47:10 +00:00

59 lines
1.9 KiB
Bash

#!/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/ .*$//') != bdea2548d823e727ddf2cc3318dfce4aa6a9b48f ; then
echo "does not match!" >&2
echo "Checksum is: $(sha1sum util-linux-login_defs-vars.lst | sed 's/ .*$//')" >&2
cat >&2 <<EOF
You have to perform following steps:
Check whether the error is false positive (script failed to extract
variables) or true positive (variable list changed).
If it is false positive:
- Fix this script.
- The same fix is needed in shadow package in shadow-login_defs-check.sh.
If it is true positive:
- Check-out shadow package and call shadow-login_defs-check.sh.
- Compare its output shadow-login_defs-check-util-linux.lst with
util-linux-login_defs-vars.lst in the util-linux build directory.
- Update shadow shadow-login_defs-util-linux.patch, if needed.
- If shadow-login_defs-util-linux.patch was updated, update
login_defs-support-for-util-linux symbol version in both shadow and
util-linux spec files accordingly.
- Update checksum in this script.
- Possibly update su.default with these new list of su/runuser specific
variables:
EOF
echo -n " " >&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