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


vendredi, février 11, 2011

How to enable receiving UDP syslog message on Ubuntu

After loosing lot's of my precious time, here is how to enable receiving remote syslog message on a Ubuntu server 10.04 LTS:

  1. Create a new file in /etc/rsyslog.d/ and call it udp_server as example:
    • vim /etc/rsyslog.d/udp_server
  2. Add these 2 lines:
    • $ModLoad imudp
    • $UDPServerRun 514
  3. Restart rsyslog: sudo service rsyslog restart
  4. Check that it's working:
    • echo "FreeBSD rocks!" | nc -w0 -u 127.0.0.1 514
    • sudo tail /var/log/messages

Don't modify the file /etc/rsyslog.conf, it's not used at all !