From 6bfc9940a703b92df396688f205c16242f359d06 Mon Sep 17 00:00:00 2001 From: Jan Pazdziora Date: Fri, 27 Sep 2024 18:59:36 +0200 Subject: [PATCH] Update ownership of /data content based on the template. Addressing IPA server upgrade failed: Inspect /var/log/ipaupgrade.log and run command ipa-server-upgrade manually. Unexpected error - see /var/log/ipaupgrade.log for details: CalledProcessError: CalledProcessError(Command ['/bin/systemctl', 'restart', 'sssd.service'] returned non-zero exit status 1: 'Job for sssd.service failed because the control process exited with error code.\nSee "systemctl status sssd.service" and "journalctl -xeu sssd.service" for details.\n') when upgrading from Fedora 40 to rawhide where sssd now runs as sssd:sssd instead of root. --- utils/populate-volume-from-template | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utils/populate-volume-from-template b/utils/populate-volume-from-template index 728f6a1c..84a303c0 100755 --- a/utils/populate-volume-from-template +++ b/utils/populate-volume-from-template @@ -45,14 +45,15 @@ while [ -n "$VOLUME" ] ; do fi if ! [ -e "$VOLUME/$f" ] ; then tar cf - "$f" | ( cd "$VOLUME" && tar xf - ) + continue elif [ "$f" == "build-id" ] ; then - true + continue elif [ -L "$f" ] && [ -L "$VOLUME/$f" ] ; then if [ "$( readlink $f )" != "$( readlink $VOLUME/$f )" ] ; then echo "There are symlinks $f in both $VOLUME-template $VOLUME, with different targets, leaving in $VOLUME as is." fi elif [ -L "$f" ] && ! [ -L "$VOLUME/$f" ] ; then - echo "There is symlink $f in $VOLUME-template and not on $VOLUME, leaving in $VOLUME as is." + echo "There is symlink $f in $VOLUME-template and not on $VOLUME, leaving $VOLUME as is." elif ! [ -L "$f" ] && [ -L "$VOLUME/$f" ] ; then echo "There is symlink $f in $VOLUME and not on $VOLUME-template, leaving in $VOLUME as is." elif [ -f "$VOLUME/$f" ] && ! cmp -s "$VOLUME/$f" "$VOLUME-template/$f" ; then @@ -95,6 +96,10 @@ while [ -n "$VOLUME" ] ; do cp -vfp "$VOLUME-template/$f" "$VOLUME/$f" fi fi + [ -e "$VOLUME/$f" ] || continue + chgrp -c -h --reference="$f" "$VOLUME/$f" + chown -c -h --reference="$f" "$VOLUME/$f" + [ -L "$VOLUME/$f" ] || chmod -c --reference="$f" "$VOLUME/$f" done rm -rf "$VOLUME/.configfiles" "$VOLUME/.configfiles-noreplace" tar cf - .configfiles .configfiles-noreplace | ( cd "$VOLUME" && tar xf - )