2008年8月14日 星期四

用HAL mount ntfs-3g時, 如何使用中文與強制reset log

先安裝 NTFS-3G 套件:

$ sudo aptitude install ntfs-3g

於 /etc/hal/fdi/policy/preferences.fdi 檔案內的 區段加入下面內容:






ntfs-3g
ntfs-3g
locale=
dmask=000
fmask=111





有前輩對HAL的設定方式比較熟悉的嘛?
上面的 hal 設定檔中,volume.mount.valid_options 裡面我就算設定好 locale / iocharset 等為 UTF8 都無法作用。
只好用網路查的方式,轉個彎解決:

sudo rm /sbin/mount.ntfs-3g

建立 /sbin/mount.ntfs-3g 並加入下面內容
------
#!/bin/bash
/usr/bin/ntfs-3g $1 $2 $3 $4 -o locale=zh_TW.UTF-8
------
$ sudo chmod +x /sbin/mount.ntfs-3g

2008年8月7日 星期四

How to use patch

Patch Single file:
make a patch:
cd program_folder # go into the target folder
diff -Nu old_file new_file > patch_file
# the patch_file is the patch, it can use to patch file for another user
patch a file:
cd program_folder # go into the target folder
patch -p 1 < patch_file
# if you want to UnPatch the file
patch -R -p 1 < patch_file

Patch a Directory:
make a patch:
diff -rNu old_folder new_folder > patch_file
# no need to exec the command inside the program folder
patch the folder:
patch -p 0 < patch_file
# if you want to UnPatch, also use -R
patch -R -p 0 <>