MacOS fixes
This commit is contained in:
@@ -44,7 +44,7 @@ sync_repo_managed_secret_file() {
|
||||
}
|
||||
|
||||
backup_conflicting_home_files() {
|
||||
local backup_dir backed_up_any=0 source_file filename target_file
|
||||
local backup_dir backed_up_any=0 source_file filename target_file target_resolved source_resolved
|
||||
|
||||
backup_dir="$BACKUP_ROOT/$(date +%Y%m%d-%H%M%S)"
|
||||
|
||||
@@ -52,7 +52,19 @@ backup_conflicting_home_files() {
|
||||
filename="$(basename "$source_file")"
|
||||
target_file="$HOME/$filename"
|
||||
|
||||
if [ -e "$target_file" ] && [ ! -L "$target_file" ]; then
|
||||
if [ -L "$target_file" ]; then
|
||||
target_resolved="$(python3 -c 'import os,sys; print(os.path.realpath(sys.argv[1]))' "$target_file")"
|
||||
source_resolved="$(python3 -c 'import os,sys; print(os.path.realpath(sys.argv[1]))' "$source_file")"
|
||||
|
||||
if [ "$target_resolved" = "$source_resolved" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
mkdir -p "$backup_dir"
|
||||
mv "$target_file" "$backup_dir/$filename"
|
||||
echo "Backed up existing linked $target_file -> $backup_dir/$filename"
|
||||
backed_up_any=1
|
||||
elif [ -e "$target_file" ]; then
|
||||
mkdir -p "$backup_dir"
|
||||
mv "$target_file" "$backup_dir/$filename"
|
||||
echo "Backed up existing $target_file -> $backup_dir/$filename"
|
||||
|
||||
Reference in New Issue
Block a user