#!/bin/sh

if ! test -L "$1"; then
    echo "$1" is not a symlink; exit 2
fi

realpath=$(python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$1")

mv "$1" "$1.bak"
cp -pr "$realpath" "$1"

