On Wed, Jun 22, 2011 at 7:38 PM, Dave Reisner <d@falconindy.com> wrote:
If the repo file already exists, we allow specifying the symlink instead of the tarball itself.
Signed-off-by: Dave Reisner <d@falconindy.com> --- I'm fairly sure this is a safe use of readlink, since it doesn't involve any of the flags for canonicalizing paths. I was able to test it on OSX with great success. This page (http://mywiki.wooledge.org/BashFAQ/029) also suggests using `find -printf %l`. I think it is more about not having a readlink at all that burned us in the past (the actual BSDs?)
Part of me says this still doesn't feel quite right. What if I just *move* my repo to repo.db? Is there a way to get bsdtar to use the same compression as another file, or some trick with file, like what we do in makepkg (search for 'application/', that will allow us to do this?
scripts/repo-add.sh.in | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 8865188..3581765 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -582,7 +582,10 @@ done if (( success )); then msg "$(gettext "Creating updated database file '%s'")" "$REPO_DB_FILE"
- case "$REPO_DB_FILE" in + # allows for syntax such as: repo-add repo.db /path/to/pkg + [[ -L "$REPO_DB_FILE" ]] && resolved=$(readlink "$REPO_DB_FILE") + + case "${resolved:-$REPO_DB_FILE}" in *.@(db|files).tar.gz) TAR_OPT="z" ;; *.@(db|files).tar.bz2) TAR_OPT="j" ;; *.@(db|files).tar.xz) TAR_OPT="J" ;; -- 1.7.5.4