1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

repo-add: create relative DB symlinks

As noted in FS#20498, if an absolute path is used for specifying the
database when invoking repo-add, the symlink generated will point to the
absolute path instead of being relative to the directory. Fix this for
the two linking cases, but leave the copy untouched so that will still
work.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2010-08-18 13:17:46 -05:00
parent 5908992e47
commit 281bc72534

View File

@ -488,8 +488,9 @@ if (( success )); then
[[ -f $REPO_DB_FILE ]] && mv -f "$REPO_DB_FILE" "${REPO_DB_FILE}.old"
[[ -f $tmpdir/$filename ]] && mv "$tmpdir/$filename" "$REPO_DB_FILE"
dblink="${REPO_DB_FILE%.tar.*}"
ln -sf "$REPO_DB_FILE" "$dblink" 2>/dev/null || \
ln -f "$REPO_DB_FILE" "$dblink" 2>/dev/null || \
target=${REPO_DB_FILE##*/}
ln -sf "$target" "$dblink" 2>/dev/null || \
ln -f "$target" "$dblink" 2>/dev/null || \
cp "$REPO_DB_FILE" "$dblink"
else
msg "$(gettext "No packages modified, nothing to do.")"