#!/bin/sh


[ ! -f ZYPKGS ] && echo "No ZYPKGS file found" && exit 1

PKGDIR="$1"

[ "" = "${PKGDIR}" ] && echo "No package directory provided" && exit 2

[ ! -d ${PKGDIR} ] && echo "Directory ${PKGDIR} doesn't exist" && exit 3


grep ^Filename ZYPKGS | cut -d ' ' -f 2 | while read line 
do
    ln -s "${PKGDIR}/${line}" "${line}"
    chown -h uploaders:uploaders "${line}"
done 
