Fetching precompiled packages for external install

Polytropon freebsd at edvax.de
Tue Aug 19 21:50:54 UTC 2008

On Tue, 19 Aug 2008 14:39:48 -0400, Lowell Gilbert <freebsd-questions-local at be-well.ilk.org> wrote:
> I don't see anything direct, but the *-depends-list targets will
> probably get you close enough to work it out.

Sorry, I don't know what "*-depends-list targets" refers to. But
I think it's something about the ports which I don't want to use,
instead, using the precompiled packages is what I wanted to.

>From portinstall's -p option I know a similar behaviour: Things
are compiled, installed, and put into packages/ as packages that
could be transferred to another system.

I read the pkg_add manpage many times, and now I have a solution.
Watch out! it's ugly! But I think it works.

# 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
echo -n "fetching $1 ... "
if [ -f $1.tbz ]; then
	echo "$1.tbz already there"
	exit 1
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}
rm $1.txt
exit 0

One thing I don't know yet: Will such a collection of .tbz files
be installable in a recursive way? Does pkg_add only need files
in the format <name>.tbz, or is <name>-<version>.tbz required?
I will check this.

Up to this time, enjoy the ugly script. :-)

Anyway, thanks for help.

>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list