Merge pull request #7593 from miallo/ignore-identical-rc-backup-files-for-installation

install-multi-user: ignore profile_target backups that have no change
This commit is contained in:
Théophane Hufschmitt 2023-09-25 14:14:53 +02:00 committed by GitHub
commit e304e8d053
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -452,6 +452,14 @@ EOF
# a row for different files.
if [ -e "$profile_target$PROFILE_BACKUP_SUFFIX" ]; then
# this backup process first released in Nix 2.1
if diff -q "$profile_target$PROFILE_BACKUP_SUFFIX" "$profile_target" > /dev/null; then
# a backup file for the rc-file exist, but they are identical,
# so we can safely ignore it and overwrite it with the same
# content later
continue
fi
failure <<EOF
I back up shell profile/rc scripts before I add Nix to them.
I need to back up $profile_target to $profile_target$PROFILE_BACKUP_SUFFIX,