Accepting request 840431 from Base:System

- Add support for /usr/etc/skel to useradd.local script (boo#1173321) 

- shadow-login_defs-check.sh: Fix the regexp to get a real variable
  list (boo#1164274).

OBS-URL: https://build.opensuse.org/request/show/840431
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/shadow?expand=0&rev=40
This commit is contained in:
Dominique Leuenberger 2020-10-15 11:43:47 +00:00 committed by Git OBS Bridge
commit ca326d2c6f
3 changed files with 40 additions and 9 deletions

View File

@ -54,7 +54,7 @@ fi
echo "Extracting variables from pam..."
cd openSUSE:Factory/pam/BUILD/*
grep -rh LOGIN_DEFS . |
sed -n 's/^.*search_key *("\([A-Z0-9_]*\)", *LOGIN_DEFS).*$/\1/p' |
sed -n 's/^.*search_key *([A-Za-z_]*, *[A-Z_]*LOGIN_DEFS, *"\([A-Z0-9_]*\)").*$/\1/p' |
LC_ALL=C sort -u >../../../../shadow-login_defs-check-pam.lst
cd ../../../..

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Oct 9 13:12:11 UTC 2020 - Dr. Werner Fink <werner@suse.de>
- Add support for /usr/etc/skel to useradd.local script (boo#1173321)
-------------------------------------------------------------------
Thu Oct 8 03:16:58 UTC 2020 - Stanislav Brabec <sbrabec@suse.com>
- shadow-login_defs-check.sh: Fix the regexp to get a real variable
list (boo#1164274).
-------------------------------------------------------------------
Tue Sep 8 00:56:37 UTC 2020 - Stanislav Brabec <sbrabec@suse.com>

View File

@ -21,6 +21,19 @@ if [ $# -lt 1 -o $# -gt 4 ]; then
exit 1
fi
# definition of "root" $HOME for users
. /etc/default/useradd
USER=$1
GID=$(id -g $USER)
HOMEDIR=$HOME/$USER
if [ $# -lt 4 ]; then
HOMEDIR=$HOME/$USER
else
HOMEDIR=$4
fi
# Update NIS database
# make -C /var/yp
@ -29,16 +42,23 @@ fi
if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled ; then
test -x /sbin/restorecon || exit 2
if [ $# -lt 4 ]; then
home_dir=/home/$1
else
home_dir=$4
fi
if [ -d $home_dir ]; then
/sbin/restorecon -R $home_dir
if [ -d $HOMEDIR ]; then
/sbin/restorecon -R $HOMEDIR
fi
fi
#
# Copy also skeleton files from /usr/etc/skel (boo#1173321)
#
USRSKELDIR=/usr/etc/skel
for file in $(ls -A $USRSKELDIR); do
# Only copy if not exist yet, i.e. does *not* exist in /etc/skel, which is still
# being preferred ...
test -e $HOMEDIR/$file && continue
cp -a $USRSKELDIR/$file $HOMEDIR
chown -R $USER.$GID $HOMEDIR/$file
done
# All done.
exit 0