summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-02-28 17:23:38 (GMT)
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-03-06 16:50:21 (GMT)
commit5afdc1e8e66c565bbe2d5c8bb4669351043a3841 (patch)
tree813af76afd28ccaffb313d7895e0cd717c8fadaf
parent8ea4bfba8076af0f325b7be11761e64f2c96819b (diff)
downloadtbdiff-5afdc1e8e66c565bbe2d5c8bb4669351043a3841.tar.gz
baserock-system-config-sync: Force copy /etc/passwd and /etc/group
This change is to ensure the existing users will exist after an upgrade. Otherwise, if there are merge conflicts when upgrading, the users will be lost and the root password will be deactivated. If that happens and the only way to access to the system is through ssh and the system was rebooted after the upgrade (manually or automatically) then the system won't be accessible anymore. This change also means that we can no longer make changes to the base /etc/passwd or /etc/group in the 'fhs-dirs' chunk without adding a manual hook to add the new users/groups when upgrading old systems. In the following link is the email thread where was discussed this issue: http://vlists.pepperfish.net/pipermail/baserock-dev-baserock.org/2014-March/004581.html
-rwxr-xr-xbaserock-system-config-sync/baserock-system-config-sync8
1 files changed, 8 insertions, 0 deletions
diff --git a/baserock-system-config-sync/baserock-system-config-sync b/baserock-system-config-sync/baserock-system-config-sync
index 47da83d..7b7c697 100755
--- a/baserock-system-config-sync/baserock-system-config-sync
+++ b/baserock-system-config-sync/baserock-system-config-sync
@@ -224,6 +224,14 @@ if [ "$1" = "merge" ]; then
merge "$vu_dir" "$v1_dir" "$vu_dir" "$v2_dir" "$vt_dir"
merge "$v2_dir" "$v1_dir" "$vu_dir" "$v2_dir" "$vt_dir"
+ if [ -f "$vu_dir/passwd" ]; then
+ cp "$vu_dir/passwd" "$vt_dir/passwd"
+ fi
+ if [ -f "$vu_dir/group" ]; then
+ cp "$vu_dir/group" "$vt_dir/group"
+ fi
+
+
rm -rf "$v2_dir"
mv "$vt_dir" "$v2_dir"
elif [ "$1" = "sync" ]; then