Only update logindefs when needed

This commit is contained in:
Bob Mottram 2017-08-07 17:31:37 +01:00
parent 51de0ff9b3
commit c80feb6768
1 changed files with 2 additions and 1 deletions

View File

@ -455,7 +455,8 @@ function remove_management_engine_interface {
}
function set_login_umask {
if ! grep -q 'UMASK\t\t077' /etc/login.defs; then
logindefs_umask=$(cat /etc/login.defs | grep UMASK | grep -v '#')
if [[ "$logindefs_umask" != *'077' ]]; then
sed -i 's|UMASK\t.*|UMASK\t\t077|g' /etc/login.defs
fi
}