[node-patches] Change in ovirt-node[master]: ovirt-init-functions: validation /etc/profile
dougsland at redhat.com
dougsland at redhat.com
Mon Jun 22 23:16:06 UTC 2015
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: ovirt-init-functions: validation /etc/profile
......................................................................
ovirt-init-functions: validation /etc/profile
This patch adds a validation to avoid duplicating
a entry in /etc/profile in case something
goes wrong updating /etc/shadow or in chage
command.
Change-Id: I2eaf7ae4baeea7f820f4e9a86f7ea662e110c2e2
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M scripts/ovirt-init-functions.sh.in
1 file changed, 8 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/18/42718/1
diff --git a/scripts/ovirt-init-functions.sh.in b/scripts/ovirt-init-functions.sh.in
index ee1f239..5d16dbf 100644
--- a/scripts/ovirt-init-functions.sh.in
+++ b/scripts/ovirt-init-functions.sh.in
@@ -964,12 +964,13 @@
fi
# check if root or admin password is expired, this might be upon reboot
# in case of automated installed with rootpw or adminpw parameter!
- if LC_ALL=C chage -l root | grep -q "password must be changed" \
- || LC_ALL=C chage -l admin | grep -q "password must be changed"; then
- unmount_config /etc/passwd /etc/shadow
- # PAM will force password change at first login
- # so make sure we persist it after a successful login
- cat >> /etc/profile << EOF
+ if ! grep -q "sudo persist /etc/passwd /etc/shadow" /etc/profile; then
+ if LC_ALL=C chage -l root | grep -q "password must be changed" \
+ || LC_ALL=C chage -l admin | grep -q "password must be changed"; then
+ unmount_config /etc/passwd /etc/shadow
+ # PAM will force password change at first login
+ # so make sure we persist it after a successful login
+ cat >> /etc/profile << EOF
# added by ovirt-early
if [ "\$USER" = "root" -o "\$USER" = "admin" ]; then
sudo persist /etc/passwd /etc/shadow
@@ -979,6 +980,7 @@
fi
fi
EOF
+ fi
fi
if [ "$rescue" = 1 ]; then
--
To view, visit https://gerrit.ovirt.org/42718
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2eaf7ae4baeea7f820f4e9a86f7ea662e110c2e2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>
More information about the node-patches
mailing list