2009年9月29日 星期二

2009年9月24日 星期四

Use syslinux to boot Windows in the second partition

If your Windows is in the 2nd partition, and syslinux is in the 1st partition,
you want to first boot to syslinux and then choose"Windows" item and go there, how do you do that?

1. Edit your windows C:\BOOT.ini
chang partition(1) to partition(2)

2. Edit your 1st partition's syslinux.cfg
LABEL Windows
MENU LABEL ^Windows
KERNEL chain.c32
APPEND hd0 2
TEXT HELP
Boot to Windows
ENDTEXT

The keypoint is "hd0 2". This is very very tricky!! Since we use "hd0 1" in Lilo and Grub. But we use "hd0 2" in syslinux.

2009年9月23日 星期三

How to build ntfs-3g (2009.11.14) ?

How to build ntfs-3g (2009.11.14) ?

If you make and have an error about secaudit.o

Then you need to install package libattr1-dev.

(Also it was not designed to be mandatory. See http://tuxera.com/forum/viewtopic.php?f=3&t=1151&p=5191&hilit=secaudit+secaudit&sid=94d2d635f4de0e2f0acb7962b6459aa0#p5191)

2009年9月17日 星期四

Bash kill a process with a specified name

kill `ps x | awk '$5=="process_name" {printf $1}'`

============

For example, to kill "epiphany-browser":
ps x
->23243 ? Sl 0:57 epiphany-browser

kill `ps x | awk '$5=="epiphany-browser" {printf $1}'`

,where
$1=23243 (pid)
$5=epiphany-browser

2009年9月16日 星期三

Bash string compare greater less

比較字串順序大小用 \> 及 \<,大於等於或小於等於要用 ! 配合來實作。

if [ $str \> $str2 ]; then
echo "greater"
fi

if [ ! $str \< $str2 ]; then
echo "greater or equal"
fi

實例應用:
g_host_os_ver=`uname -r`
if [ ! $g_host_os_ver \< "2.6.28" ]; then
ko=$(echo $ko|sed 's/^\///g') # remove the first /
fi