37abeb5bf8
FATE#314473: Replace pwdutils with shadow utilities OBS-URL: https://build.opensuse.org/request/show/139680 OBS-URL: https://build.opensuse.org/package/show/Base:System/shadow?expand=0&rev=1
45 lines
940 B
Bash
45 lines
940 B
Bash
#!/bin/bash
|
|
#
|
|
# Here you can add your own stuff, that should be done for every user who
|
|
# was new created.
|
|
#
|
|
# When you create a user with useradd, this script will be called
|
|
# with the login name as parameter. Optional, UID, GID and the HOME
|
|
# directory are added.
|
|
#
|
|
|
|
case "$1" in
|
|
--help|--version)
|
|
echo Usage: $0 username [uid gid home]
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
# Check for the required argument.
|
|
if [ $# -lt 1 -o $# -gt 4 ]; then
|
|
echo Usage: $0 username [uid gid home]
|
|
exit 1
|
|
fi
|
|
|
|
# Update NIS database
|
|
# make -C /var/yp
|
|
|
|
# If SELinux is enabled, we have to run restorecon to assign
|
|
# appropriate fcontexts to the respective $HOME and files under it
|
|
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
|
|
fi
|
|
fi
|
|
|
|
# All done.
|
|
exit 0
|