create /etc/shadow with pwconv if not existing in %post [release 4.5-4mamba;Wed Nov 15 2017]
This commit is contained in:
parent
4906d0ac07
commit
1e50498a5a
58
shadow.spec
58
shadow.spec
@ -3,7 +3,7 @@ Summary: Utilities for managing shadow password files and user/group accou
|
||||
Name: shadow
|
||||
Version: 4.5
|
||||
Group: Applications/Security
|
||||
Release: 3mamba
|
||||
Release: 4mamba
|
||||
Vendor: openmamba
|
||||
Distribution: openmamba
|
||||
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
@ -166,32 +166,41 @@ done
|
||||
%clean
|
||||
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
|
||||
|
||||
%post common
|
||||
/sbin/ldconfig
|
||||
%post
|
||||
groupadd shadow -g %{shadowgroupid} 2>/dev/null || :
|
||||
exit 0
|
||||
|
||||
%preun common
|
||||
/sbin/ldconfig
|
||||
exit 0
|
||||
|
||||
%posttrans common
|
||||
if [ -e /etc/shadow.rpmsave ]; then
|
||||
SAVEPWD=`grep "^root:" /etc/shadow.rpmsave | sed "s|root:\([^:]*\):.*|\1|"`
|
||||
NEWPWD=`grep "^root:" /etc/shadow | sed "s|root:\([^:]*\):.*|\1|"`
|
||||
if [ "$NEWPWD" == "" -o "$NEWPWD" == "!" -o "$NEWPWD" == "x" ]; then
|
||||
if [ "$SAVEPWD" != "!" -a "$SAVEPWD" != "" -a "$SAVEPWD" != "x" ]; then
|
||||
mv /etc/shadow.rpmsave /etc/shadow
|
||||
else
|
||||
echo "Unexpected error updating /etc/shadow file: root password was lost, recover needed!"
|
||||
fi
|
||||
fi
|
||||
if [ ! -e /etc/shadow ]; then
|
||||
# upgrade/create passwords to shadow system
|
||||
# for a new install or an upgrade
|
||||
/usr/sbin/pwconv
|
||||
chmod 0640 /etc/shadow
|
||||
chgrp shadow /etc/shadow
|
||||
fi
|
||||
[ -e /etc/shadow ] || touch /etc/shadow
|
||||
chmod 0640 /etc/shadow
|
||||
chgrp shadow /etc/shadow
|
||||
exit 0
|
||||
|
||||
#% post common
|
||||
#/sbin/ldconfig
|
||||
#exit 0
|
||||
|
||||
#% preun common
|
||||
#/sbin/ldconfig
|
||||
#exit 0
|
||||
|
||||
#% posttrans common
|
||||
#if [ -e /etc/shadow.rpmsave ]; then
|
||||
# SAVEPWD=`grep "^root:" /etc/shadow.rpmsave | sed "s|root:\([^:]*\):.*|\1|"`
|
||||
# NEWPWD=`grep "^root:" /etc/shadow | sed "s|root:\([^:]*\):.*|\1|"`
|
||||
# if [ "$NEWPWD" == "" -o "$NEWPWD" == "!" -o "$NEWPWD" == "x" ]; then
|
||||
# if [ "$SAVEPWD" != "!" -a "$SAVEPWD" != "" -a "$SAVEPWD" != "x" ]; then
|
||||
# mv /etc/shadow.rpmsave /etc/shadow
|
||||
# else
|
||||
# echo "Unexpected error updating /etc/shadow file: root password was lost, recovery needed!"
|
||||
# fi
|
||||
# fi
|
||||
#fi
|
||||
#chmod 0640 /etc/shadow
|
||||
#chgrp shadow /etc/shadow
|
||||
#exit 0
|
||||
|
||||
%files -f shadow-main.man
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/chage
|
||||
@ -254,6 +263,9 @@ exit 0
|
||||
%{_mandir}/man8/nologin.8*
|
||||
|
||||
%changelog
|
||||
* Wed Nov 15 2017 Silvan Calarco <silvan.calarco@mambasoft.it> 4.5-4mamba
|
||||
- create /etc/shadow with pwconv if not existing in %post
|
||||
|
||||
* Thu Nov 09 2017 Silvan Calarco <silvan.calarco@mambasoft.it> 4.5-3mamba
|
||||
- create /etc/shadow if missing
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user