dimanche, mars 13, 2011

FreeBSD packages generator

  
Update (8 april 2011): There is a best method detailled here (in french)

Using up-to-date ports on my old workstations became more and more painful (more than 8 hours for compiling the latest LibreOffice).
Then I've decided to use my brand new server (used for generating BSD Router Project images and running BSDRP routing labs using virtualbox) as a FreeBSD packages generator.
But I've faced to a problem with the "make package-recursive" command on FreeBSD:
The port needs to be installed before generating the package! And I didn't want to install useless programs  (xorg, hal, etc…) on my server.
Then I've wrote small ugly script that:

  1. Generate a full new freebsd in a working dir (downloading FreeBSD base, src and lib32 sets).
  2. Update the local port tree
  3. Launch a chrooted portmaster into the working dir for generating the packages.

This script, package_gen.sh, is to be use like that:

Package generator usage:
./package_gen.sh COMMAND [familly/port-name] [build-option]
Where COMMAND can be:
 generate [familly/port-name] [build-option]
 upgrade [port-name] [build-option]
 replace familly/port-name familly/port-name
 delete [familly/port-name]
examples:
./package_gen.sh generate sysutils/tmux                         : Generate tmux package
./package_gen.sh generate editors/vim-lite -DWITHOUT_X11        : Generate vim-lite package without X11 stuffs
./package_gen.sh generate editors/libreoffice LOCALIZED_LANG=fr : Generate french libreoffice
./package_gen.sh upgrade                                        : Upgrade all packages previously generated
./package_gen.sh delete editors/vim-lite                        : Delete vim-lite
 


All generated packages are in /usr/ports/packages.

Once generated or upgraded, I upload them onto a web server using a small lftp script (-f option):


  set ftp:list-options -a
  set cmd:fail-exit true
  debug -o /home/USER/lftp_debug.log 3
  open -p 21 LOGIN:PASS@ftpperso.free.fr
  cd /packages/8.2/amd64/Latest
  lcd /usr/ports/packages/Latest
  mirror -eRL --only-newer --parallel=2 --verbose=4
  cd /packages/8.2/amd64/All
  lcd /usr/ports/packages/All
  mirror -eRL --only-newer --parallel=2 --verbose=4
 quit
 


This lftp script replaces symbolic links found in /usr/ports/packages by the real file.
Now, from my workstations, I can install up-to-date ported software with this command:

env PACKAGESITE=http://gugus69.free.fr/packages/8.2/amd64/Latest/ pkg_add -r openjdk6

You can use this package repository freely. I will try to kept it online (if my ISP accept this uses) and up-to-date.
But here are some information about theses packages:
  • FreeBSD amd64 8.2 only
  • www/firefox-i8n include only french language pack
  • emulators/qemu with kqemu support and GNS3 patch
  • java/jdk16 is compiled with IPv6 enabled


Enregistrer un commentaire