replacing $target_dir with $repodir