I'm not sure if I've given a reply, so this might be a double post. :-)

On Wed, 20 Aug 2008 01:36:58 +0300, Manolis Kiagias <[EMAIL PROTECTED]> wrote:
> It doesn't have to be done through ports, you can still get the packages 
> using pkg_add -r and then recreate them using pkg_create -Rb. Side 
> effect is the packages will be installed on the download machine, and 
> that may not be what you want.

Exactly. If I would have wanted that, my choice would be the tradidtional
way to use portinstall with its -p option, similar to "make package"
from a port's directory.



> But you could probably use a jail to 
> avoid this.

That sounds complicated...



But many thanks for your ideas, I found a way to achieve my goad.
As you will see, the solution is VERY ugly, but it seems to work.
It's a simple script that first downloads the requested package,
then the dependencies it needs are filtered out of the -v messages
of pkg_add. Afterwards, the script is called recursively on these
packages, to do exactly the same as with the requested package.

Here it is:



#!/bin/sh
#
# getpkg.sh 2008-08-19
#
# fetch a precompiled package as well as it dependencies
# for further installation

if [ "$1" = "" ]; then
        echo "$0 <package>"
        exit 1
fi
echo -n "fetching $1 ... "
if [ -f $1.tbz ]; then
        echo "$1.tbz already there"
        exit 1
fi
pkg_add -fKnrv $1 > $1.txt 2>&1
echo "done"
for DEP in `cat $1.txt | grep $1 | grep "depends on" | cut -d "'" -f 6 | cut -d 
"/" -f 2`; do
        echo "dependency for $1 is ${DEP}"
        $0 ${DEP}
done
rm $1.txt
exit 0



One problem that might occur: Do the depencency packages need to
include version numbering? The downloaded packages do not have
a version in their name. I will check if it works, or if the
versions need to be in the package file name.


-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to