forked from pool/shadow
boo#1173321
OBS-URL: https://build.opensuse.org/package/show/Base:System/shadow?expand=0&rev=93
This commit is contained in:
parent
0b9efbf5e4
commit
6ffcde29a4
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
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>
|
Thu Oct 8 03:16:58 UTC 2020 - Stanislav Brabec <sbrabec@suse.com>
|
||||||
|
|
||||||
|
@ -21,6 +21,19 @@ if [ $# -lt 1 -o $# -gt 4 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Update NIS database
|
||||||
# make -C /var/yp
|
# make -C /var/yp
|
||||||
|
|
||||||
@ -29,16 +42,23 @@ fi
|
|||||||
if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled ; then
|
if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled ; then
|
||||||
test -x /sbin/restorecon || exit 2
|
test -x /sbin/restorecon || exit 2
|
||||||
|
|
||||||
if [ $# -lt 4 ]; then
|
if [ -d $HOMEDIR ]; then
|
||||||
home_dir=/home/$1
|
/sbin/restorecon -R $HOMEDIR
|
||||||
else
|
|
||||||
home_dir=$4
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d $home_dir ]; then
|
|
||||||
/sbin/restorecon -R $home_dir
|
|
||||||
fi
|
fi
|
||||||
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.
|
# All done.
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user