Backup packages
From FBSD_tips
Backup all your packages :
pkg_info | awk '{print $1}' | while read P; do pkg_create -b $P; done
Or with a little white space added ;
pkg_info | awk '{print $1}' | while read P
do
pkg_create -b $P
done
This can also be done without the while loop (thanks mux!) :
pkg_info | awk '{print $1}' | xargs pkg_create -b
The packages will be written in the current directory.
References: pkg_create man page awk man page
=Discussion-
In ports you can make a package that is the same thing as this by typing 'make package' in the port directory.
The same effect can be achieved with pkg_create -ba, but with a loop like this you can check for success on a package by package basis, maybe writing to log files.
Gongo 02:14, 1 October 2007 (UTC)
