Ubuntu: A simple way to create boot messages dialog box for the console
I need to create a customised version of Ubuntu LiveCD to install our company software onto rackmount servers. The product requires simple text input and messages dialogs after the boot process. The obvious solution is to use the Linux tool, dialog, for this purpose and run the dialog script in /etc/rc.local.
However, the dialog doesn’t appear to the console screen. This is because the init process (which starts the rc scripts) sends the output to different terminal which ends up in /var/log/boot.log
In order to make sure you dialog script is interacting with the actual console display, make sure the dialog command is outputting to /dev/console. For example:
dialog --title "Check ID" --inputbox
"Please type in your ID" 12 50 > /dev/console 2>id
Emacs command line to indent Javascript code and convert tabs to spaces
Part of my project checkin script is to automatically apply coding style and converting tabs to spaces. Here is the command line:
emacs -batch file.js --eval "(custom-set-variables '(js-indent-level 2))" -f mark-whole-buffer -f indent-region -f mark-whole-buffer -f untabify -f save-buffer -kill
Change the value of js-indent-level to any religion of white spaces.
How to extract storage device information (Parte 2 – using lshw and xmlstarlet)
In Ubuntu 10.04, udevinfo is no longer available and I need to write a LiveCD tool to retrieve storage information (such as vendor, size, filesystem, label) from existing partitions (e.g /dev/sda1). So I cannot use the command lines anymore mentioned in my previous blog.
After a day of researching various tools and experiment parsing command line outputs. Eventually, I decide to use lshw to generate all the storage information and output into XML format. Then use xmlstarlet to extract specific device data. Read more 




