Skip to content

Commit

Permalink
make package-link only scan last dir
Browse files Browse the repository at this point in the history
you can scan all archived repositories by using -a switch
  • Loading branch information
seblu committed Sep 28, 2014
1 parent af113dd commit d79def9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions package-links
Expand Up @@ -21,13 +21,22 @@ REPOS=/srv/ftp/archlinux/archive/repos
BASE=/srv/ftp/archlinux/archive/packages
PKGFLAT=.all

[[ $1 != "" && ${1:0:1} != / ]] && { echo 'Absolute path please, ln is bugged'; exit 1; }
case $1 in
-a) SCANDIR="$REPOS";;
-l|"") SCANDIR="$(ls -1d "$REPOS"/*/*/*|sort|tail -n1)" ;;
*)
echo "usage: ${0##*/} -a|-l" >&2
echo ' -a: scan all archived repositories' >&2
echo ' -l: scan last archived repostory' >&2
exit 1
esac

[[ -t 1 ]] && set -x

# we lock!
exec 9> "$LOCKFILE"
flock -n 9 || { echo 'Locking Failed' >&2; exit 1; }

[[ -t 1 ]] && set -x

# nice umask
umask 022
Expand All @@ -40,7 +49,7 @@ find -L "$BASE" -type l -delete -print

# create new links pass
echo 'creating new links'
find ${1:-$REPOS} -type f -name '*.pkg.tar.xz' -o -name '*.pkg.tar.xz.sig'| while read src; do
find $SCANDIR -type f -name '*.pkg.tar.xz' -o -name '*.pkg.tar.xz.sig'| while read src; do
filename="${src##*/}"
pkgname="${filename%-*}" #remove arch and extension
pkgname="${pkgname%-*}" #remove pkgrel
Expand Down

0 comments on commit d79def9

Please sign in to comment.