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
|
Name: shadow
|
||||||
Version: 4.5
|
Version: 4.5
|
||||||
Group: Applications/Security
|
Group: Applications/Security
|
||||||
Release: 3mamba
|
Release: 4mamba
|
||||||
Vendor: openmamba
|
Vendor: openmamba
|
||||||
Distribution: openmamba
|
Distribution: openmamba
|
||||||
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
|
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
@ -166,32 +166,41 @@ done
|
|||||||
%clean
|
%clean
|
||||||
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
|
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
|
||||||
|
|
||||||
%post common
|
%post
|
||||||
/sbin/ldconfig
|
|
||||||
groupadd shadow -g %{shadowgroupid} 2>/dev/null || :
|
groupadd shadow -g %{shadowgroupid} 2>/dev/null || :
|
||||||
exit 0
|
if [ ! -e /etc/shadow ]; then
|
||||||
|
# upgrade/create passwords to shadow system
|
||||||
%preun common
|
# for a new install or an upgrade
|
||||||
/sbin/ldconfig
|
/usr/sbin/pwconv
|
||||||
exit 0
|
chmod 0640 /etc/shadow
|
||||||
|
chgrp shadow /etc/shadow
|
||||||
%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
|
|
||||||
fi
|
fi
|
||||||
[ -e /etc/shadow ] || touch /etc/shadow
|
|
||||||
chmod 0640 /etc/shadow
|
|
||||||
chgrp shadow /etc/shadow
|
|
||||||
exit 0
|
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
|
%files -f shadow-main.man
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%{_bindir}/chage
|
%{_bindir}/chage
|
||||||
@ -254,6 +263,9 @@ exit 0
|
|||||||
%{_mandir}/man8/nologin.8*
|
%{_mandir}/man8/nologin.8*
|
||||||
|
|
||||||
%changelog
|
%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
|
* Thu Nov 09 2017 Silvan Calarco <silvan.calarco@mambasoft.it> 4.5-3mamba
|
||||||
- create /etc/shadow if missing
|
- create /etc/shadow if missing
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user