Tuesday, September 05, 2006

Generate a package with dependency in FreeBSD

After completion to compile a package, we usually want to backup its binary backage so as to avoid compile it again when installing it in the future.

Here is a small script to automaticlly generate a package and other packages which it depends on.

for i in `pkg_info -qr $PACKAGE_NAME | cut -d ' ' -f2 | sort | uniq`; do
    pkg_create -zb $i
done

If you wanna backup all packages you installed on the system, try to replace "pkg_info -qr" to "pkg_info -Qoa".

1 comment:

Anonymous said...

It looks like the output pkg_info command has changed since this was written. In FreeBSD 7.0, I had to run:

`pkg_info -aoQ | cut -d : -f 1 | sort | uniq`

instead.