From 72420d1f003bd389fceb4046dacc12e12261da18 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 8 Mar 2018 11:02:29 -0500 Subject: [PATCH] Fix syncfiles merge update records The change to fix superset problem also reversed logic to prefer the 'old' entries to the 'new' entries. For now, restore the logic of merge entries superseding existing entries. What is really warranted is a facility to intelligently sync the account databases. Specifically, read in /etc/login.defs, look at UID_MIN and GID_MIN for the platform. For UID/GID lower than that, rpms may manage and such care needs to be given to not change UID/GID, but still need to update things like shadow and group *membership*, but presrve uid/gid. Above UID_MIN/GID_MIN, they are user groups and the uid/gid portion is important in shared filesystem context, so it is imperative that they work. --- xCAT-server/share/xcat/scripts/xdcpmerge.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/xCAT-server/share/xcat/scripts/xdcpmerge.sh b/xCAT-server/share/xcat/scripts/xdcpmerge.sh index d3e096f2d..795d97365 100755 --- a/xCAT-server/share/xcat/scripts/xdcpmerge.sh +++ b/xCAT-server/share/xcat/scripts/xdcpmerge.sh @@ -86,19 +86,16 @@ for i in $*; do userlist=$userlisttmp$listend grepcmd=$grepcmd$userlist #set -x - grepcmd="$grepcmd $mergefile > $mergefile.nodups" + cp -p $filebackup $filebackup.nodups # preserve ownership and such + grepcmd="$grepcmd $filebackup > $filebackup.nodups" #echo "grepcmd=$grepcmd" # now run it eval $grepcmd + mv $filebackup.nodups $filebackup fi # add new entries from mergefile, if any - if [ -a "$mergefile.nodups" ]; then - cat $mergefile.nodups >> $curfile - rm $mergefile.nodups - else # no set intersection, make it a simple append - cat $filebackup $mergefile > $curfile - fi + cat $filebackup $mergefile > $curfile # now cleanup rm $filebackup.userlist