September 18, 2009 Archives

Fr 18. Sep 15:50:44 CEST 2009

Bootstrapping Fedora to directories

Currently there is some discussion on debian planet about installing Centos/Fedora to an directory under debian.
As mentioned in the comments and another blog entry there exist several other simpler solutions.

febootstrap allows you to install centos/fedora really easily just like deboostrap.
Example to install centos in directory c5:

# febootstrap centos-5 c5 http://mirror.eunet.at/5.3/os/i386/
# .....
# chroot c5 cat /etc/redhat-release   
# CentOS release 5.3 (Final)

mach is another more generic way to bootstrap rpm based distributions to a directory. For an overview of the features just have a look at the README Example to install centos:

$ mach -r centos-5-i386-os setup base 

If you just want to install Fedora/Centos into some directory use febootstrap as it is quite simple and does the job.
But if you want to rebuild rpms or bootstrap any other rpm based distribution like SuSE, Yellowdog use mach


Posted by Ulrich Dangel | Permanent Link | Categories: Shell stuff

Fr 18. Sep 14:14:13 CEST 2009

Unit testing for shell scripts with shunit2

Recently I stumbled upon a bug of an funtion in a shellscript and wanted to make sure that this bug never happens again. So i searched around and found shunit2 a nice xUnit based test framework for shell scripts.

If you ever had thought about writing unit tests for your shell scripts, do it! Its really easy, and shunit2 also supports zsh
Example test sript:

#! /bin/sh
testEquality()
{
  assertEquals 1 1
}

. shunit2

For more examples have a look at the tests for grml-autoconfig or at the example directory of the shunit2 package

Posted by Ulrich Dangel | Permanent Link