Skip to content

Commit

Permalink
Update ownership of /data content based on the template.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
adelton committed Sep 27, 2024
1 parent d199fd5 commit 6bfc994
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions utils/populate-volume-from-template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 - )
Expand Down

0 comments on commit 6bfc994

Please sign in to comment.