Pkg cache: Fix symlinks not being updated. Do this atomically with rename(2).