Date: Wed, 27 Aug 2008 05:16:02 +0200 From: Polytropon <freebsd@edvax.de> To: Manolis Kiagias <sonic2000gr@gmail.com> Cc: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: Fetching precompiled packages for external install Message-ID: <20080827051602.d26c784d.freebsd@edvax.de> In-Reply-To: <48AB4B0A.7090900@gmail.com> References: <20080819181714.fb9d5ea1.freebsd@edvax.de> <48AB2051.2020303@gmail.com> <20080819235050.7341a5f3.freebsd@edvax.de> <48AB4B0A.7090900@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <sonic2000gr@gmail.com> 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, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080827051602.d26c784d.freebsd>
