mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
Merge b335cecd3e
into 7170300119
This commit is contained in:
commit
a139b17ef5
1 changed files with 7 additions and 6 deletions
|
@ -34,26 +34,27 @@ for sourcePath in "$@" ; do
|
||||||
# Next, try to move the file to a backup location if configured and possible
|
# Next, try to move the file to a backup location if configured and possible
|
||||||
backup="$targetPath.$HOME_MANAGER_BACKUP_EXT"
|
backup="$targetPath.$HOME_MANAGER_BACKUP_EXT"
|
||||||
if [[ -e "$backup" ]]; then
|
if [[ -e "$backup" ]]; then
|
||||||
errorEcho "Existing file '$backup' would be clobbered by backing up '$targetPath'"
|
collisionErrors+=("Existing file '$backup' would be clobbered by backing up '$targetPath'")
|
||||||
collision=1
|
|
||||||
else
|
else
|
||||||
warnEcho "Existing file '$targetPath' is in the way of '$sourcePath', will be moved to '$backup'"
|
warnEcho "Existing file '$targetPath' is in the way of '$sourcePath', will be moved to '$backup'"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Fail if nothing else works
|
# Fail if nothing else works
|
||||||
errorEcho "Existing file '$targetPath' is in the way of '$sourcePath'"
|
collisionErrors+=("Existing file '$backup' would be clobbered by backing up '$targetPath'")
|
||||||
collision=1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -v collision ]] ; then
|
if [[ ${#collisionErrors[@]} -gt 0 ]] ; then
|
||||||
errorEcho "Please do one of the following:
|
errorEcho "Please do one of the following:
|
||||||
- Move or remove the above files and try again.
|
- Move or remove the files below and try again.
|
||||||
- In standalone mode, use 'home-manager switch -b backup' to back up
|
- In standalone mode, use 'home-manager switch -b backup' to back up
|
||||||
files automatically.
|
files automatically.
|
||||||
- When used as a NixOS or nix-darwin module, set
|
- When used as a NixOS or nix-darwin module, set
|
||||||
'home-manager.backupFileExtension'
|
'home-manager.backupFileExtension'
|
||||||
to, for example, 'backup' and rebuild."
|
to, for example, 'backup' and rebuild."
|
||||||
|
for error in "${collisionErrors[@]}" ; do
|
||||||
|
errorEcho "$error"
|
||||||
|
done
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue