2009年12月30日 星期三

轉貼 Windows7 + wubi

[技巧] 用WuBi.exe在Win7下硬盘安装UBunTu 9.04
http://bbs.pcbeta.com/thread-475058-1-3.html

win7 wubi安装ubuntu9.10出错信息解决办法(拷贝自他人空间)
http://hi.baidu.com/chin%D0%A1%D7%D3/blog/item/b6be8ab26ddda0add8335a90.html


2009年12月17日 星期四

CD iso 開機 文摘

MobaLiveCD 開機光碟、Live CD模擬器
http://briian.com/?p=6512

萬用可開機工具光碟 - Ultimate Boot CD (UBCD)
http://www.ultimatebootcd.com/download.html

QEMU
http://amanda_hoic.mysinablog.com/index.php?op=ViewArticle&articleId=1343462

把Ubuntu的ISO檔放到2.5吋外接硬碟,然後利用Grub4DOS開機,並成功安裝到桌機的硬碟裡面。
參考的是這一篇http://hi.baidu.com/sxpspace/blog/item/aa29f5f351acf857352acc38.html
重要的是menu.lst裡的這一段:
title Install ubuntu
map (hd0,0)/ubuntu.iso (hd32)
map --hook
root (hd0,0)
kernel (hd32)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu.iso
initrd (hd32)/casper/initrd.gz

==========================
http://phorum.study-area.org/index.php?topic=56636.0
RonLee
之前在官方的教學文件裡看到這句話:http://grub4dos.sourceforge.net/wiki/index.php/Grub4dos_tutorial
CDROM emulation is not implemented.
(也不曉得算不算官方啦,因為看起來像是個很正式的介紹Grub4DOS的網站。 )
一開始看了這句話一度以為真的沒有我要的功能(也有可能我會錯意)。後來不死心又google了一陣子,
終於在上面那篇文章裡找到方法。
一篇好的教學文章真的抵的過千萬篇啊~~
======================

grub4dos 从硬盘引导安装 ubuntu (不解ISO包也可安装)
http://hi.baidu.com/sxpspace/blog/item/aa29f5f351acf857352acc38.html
从硬盘安装 ubuntu 根本不要这么多文件,之前放这么多文件在根目录也是按网络上的方法来做的。用 grldr, menu.lst, ISO 文件,vmlinuz 文件,initrd.gz 文件,以及修改 boot.ini 就可以用 grub4dos 来引导安装 ubuntu 了。假设上面这些文件都放在 C 盘根目录,menu.lst 可以这样写:

title Install ubuntu
root (hd0,0)
kernel /vmlinuz boot=casper iso-scan/filename=/ubuntu.iso
initrd /initrd.gz
boot


当然,可以在不解出vmlinuz 文件,initrd.gz 文件的情况下,grub4dos 也能成功从硬盘引导 ubuntu 安装。这里 C 盘根目录有 grldr, menu.lst, ISO 文件,这时的 menu.lst 可以写作:

title Install ubuntu
map (hd0,0)/ubuntu.iso (hd32)
map --hook
root (hd0,0)
kernel (hd32)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu.iso
initrd (hd32)/casper/initrd.gz
boot

这里用 map 指令将 ISO 文件模拟为硬盘/光盘,在模拟磁盘中读取vmlinuz 文件,initrd.gz 文件。当控制权交给 kernel 后,计算机就从实模式过渡到保护模式。磁盘模拟也就不起作用了。

要注意的是这里 ubuntu.iso 要连续存放,在 grub 模式中可以进行测试,将它放在一个新建的分区可以保证这一点。如果内存够大,可以用 map --mem 指令直接将其映射到内存。ISO 文件不一定要放在 C 盘根目录,只要在上面 iso-scan/filename 中指定路径即可。

上面的测试基于grub4dos-0.4.3,windows XP,Dell Dimension E520, ubuntu 8.04 和 ubuntu 8.10 i386 版均测试成功。


PS: ubnutu 8.10 i386 关机和重启好像有点问题,在这台机器上不能正常运行。

grub4dos下载地址:
http://download.gna.org/grub4dos/

2009年12月10日 星期四

[盜貼]用 rsync 做資料同步,並利用 SSH 做安全加密





資料參考來源:




使用 rsync 做資料同步,並利用 SSH 做安全加密
 ( 適用RHEL4、Fedora Core 3、4 及 5 )
rsync 為 Linux 平台上做異地備援時,不可缺少的好工具,但在傳送時是以明碼傳送,一旦封包被攔劫,有被解讀的風險存在,因為我們要利用 SSH 幫我們在傳遞封包時,將資料加密,以避免被人解讀。


一、語法:
   rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
   rsync [OPTION]... [USER@]HOST:SRC DEST
   rsync [OPTION]... SRC [SRC]... DEST
   rsync [OPTION]... [USER@]HOST::SRC [DEST]
   rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST
   rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
   rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST

二、使用說明:
 1. 當來源端或目的端的路徑都未包含 : 這個分隔符號時,表示複製本地端的檔案。
2. 當目的端路徑包含單個 : 這個分隔符號時,表示複製本地端檔案到遠端機器 ( 透過 ssh 或 rsh )。
3. 當來源端路徑包含 這個分隔符號時,表示複製遠端檔案到本地端。
4. 當來源端路徑包含 :: 或 rsync:// 這個符號時,表示從遠端 rsync 伺服器複製檔案到本地端。
5. 當目的端路徑包含 :: 或 rsync:// 這個符號時,表示從本地端複製檔案到 rsync 伺服器。
6. 當來源端路徑包含 :: 和加上 --rsh=COMMANS ( -e COMMAND ) 參數,表示使用遠端 shell 程式 (remote shell),並透過遠端的 rsync 伺服器,複製遠端檔案到本地端。
7. 當目的端路徑抱含 :: 和加上 --rsh=COMMAND 參數,表示使用遠端 shell 程式並透過遠端的 rsync 伺服器,複製本地端檔案到遠端機器。
8. 列出遠端機器的檔案,跟 rsync 傳輸相同,只不過把本地端的目的地位置留空。

 注意: 在所有狀況下(列出遠端機器檔案除外),來源端及目的端的路徑最少要有一個是本地端路徑.
三、使用方式如下:
 # rsync -avlR --delete -e ssh 來源host_IP:/etc --exclude X11 --exclude httpd 目的位置
遠端主機下的 /etc 目錄,除了 X11 及 httpd 目錄外,其餘的與本地端做資料同步,並用 ssh 作為加密。
a : archive
v : verbose-msg
l : softlink
R : Relative Pathname

 --delete : 來源的資料如果沒有,則目的的資料一併刪除
 -e : command
 --exclude : 排除以外的目錄,需以相對路徑設定

 # rsync -t *.c 目的host_ip:/src
 將目前路徑下所有符合 *.c 的檔案,與目的主機的 /src 目錄做同步,並保留時間記錄。

 # rsync -avz 來源host_ip:/src/bar /data/tmp
將來源主機的 /src/bar 目錄,與本機 /data/tmp 目錄做同步。
-a 表示使用 archive 模式,保持原有的檔案屬性與權限。
-z 傳輸時壓縮資料。

 # rsync -avlr /var/lib/mysql/ /backup
 將本機 /var/lib/mysql 目錄下所有檔案(含子資料夾),同步一份到 /backup 下做為備份。

 在來源端後面加上一個 / 可避免在目的端的資料夾下額外建立一個資料夾。
例如:rsync -av /src/foo /dest 會在 /dest 下產生一個 foo 的資料夾,表示複製這個資料夾。
rsync -av /src/foo/ /dest 則不會在 /dest 下產生一個 foo 的資料夾,表示複製這個資料夾下的內容。

四、參數:
 -h , --help     顯示rsync求助資訊.

 --version      顯示rsync版本.
 -v , --verbose    複雜的輸出訊息.
 -q , --quiet      安靜模式,幾乎沒有訊息產生.常用在以cron執行rsync.
 -I, --ignore-times   通常rsync為了加快速度會忽略同樣檔案大小且同樣存取時間點的檔案.
可以透過此參數關閉此快速檢查.
--size-only     rsync只檢查檔案大小是否改變,不管時間存取點是否改變.
通常用在mirror,且對方時間不太正確時.

 -c, --checksum    在傳送之前透過檢查碼來檢查所有要傳送的檔案.(會拖慢速度.)
 -a, --archive    archive mode 權限保存模式,相當於 -rlptgoD 參數.
保存幾乎所有的權限設定,除了硬式連結(透過-H設定).

 -r, --recursive    複製所有下層的資料(遞迴)
 -R, --relative      使用相對路徑.
如 : rsync foo/bar/foo.c remote:/tmp/ 在遠端產生/tmp/foo.c檔案
rsync -R foo/bar/foo.c remote:/tmp/  在遠端產生/tmp/foo/bar/foo.c 檔案

 -b, --backup    目的地端先前已經存在的檔案在傳輸或刪除前會被備份.
  --backup-dir=DIR 設定備份的資料夾.
  --suffix=SUFFIX 指定備份的檔案名稱字尾形式(預設為~).

 -K, --keep-dirlinks  接收方將連結到資料夾的檔案視為資料夾處理
 -l, --links       複製所有的連結
 -H, --hard-links    保留硬式連結
 -p, --perms     保留檔案權限
 -o, --owner     保留檔案擁有者(root only)
 -g, --group      保留檔案群組
 -D, --devices     保留device資訊(root only)
 -t, --times     保留時間點
 -n, --dry-run    不實際執行傳送,只顯示將會有的傳輸動作
 -S, --sparse    嘗試去處理稀疏的檔案,讓這些檔案在目的端佔去較少的磁碟空間.
 -W, --whole-file     複製所有的檔案,不額外作檢查.
   --no-whole-file  關閉 --whole-file 參數

 -x, --one-file-system 不要跨越檔案系統分界(只在一個檔案系統處理)
 -B, --block-size=SIZE 強制透過rsync程式去比對修復block-sizeforce
 -e  --rsh=COMMAND 定義所使用的remote shell
 --rsync-path=PATH 定義rsync在遠端機器存放資料的路徑
--existing     只比對更新目的端已經存在的檔案
--ignore-existing    忽略目的端已經存在的檔案(也就是不更新)
--delete        刪除傳送端已經不存在,而目的端存在的檔案
--delete-excluded  除了把傳送端已經不存在,而目的端存在的檔案刪除之外,
也刪除 --exclude 參數所包含的檔案.
--delete-after    rsync預設會在檔案傳送前進行相關刪除動作確保接收端有足夠的檔案空間,
但可以透過 --delete-after 讓刪除動作在檔案傳送後再行刪除.
--ignore-errors    忽略任何錯誤既使是I/O error 也進行 --delete 刪除動作.
--max-delete=NUM 定義rsync不要刪除超過 NUM 個檔案.
--partial      rsync若遇到傳輸過程中斷時,會把那些已經傳輸的檔案刪除.
在某種狀況下保留那些部分傳送的檔案是令人高興的.
你可以透過 --partial 參數達到這個目的.
--partial-dir=DIR  在 --partial 參數啟動時,你還可以定義rsync把那些部分傳送的檔案寫入定義的資料夾,
  而非直接寫入目的端.需要注意的是,此資料夾不應該被其他使用者可以寫入.(如:/tmp)
--force       當目的端資料夾被傳送端非資料夾名稱覆蓋時,強制rsync刪除資料夾,即使該資料夾不是空的.
--numeric-ids      不將傳送端檔案的uid及gid值,與目的端的使用者/群組進行配對.
若傳送端並沒有uid及gid的對應名稱(如:原帳號群組被刪除的遺留檔案),
或目的端沒有相對應的帳號/群組,保留數字型態的uid/gid
--timeout=TIMEOUT 設定 I/O 逾時的時間(秒). 超過這個秒數而沒有資料傳送,rsync將會結束.
預設為0,也就是沒有定義逾時時間.

 -T, --temp-dir=DIR   定義rsync在接收端產生暫時性的複製檔案時使用資料夾暫存.
預設是直接在接收端資料夾直接產生暫存檔案.
--compare-dest=DIR 定義rsync在目的端建立資料夾來比對傳送過來的檔案.
--link-dest=DIR   與 --compare-dest 相同,但同時會針對無法改變的檔案建立硬式連結.

 -z, --compress       壓縮模式,當資料在傳送到目的端進行檔案壓縮.
 -P           -P參數和 --partial --progress 相同.只是為了把參數簡單化.
 -C, --cvs-exclude      排除那些通常不希望傳送的檔案.定義的方式與CVS傳送相同:
RCS SCCS CVS  CVS.adm  RCSLOG  cvslog.*  tags  TAGS  .make.state
.nse_depinfo  *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej
.del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/
符合以上條件的都會被忽略而不傳送.
--exclude=PATTER   符合PATTERN(規則表示式)樣式的檔案不進行傳送
--exclude-from=FILE 和--exclude參數相同,不過是把不進行傳送的檔案事先寫入某一檔案.
  執行時,透過此參數讓rsync讀取.(#開頭的行列或空白行會被rsync忽略)
--include=PATTERN 定義rsync不要排除符合pattern樣式的檔案.
--include-from=FILE  和--include參數相同,只不過把要包含的檔案寫到某一檔案.
--files-from=FILE     把要傳送的檔案名稱都精確的寫入某一檔案,讓rsync讀取.
   如: rsync -a --files-from=/tmp/foo /usr remote:/backup

 -0,--from0       定義檔案所要讀取的檔案是null字元結尾.
--version      顯示版本訊息.
--daemon       定義rsync以daemon型態執行.
--no-detach       當以daemon型態執行時,不要進行分裂且變成背景程序.
--address=ADDRESS 定義所要連結(bind)的ip位址或是host名稱(daemon限定)
--config=FILE    定義所要讀取的設定檔rsyncd.conf位置(daemon限定)
預設值為 /usr/local/etc/rsyncd.conf
--port=PORT     定義rsyncd(daemon)要執行的port(預設為tcp 873)                 
--blocking-io     使用blocking I/O連結遠端的shell,如rsh , remsh
--no-blocking-io     使用non-blocking連結遠端的shell,如ssh (預設值)
--stats       顯示檔案傳送時的資訊狀態
--progress     顯示傳送的進度.(給檔案傳送時,怕無聊的人用的..)
--log-format=FORMAT 定義log的格式(在rsyncd.conf設定)
--password-file=FILE 從檔案讀取與遠端rsync伺服器連結的密碼
--bwlimit=KBPS    定義傳輸頻寬的大小(KBytes/秒)
--write-batch=FILE  把紀錄資料寫入一個檔案(給其他相同環境且相同需求的機器使用)
--read-batch=FILE  透過讀取紀錄檔案來進行傳輸.(檔案由 --write-batch 參數產生)
--checksum-seed=NUM 定義檔案 checksum-seed 的大小(byte)

 -4, --ipv4       使用IPv4協定
 -6, --ipv6       使用IPv6協定


2009年11月18日 星期三

Cacti 筆記連結

http://www.mamu.com.tw/blog/2008/06/17/cacti-install-on-centos5/
有了 LAMP環境
裝 rpmforge,再偷懶用 yum install cacti
就自動裝裝不少rpm包了 ...ruby,net-snmp,rrdtool
應該還欠 "安裝與設定 Cacti "把mysql搞定


使用 cacti
http://www.mamu.com.tw/blog/2008/06/22/cacti-virtualhost/


script...看來 CentOS 5.3 可以直接用 yum cacti
http://forum.icst.org.tw/phpbb/viewtopic.php?t=14860
http://forum.icst.org.tw/phpbb/viewtopic.php?f=16&t=14896





官方論壇
Install and configure the Net-SNMP agent for Windows
http://forums.cacti.net/about26151.html



2006年的 Jamyy's Weblog
http://cha.homeip.net/blog/archives/2006/03/cacti.html

2009年11月3日 星期二

VMware server 2.0x 開機自動啟動guest

改版後沒找到可以在哪選...
舊版做出的VM 裡設定的還有作用


--> configure VM --> Advanced tag -->
Configureation Parameters
Name Value
autostart softpoweron
autostop softpoweroff


======================
唔 原來設定放在server那一層...

2009年10月22日 星期四

test

FC2計數器

shell 引號範例

不錯的範例
http://cha.homeip.net/blog/archives/lccnotes.txt

練習:
執行 date 程式會顯示日期時間, 試問下列結果為何?
1) touch "date" ==> 建立 date 檔案
2) touch 'date' ==> 建立 date 檔案
3) touch `date` ==> 建立 星期, 日, 月, 年, 時間... 等6個檔案
4) touch $(date) ==> 同上
5) touch "`date`" ==> 建立一個以目前時間為檔名的檔案
6) touch "'date'" ==> 建立 'date' 檔案
7) touch '"date"' ==> 建立 "date" 檔案
8) touch '$(date)' ==> 建立 $(date) 檔案
9) touch "$(date)" ==> 建立一個以目前時間為檔名的檔案

2009年10月21日 星期三

手動 mount 一個 LVM 的Patition

轉轉轉...



載入LVM所需要的module
% modprobe dm-mod

接著就是找出partiton中的VG(Volume Group),以我的狀況為例,我將硬碟以usb連接到電腦後,由dmesg可以知道有 /dev/sda1, /dev/sda2兩個patitons,在以 fdisk -l /dev/sda 可以知道/dev/sda2是LVM格式。接著,我就執行:
% pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [18.50 GB / 32.00 MB free]
Total: 1 [18.50 GB] / in use: 1 [18.50 GB] / in no VG: 0 [0 ]

從以上結果,可以知道我有一個VG,叫做VolGroup00,他的PV(Physical Volume)是 /dev/sda2
接著執行:

% vgchange -ay VolGroup00
% ls /dev/VolGroup00/
LogVol00 LogVol01

這時候vgchange會在/dev下產生一個VolGroup00的目錄,並且在這個目錄下產生該有的device(其實是link到 /dev/mapper下)。然後我利用 ls就可以知道VolGroup00這個VG下有兩個LV(Logical Volume)。分別是LogVol00 與 LogVol01。然後我只要mount我要的就可以了。

% mkdir /mnt/usb
% mount /dev/VolGroup00/LogVol00 /mnt/usb/

參考資料:
1. Logical Volume Manager HowTo
http://www.linuxforum.net/books/LVM-HOWTO.html
2. Fedora Forum
http://www.fedoraforum.org/forum/archiv ... 64964.html

2009年6月8日 星期一

[轉貼連結]Linux下修partition的筆記




在gnome右鍵加上“加曲目到foobar2000”功能


I made a little script to add files/folders in foobar from the Nautilus context menu. You should install the Nautilus-actions extension to add customized entries to the context menu.
I'm sure it's not perfect but it works on my linux (ubuntu) perhaps on yours too 

CODE
#!/bin/bash
#foobar2000.sh

# your installation directory
cd ~/.foobar2000/

if [ "$1" != "" ]; then
i="$@" 
else 
echo "No files"
exit 0
fi

#files
#add extensions if you want
for ext in .aac .mp3 .mp4 .ogg .flac .m4a .wma .mpc .wav .rar .zip; do
files=`echo $i | sed "s/$ext /$ext\" \"z:/g"`
i=$files
done

#folder
files=`echo \"z:$i | sed "s/ \//\" \"z:\//g"`

eval wine foobar2000.exe /add "$files\""

echo "Action: adding Directory or Files \"z:${files}\" to foobar2000"

exit 0


Save this script in where you want with the name: foobar2000.sh. and make it executable.

After, create a context menu item using the Nautilus Actions Configuration tool. Click on Add in the Nautilus Action configuration window, and in the Add a New Action dialog box, fill in the field like this:

Label: Send to foobar2000 (or what you want)
Tooltip: Send to foobar2000 (or what you want)
Path: /your/directory/foobar2000.sh
Parameters: %M

Next, click on the Conditions tab.: 
Filenames: *
Mimetypes: */*
Check "both"
and check "appears if selection has multiple files or folders"

After, click on the Advanced conditions:
Check "smb (windwos file)"

Finally, click OK and close the Nautilus Actions Configuration tool. Now, when you right-click on a file or folder, you'll see the "Send to foobar2000, and clicking on it will add file and/or folder to foobar2000.




Okay, this is how I do it... shouldn't need any additional scripts, it passes on as many options as you'd like. So "foobar2000 -add file1 file2 directory3 -hide" acts just like "foobar2000.exe /add file1 file2 directory3 /hide" would.
CODE
1234567
#!/bin/bash
# launches fb2k w/ options

# set path to foobar executable
FB2K="C:\Program Files\foobar2000\foobar2000.exe"
# set Internal Field Separator : character should not appear in filepaths uris or options
IFS='|'

# gives the absolute z: path usable by wine
winepath () {
case "$1" in
/*) # absolute path
file="$1"
;;
~*) # unexpanded home-relative (?)
file="$HOME${1:1}"
# HOME + ~/path, stripping ~
;;
*) # relative path
file="$(pwd)/$1"
;;
esac
file=`echo "z:$file" | sed -e '
s%/[^/]\+/\.\./%/%g # replaces /somedir/../ by /
s%\./%%g # removes ./
s%/%\\\\%g # replace / by \
'`
}

# list of arguments separated by IFS instead of space to prevent string splitting
args=""

# go through all parameters given to script and transform them for wine use if needed
until [ -z "$1" ] ; do
case "$1" in

-h|-help)
echo "Usage : `basename $0` [options] [file1 [file2 [...]]]"
echo "Available switches: -add, -play, -pause, -playpause, -prev, -next, -rand, -stop, -exit, -show, -hide, -config -command:, -playlist_command:, -playing_command:, -help."
exit
;;

# add custom options here. Example :
# -rescan)
# args="$args$IFS/command:\"Rescan Media Library\""
# ;;

-*) # options, replacing first character
args="$args$IFS/${1:1}"
;;
# /[^/]+) args="$args$IFS$1" # alternative version, windows syntax

*) # anything else ? could be file path. Or an url... or some other kind of ufo
if [ -e "$1" ] ; then # if it's a file or a directory, translate it for wine
winepath "$1"
args="$args$IFS$file"
else # otherwise keep it as is
args="$args$IFS$1"
fi
;;
esac
shift
done

# replace positional parameters with arguments (starts out with a separator)
set ${args:1}

/usr/bin/wine "$FB2K" "$@" &
exit



Inspired by plukin's script.
You can add as many custom options as you want, see comment inside second "case" block.

Edit : minor readability change. 





kinda funny how all this fuss about changing a unix path into a wine path is totally useless since there is a "winepath" utility. Didin't notice myself before today.
A complete & simpler version of the script to launch foobar with command line arguments would be :

CODE
#!/bin/bash
# launches fb2k w/ options

# set path to foobar executable
FB2K="C:\Program Files\foobar2000\foobar2000.exe"
# set Internal Field Separator : character should not appear in filepaths uris or options
IFS='|'


# list of arguments separated by IFS instead of space to prevent string splitting
args=""

# go through all parameters given to script and transform them for wine use if needed
until [ -z "$1" ] ; do
case "$1" in

-h|-help)
echo "Usage : `basename $0` [options] [file1 [file2 [...]]]"
echo "Available switches: -add, -play, -pause, -playpause, -prev, -next, -rand, -stop, -exit, -show, -hide, -config -command:, -playlist_command:, -playing_command:, -help."
exit
;;

# add custom options here. Example :
# -rescan)
# args="$args$IFS/command:\"Rescan Media Library\""
# ;;

-*) # options, replacing first character
args="$args$IFS/${1:1}"
;;
# /[^/]+) args="$args$IFS$1" # alternative version, windows syntax

*) # anything else ? could be file path. Or an url... or some other kind of ufo
if [ -e "$1" ] ; then # if it's a file or a directory, translate it for wine
args="$args$IFS`winepath -w "$1"`"
else # otherwise keep it as is
args="$args$IFS$1"
fi
;;
esac
shift
done

# replace positional parameters with arguments (starts out with a separator)
set ${args:1}

/usr/bin/wine "$FB2K" "$@" &
exit
This post has been edited by Houlecorn: Feb 14 2009, 01:05

2009年6月6日 星期六

wine + foobar2000 安裝後調整筆記

mv ~/.wine/drive_c/Program\ Files/foobar2000 ~/.foobar2000

改用建link的方式玩 
ln -s  ~/.wine/drive_c/Program\ Files/foobar2000 ~/.foobar2000
 


sudo gedit /usr/bin/foobar2000
CODE
#!/bin/sh
cd ~/.foobar2000/
if [ "$1" != "" ]; then
filename=`echo z:$1 | sed 's/\\//\\\\/g'`
env LANG="zh_TW.UTF-8" WINEPREFIX="/home/你的登入名稱/.wine" wine foobar2000.exe "$filename" &
else
env LANG="zh_TW.UTF-8" WINEPREFIX="/home/你的登入名稱/.wine" wine foobar2000.exe &
fi

單用
LANG="zh_TW.UTF-8"
似乎就可以


加一個icon連結到聲音及多媒體的選單底下

gksudo gedit /usr/share/applications/foobar2000.desktop

[Desktop Entry]
Type=Application
Name=foobar2000
GenericName=Plays Music
Version=1.0
Encoding=UTF-8
Terminal=false
Exec=/usr/bin/foobar2000
Comment=Plays Music
Icon=foobar2000.png
Categories=GNOME;GTK;AudioVideo;Audio;Player;





在gnome右鍵選單加上“add files to foobar2000 ”



Foobar安裝後慣用變更筆記

在第一次安裝後,第一次啟動的 “Quick Appearance Setup”中
先選最底下的“Visualisation + Cover Art + Tabs”

再選 “View” -> “Layout” -> “Enable Layout Editing Mode”
用滑鼠右鍵點選左邊的 “Cover Art + Tabs” 區塊,複製(Copy UI Element)

再選 “View” -> “Layout” -> “Quick Setup”
改用慣用的 “Album List + Properties”
按右鍵選“paste UI Element”,把左邊的區塊蓋上去貼掉

2009年5月27日 星期三

Audacious2 - 播放 cue + ape

在 Ubuntu9.04下,用 Synaptic 查找Audacious
直接選 audacious-plngins-extra
這個套件包的內容說明寫到:支援
去人聲功能、LIRC、Last.fm 、MIDI、Esound/PluseAudio
等等…未經測試的功能…

Synaptic 就自動幫忙找出所有相關要裝的... 共15個包,11.5MB

audacious (version 1.5.1-4ubuntu3) will be installed
audacious-plugins (version 1.5.1-2ubuntu3) will be installed
audacious-plugins-extra (version 1.5.1-2ubuntu3) will be installed
ladcca2 (version 0.4.0-6) will be installed
libaudclient1 (version 1.5.1-4ubuntu3) will be installed
libaudid3tag1 (version 1.5.1-4ubuntu3) will be installed
libbinio1ldbl (version 1.4-12) will be installed
libcddb2 (version 1.2.1-1) will be installed
libfluidsynth1 (version 1.0.8-1.1build1) will be installed
libimlib2 (version 1.4.2-4ubuntu1) will be installed
libmcs1 (version 0.7.1-1) will be installed
libmowgli1 (version 0.6.1-1) will be installed
libresid-builder0c2a (version 2.1.1-7) will be installed
libsidplay2 (version 2.1.1-7) will be installed
python-chardet (version 1.0.1-1.1) will be installed


安裝完後,
開 Preference -> Audio -> Format Detection
“Detect file formats by extension”  取消勾選


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

http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=15668&forum=22&post_id=80128#forumpost80128

http://cpg811106.spaces.live.com/blog/cns!B7E3CF93766170BD!639.entry?sa=589632868



10月4日
Linux Audacious 播放 cue ape 方法
在安裝Audacious與其plugin後在偏好設定

音訊下 自動偵測檔案格=>依副檔名偵測檔案格式取消

竟然就可以讀取cue檔了耶

安裝Audacious ubuntu 指令
$ sudo apt-get install audacious

PLUGIN指令其實可以用萬用字元*來搜尋全部字串
$ sudo apt-get install audacious*

但是直接搜尋會有相依性問題所以還是一步一步來
$ sudo apt-get insatll audacious-plngins
$ sudo apt-get insatll audacious-plngins-extra

2009年5月24日 星期日

Windows 下掛載 Ext3 , Reiserfs

節錄來源:

rockefellerlin

文章編號: 11834574
文章日期: 2009-05-07 17:05
個人積分: 50

(可以讀寫ext3/ext2), 在網路上大家不外乎提到的都是
ext2ifs(http://www.fs-driver.org/)
或是ext2fsd(http://sourceforge.net/projects/ext2fsd/),
但是說真的都沒有很好用 (其實以上二個核心應該都是同一個)...因為我要 Access 的是
USB disk, 它無法 mount 可移除式裝置.

最後是找到一個叫
LTools(http://www2.hs-esslingen.de/~zimmerma/software/ltools.html)
的, 發現它真的好用很多(但是不支援 copy 目錄), 提供給您參考.

2009年5月22日 星期五

裝了 ubuntu 9.04後多加的套件來源

wine
http://wine.budgetdedicated.com/
http://www.winehq.org/download/deb

deb http://wine.budgetdedicated.com/apt jaunty main #WineHQ - Ubuntu 9.04 "Jaunty Jackalope"
Download and save Scott Ritchie's key


試用的  emesen crazy 社群版
http://nelson.pixnet.net/blog/post/24023964
deb http://ppa.launchpad.net/bjfs/ppa/ubuntu jaunty main

2009年5月20日 星期三

Ubuntu 9.04 NBR版 bug & patch


coca
2009-05-09, 23:31
當我喊出
用Ubuntu Netbook Remix 9.04的請注意,不要切回一般桌面,因為重開機以後就會剩下桌面圖示。這是花了幾個小時確認的BUG..囧 ( @ eeePC 1000 )http://www.plurk.com/p/sqw47
http://twitter.com/cocakl/status/1746129260

Nelson (http://twitter.com/NelsonT)悄悄的用MSN傳來一個連結 (http://www.ubuntu.com/getubuntu/releasenotes/904#Missing%20GNOME%20panels%20in%20Ubuntu%20Netbook%20Remix%20after%20using%20the%20desktop-switcher%20application):
Missing GNOME panels in Ubuntu Netbook Remix after using the desktop-switcher application

When using the Switch Desktop Mode option to swap from netbook to classic, the GNOME desktop settings are not retained after a logout. Upon logging back in, users receive just the desktop background image, without the GNOME panels on the top & bottom of screen. This problem will be fixed in a post-release update soon (349519 (https://bugs.launchpad.net/bugs/349519)). 意思就是說,這是一個已知的Bug,我踩到這個地雷了?@_@?。不得不承認,我很NG。
可以感受到Nelson (http://twitter.com/NelsonT)在『科~科』的冷笑,連女友都說『你就很閒阿...』囧。

Neil_Lin (http://twitter.com/Neil_Lin)也確認了這個BUG (http://twitter.com/Neil_Lin/status/1746299954)。

這個問題已經被修正 (https://bugs.launchpad.net/desktop-switcher/+bug/349519/comments/86),並且會很快釋出修正過後的版本。


https://bugs.launchpad.net/desktop-switcher/+bug/349519/comments/86
Launchpad Janitor wrote on 2009-05-06: (permalink)

This bug was fixed in the package desktop-switcher - 0.4.6-0ubuntu1

---------------
desktop-switcher (0.4.6-0ubuntu1) karmic; urgency=low

* New upstream release.
- Fixes corrupting settings on switch. (LP: #349519)

-- Steve Kowalik Wed, 06 May 2009 18:06:12 +1000


Ubuntu 9.04 Netbook Remix on EEEPC 701http://fate8.blogspot.com/2009/05/ubuntu-904-netbook-remix-on-eeepc-701.html

Alsa Mixer config加下面一句到/etc/modprobe.d/alsa-base
options snd-hda-intel model=3stack-dig

解決Launcher慢的patch到下面的link下載, 共2個deb files
http://people.ubuntu.com/~apw/lp349314-jaunty/?C=M;O=A

linux-headers-2.6.28-11-generic_2.6.28-11.43~lp349314apw5_i386.deb
linux-image-2.6.28-11-generic_2.6.28-11.43~lp349314apw5_i386.deb


https://wiki.ubuntu.com/HardwareSupport/Machines/Netbooks#Asus%20Eee%20701-SD


ubuntu 9.04初步筆記

用 wubi 安裝:
似乎要用8.10版的 wubi才能裝,
但點了移除,就會把wubi 建的 ubuntu資料夾砍掉, ubuntu資料夾中原本的
8.04版就沒了...

9.04安裝在 PC 上時沒注意,在裝完後,再裝 Gparted ,要分割外接硬碟時,發現只有基本的幾個檔案格式,沒有 xfs 可以選
但在  9.04 Netbook Remix版的安裝 image裡有(英文版)

用預設的安裝方式,PC版會自己把 ROOT做成 Ext4格式,但NBR版自動做的是Ext3格式!?

bug:Ubuntu Netbook Remix 9.04的請注意,切回一般桌面重開機以後就會剩下桌面圖示




裝完後另外預有的bug:游標移動到各個有特效的 icon上會反應變得很慢

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

新用到的工具
win32diskimager-RELEASE-0.2-r23-win32
將做實驗用的 SD卡做 image 備份
較 ghost 類程式直接方便一點
不過備份出來的 image檔就是一整張 SD卡的容量大小


2009年5月15日 星期五

Ubuntu on eeepc NOTE



裝進 2G SD 卡,製成安裝片(20090211 製作)
使用工具待查,此版本安裝 ext2 分割區,
開完機後認不出  ROOT directory ...做磁碟剩餘空間不詳

ubuntu-eee-8.04.1.iso
ubnfilel.txt
unetbootin-eeeubuntu-windows-238.exe



Ubuntu 9.04   Netbook Remix 版的 img檔
使用 win32diskimager 將 image檔寫入
 寫入到 2G SD卡,img檔 9xxMB ,寫入完成後的磁碟空間亦只有 9xxMB



bug:Ubuntu Netbook Remix 9.04的請注意,切回一般桌面重開機以後就會剩下桌面圖示

裝完後另外預有的bug:游標移動到各個有特效的 icon上會反應變得很慢

2009年5月1日 星期五

擴充wubi 的磁碟空間

http://lubi.sourceforge.net/lvpm.html

http://mypaper.pchome.com.tw/news/coldswallo/3/1311135584/20081112235556/


參考資料:
http://linuxtoy
.org/archives/change-partition-size-with-lpvm.html
用 LPVM 來修改用 Wubi 安裝 Ubuntu 時分配的硬盤大小

http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=11336&forum=7&post_id=57553
建議把wubi的容量調大一點 [論壇 - Ubuntu 與工具程式] - Ubuntu 正體中文站:


http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=50014#forumpost50014
在windows內直接安裝ubuntu 後來發現ubuntu空間不夠怎辦 [論壇 - 新手村] - Ubuntu 正體中文站:


http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=11928&forum=1&post_id=61097#forumpost61097
擴充wubi的磁碟空間? [論壇 - Ubuntu安裝問題] - Ubuntu 正體中文站:

https://wiki.ubuntu.com/WubiGuide#How%20do%20I%20resize%20the%20virtual%20disks?
WubiGuide - Ubuntu Wiki:







How do I resize the virtual disks?

You can use LVPM, at http://lubi.sourceforge.net/lvpm.html

As an alternative, you can use the following script to move /home or /usr to a dedicated virtual disk.

Download wubi-add-virtual-disk, open a terminal and run:

sudo sh wubi-add-virtual-disk /home 15000

Where the first argument is the directory to move to a new dedicated disk, and the second argument is the size in MB.

The 2 directories you are most likely to migrate are /home (if you have a lot of user data) and /usr (if you installed a lot of software).

You should now reboot. If you are happy with the result, you can now remove /home.backup. To undo the changes remove /home, copy rename /home.backup to /home and remove the /home line in /etc/fstab.


https://wiki.ubuntu.com/WubiGuide#How%20do%20I%20resize%20the%20virtual%20disks?
以上是較簡單的方法

之前有另一篇直接改映像檔大小的:
http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=50014#forumpost50014

用ubuntu光碟開

以下假設ubuntu安裝在/media/sda2

打開終端機

cd /media/sda2/ubuntu/disks

sudo dd if=/dev/zero of=root2.disk bs=1MB count=1 seek=80000

sudo mkfs.ext3 -F root2.disk

sudo mkdir tmproot
sudo mkdir tmproot2
sudo mount -o loop root.disk tmproot
sudo mount -o loop root2.disk tmproot2
sudo cp -afuvx tmproot/* tmproot2/
sudo umount tmproot
sudo umount tmproot2
sudo rm -rf tmproot
sudo rm -rf tmproot2
sudo mv root.disk root.disk.bak
sudo mv root2.disk root.disk

重開機試試看ubuntu正常否

如果ok,就移除舊的
sudo rm /host/ubuntu/disks/root.disk.bak

如果不ok,就換回舊的
用光碟重開機
cd /media/sda2/ubuntu/disks
sudo rm root.disk
sudo mv root.disk.bak root.disk
舊的就恢復了
咱們再進入遊戲2
---應該不會有問題,先試試吧

http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?viewmode=flat&type=&topic_id=11336&forum=7

2009年4月30日 星期四

Ubuntu Live CD/Live Disk





http://allenown.blogspot.com/2008/10/portable-ubuntu-for-windows.html




Ubuntu 8.10安裝後調整


Windows Xp + Ubuntu 8.10(64bit)  (wubi)
http://liaozi.twbbs.org/2009/02/ubuntu-810-64.html



[心得]Ubuntu 8.10相關調整...

Ubuntu 8.10出了...不過相關的小問題不少...
我自己對系統做了些調整...現在把他整理一下...

1.升級後無法進入X...
進入終端機後...
sudo Xorg -configure

會生成一個xorg.conf.new在你的家目錄裡...
自己去覆蓋掉原本的xorg.conf...
你可以測試這個xorg.conf.new是否有效...
Xorg -config ~/xorg.conf.new

會出現中間是X的滑鼠指標...這樣就是成功了...
可以按Ctrl+Alt+Backspace跳出...

接著把他覆蓋到/etc/X11/xorg.conf...
sudo cp ~/xorg.conf.new /etc/X11/xorg.conf


2.synaptics觸控板driver相關...
目前不能寫在xorg裡了...
sudo gedit /etc/hal/fdi/policy/11-synaptics-options.fdi

貼上下列內容...
              On     3     2     1     1     


3.讓usb滑鼠插入後自動關閉觸控板...
(需要synaptics driver...)
sudo gedit /etc/udev/rules.d/01-touchpad.rules

ACTION=="add", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/bin/synclient TouchpadOff=1" ACTION=="remove", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/bin/synclient TouchpadOff=0"


4.niconico上字幕是方塊...看不到中文...
sudo rm /etc/fonts/conf.d/49-sansserif.conf


5.audacious不能播放cue的音樂...
偏好設定->音訊->自動偵測檔案格式:"視情形才偵測檔案格式而不立即偵測"...
這項不要鉤選...

6.wine foobar會破音...
把wine調到EsounD輸出...
另外的作法是調到OSS...用padsp wine來跑...
不過我個人沒試過...請自行參照下面網址...
http://forum.winehq.org/viewtopic.php?t=1457&start=5

7.gcin選字問題...
這是gcin 1.4.0的bug...更新到1.4.2以上就好了...
http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=59769#forumpost59769
這裡有新版的1.4.3 pre8...

8.Openoffice 3.0...
用Synaptic把這個源加入套件庫裡...
deb http://ppa.launchpad.net/openoffice-pkgs/ubuntu intrepid main

重新載入...
更新...

9.SMPlayer 0.6.4 & Mplayer SVN...
SMPlayer 0.6.4修正了在compiz下影像出不來的問題...並且改進了自動檢查字幕編碼的能力...
但是需要SVN的Mplayer才能發揮完全的功力...
加入下面的源到套件庫裏面...
deb http://ppa.launchpad.net/rvm/ubuntu intrepid main

之後安裝SMPlayer...

10.sudo後按tab鍵不會自動完成指令...
很奇怪的是...全新安裝的8.10不會在使用者的家目錄裡建立.bashrc...
幸好root裡有...
cp /root/.bashrc ~/.bashrc

找到下面的文字...然後把注解(#)去掉...
#if [ -f /etc/bash_completion ]; then #    . /etc/bash_completion #fi 


或是自己建立一個.bashrc在家目錄下...
gedit ~/.bashrc

貼上上面那三行並且去掉注解...
或是貼上下面的...
complete -cf sudo

---
感覺這次的8.10不是很熱...
不過除了些小bug以外...8.10在我的筆電上跑的比8.04順很多...
尤其是X3100顯示晶片的效能的確有改進...
以前在compiz下跑xv是會想摔電腦的...
---
版權沒有...翻印不究...
歡迎到處轉載...也不用註明作者...
反正只是我自己的筆記而已...
---
有問題要問的也可以順便在這裡提出...
有辦法解決我會順便加上去...
也請其他有能力解決問題的大哥們出點力...

硬體方面的話...那些參數我沒辦法實際測試...
所以像是音效卡發不出聲啦、耳機和喇叭會同時發聲啦、webcam不能用啦...
這些不要來這篇問...
(這篇主要是要整理一般軟體上比較會遇到的問題...)

Ident: 4e98bacf4b751d14f8df | 2008/11/4 10:18
加入wiki囉:

http://wiki.ubuntu-tw.org/index.php?title=Ubuntu_8.10%E7%9B%B8%E9%97%9C%E8%AA%BF%E6%95%B4






smplayer的repo應該是
deb http://ppa.launchpad.net/rvm/ubuntu intrepid main

wiki 也更新了 SMPlayer 的源...

還有再加一個 APTonCD 會 crash 的方法


== 解決 APTonCD 會 crash 的方法 ==

deb 檔下載、安裝: http://launchpadlibrarian.net/18476205/aptoncd_0.1.98-0ubuntu4_all.deb

來源: http://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg1070949.html

2009年4月29日 星期三

Ubuntu 9.04 Netbook Remix Install Guide

http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=14589&forum=1







延伸閱讀 
在 GNU/Linux 下直接從開機光碟中取出它的開機 Image 檔

Ubuntu下的 MD5 工具

資料來源:


沒有找到圖形化的工具....

$ md5sum test.gz #輸出一個檔案的md5值
6de2e84d1ce84ff6e7d5b6b0c6b3c3ec  test.gz


md5sum test.gz test2.gz #輸出多個檔案的md5值
6de2e84d1ce84ff6e7d5b6b0c6b3c3ec  test.gz
3961324833897c971d4c97c32bbdecd0  test2.gz

md5sum test.gz test2.gz > file.md5 #將結果輸出至檔案
(None)

md5sum -c file.md5 #檢查檔案內列示的所有md5與檔案名稱是否錯誤
test.gz: 沒問題
test2.gz: 沒問題

很簡單吧 XD

 

這裡有一個指令搞,可以用來計算md5值。把它存成文字檔案,

名字改成喜歡的,放到 ~/.gnome2/nautilus-scripts 就可以了。

 

這篇文章是一篇定時發表的文章,實際上寫於 09/02/01 19:50



https://help.ubuntu.com/community/HowToMD5SUM

2009年2月13日 星期五

wine切語系跑日文語系程式



安裝日文語系,透過「系統\管理\語言支援」來安裝是最簡單的作法

同樣透過終端機來執行遊戲的安裝程式,如同先前的例子,執行的命令為

LANG=ja_JP.UTF-8 wine Setup.exe


e滑鼠右鍵選屬性,然後選啟動圖示標籤,更改指令內容,加入LANG=ja_JP.UTF-8到其中,如

env LANG="ja_JP.UTF-8" WINEPREFIX="/home/你的登入名稱/.wine" wine "C:\Program Files\

wine自動安裝函式庫的好工具 -- winetricks

http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=12836&forum=2&post_id=66666

胡亂在網路上逛,看到有人用winetricks,似乎很好用,就下載來看看。果然是挺方便的,而且讓wine變得更完整許多。
http://wiki.winehq.org/winetricks
這是官方的說明文件與下載方式
我是直接
sh winetricks
的方式用gui來打勾,然後安裝。
原本media player 9 跑不起來,裝了一堆函式庫之後就能跑了。雖然tvants還是不能看,但是一些2D game已經順利跑沒有問題了。
這個工具包涵字型的添加,就不用那麼麻煩自己從windows裡面的字型複製到wine目錄,還要做些什麼設定。
簡單的說,這相當於wine的懶人包吧!推荐給各位使用。

安裝 winetricks

  1. 首先下載 winetricks

    wget http://www.kegel.com/wine/winetricks

  2. 改成可執行

    chmod +x winetricks

  3. 看客官希望把程式放哪, 例如 ~/bin

    mv winetricks ~/bin/

使用 winetricks

  • 列出 winetricks 使用方法及支援的套件

    winetricks –help

  • 安裝套件

    winetricks < 套件名稱>

    例如安裝 VB6 runtime

    winetricks vb6run

  • winetrick 有一個很*簡陋*的GUI (我寧可使用 cli 也不要用他的 gui )

    winetricks

  • 也可以指定安裝的 wine 目錄, 例如

    env WINEPREFIX=~/.winetest winetricks mfc40

add files/folders in foobar from the Nautilus context menu.

Hi all and thanks for this thread.
I made a little script to add files/folders in foobar from the Nautilus context menu. You should install the Nautilus-actions extension to add customized entries to the context menu.
I'm sure it's not perfect but it works on my linux (ubuntu) perhaps on yours too smile.gif 

CODE
#!/bin/bash
#foobar2000.sh

# your installation directory
cd ~/.foobar2000/

if [ "$1" != "" ]; then
i="$@" 
else 
echo "No files"
exit 0
fi

#files
#add extensions if you want
for ext in .aac .mp3 .mp4 .ogg .flac .m4a .wma .mpc .wav .rar .zip; do
files=`echo $i | sed "s/$ext /$ext\" \"z:/g"`
i=$files
done

#folder
files=`echo \"z:$i | sed "s/ \//\" \"z:\//g"`

eval wine foobar2000.exe /add "$files\""

echo "Action: adding Directory or Files \"z:${files}\" to foobar2000"

exit 0


Save this script in where you want with the name: foobar2000.sh. and make it executable.

After, create a context menu item using the Nautilus Actions Configuration tool. Click on Add in the Nautilus Action configuration window, and in the Add a New Action dialog box, fill in the field like this:

Label: Send to foobar2000 (or what you want)
Tooltip: Send to foobar2000 (or what you want)
Path: /your/directory/foobar2000.sh
Parameters: %M

Next, click on the Conditions tab.: 
Filenames: *
Mimetypes: */*
Check "both"
and check "appears if selection has multiple files or folders"

After, click on the Advanced conditions:
Check "smb (windwos file)"

Finally, click OK and close the Nautilus Actions Configuration tool. Now, when you right-click on a file or folder, you'll see the "Send to foobar2000, and clicking on it will add file and/or folder to foobar2000.





Okay, this is how I do it... shouldn't need any additional scripts, it passes on as many options as you'd like. So "foobar2000 -add file1 file2 directory3 -hide" acts just like "foobar2000.exe /add file1 file2 directory3 /hide" would.

CODE
#!/bin/bash
# launches fb2k w/ options

# set path to foobar executable
FB2K="C:\Program Files\foobar2000\foobar2000.exe"
# set Internal Field Separator : character should not appear in filepaths uris or options
IFS='|'

# gives the absolute z: path usable by wine
winepath () {
case "$1" in
/*) # absolute path
file="$1"
;;
~*) # unexpanded home-relative (?)
file="$HOME${1:1}"
# HOME + ~/path, stripping ~
;;
*) # relative path
file="$(pwd)/$1"
;;
esac
file=`echo "z:$file" | sed -e '
s%/[^/]\+/\.\./%/%g # replaces /somedir/../ by /
s%\./%%g # removes ./
s%/%\\\\%g # replace / by \
'`
}

# list of arguments separated by IFS instead of space to prevent string splitting
args=""

# go through all parameters given to script and transform them for wine use if needed
until [ -z "$1" ] ; do
case "$1" in

-h|-help)
echo "Usage : `basename $0` [options] [file1 [file2 [...]]]"
echo "Available switches: -add, -play, -pause, -playpause, -prev, -next, -rand, -stop, -exit, -show, -hide, -config -command:, -playlist_command:, -playing_command:, -help."
exit
;;

# add custom options here. Example :
# -rescan)
# args="$args$IFS/command:\"Rescan Media Library\""
# ;;

-*) # options, replacing first character
args="$args$IFS/${1:1}"
;;
# /[^/]+) args="$args$IFS$1" # alternative version, windows syntax

*) # anything else ? could be file path. Or an url... or some other kind of ufo
if [ -e "$1" ] ; then # if it's a file or a directory, translate it for wine
winepath "$1"
args="$args$IFS$file"
else # otherwise keep it as is
args="$args$IFS$1"
fi
;;
esac
shift
done

# replace positional parameters with arguments (starts out with a separator)
set ${args:1}

/usr/bin/wine "$FB2K" "$@" &
exit


Inspired by plukin's script.
You can add as many custom options as you want, see comment inside second "case" block.

Edit : minor readability change. 

foobar2000-under-wine-in-ubuntu-


http://polishlinux.org/apps/multimedia/foobar2000-under-wine-in-ubuntu/


Foobar2000 under Wine in Ubuntu

[ Sunday, 25 November 2007, P2O2 ]

Wine full of foobars…

The newest version of Wine (Windows API Linux emulator) allows one to run foobar2000 with most of its plugins in Linux. At last ColumnsUI works correctly! There are a few inconveniences, of course, but more on that later. Let’s check them then!


Author: Wujek_Bogdan

This Howto is based on the Ubuntu system. Installation of Wine on other GNU/Linux systems shouldn’t differ much, though.

  1. Using Ubuntu we have no access to the root account. All commands with root rights are performed with the help of the sudocommand. In the case of other systems users should use the su command.

  2. Wine can be installed in Ubuntu with the help of apt-get. For other distros, one use should run the appropriate package managers (yum, yast, urpmi, etc.) belonging to the distro’s pool of tools.

Preparation

We will need:

  • foobar2000
  • Wine’s latest release

Programs should be downloaded from official sites. But first, the Wine hyperlink must be added to the repo list kept in the /etc/apt/sources.list file.

To do so, open the gedit editor:

sudo gedit /etc/apt/sources.list

The corresponding entries should look like this:

deb HTTP://wine.budgetdedicated.com/apt feisty main  deb-src HTTP://wine.budgetdedicated.com/apt feisty main

Update the package list:

sudo apt-get update

Then install Wine with the following command: sudo apt-get install wine

Hydrogenaudio site contains a guide which recommends manual installation with many nonstandard fonts. You’ll find the Howto here. I must admit I didn’t test it.

Installation

Alas, copying our beautifull foobar from Windows is out of question. We have to install a pristine, clean version of the program. Let’s assume we have downloaded the package to our home directory.

First we have to go to the directory:

cd ~

Now we are to start to install the foobar package:

Wine foobar2000_0.9.4.3.exe  Of course, with newer versions there'll come higher numbers.

Installation process is identical to Windows’ one, but:

- we do not install Audio CD (CDDA) management

- we do not install desktop Shortcut icons and Directory context menus

- we do not install specialized foobar settings (Enable per-user settings) — foobar must keep config files in install directory!

Foobar is to be installed in default directory c:\Program Files\foobar2000, so the “true” directory will look like this:

/home/user's_name/.wine/drive_c/Program Files/foobar2000 

To have everything professionally adjusted (although it’s not necessary) we have to move the foobar directory to default user’s directory where his config files are kept in *nix systems, namely to user’s home directory:

mv ~/.wine/drive_c/Program\ Files/foobar2000 ~/.foobar2000

As the guide’s author suggests, we can uninstall foobar now as it was moved into another place. I didn’t do this, as it is not necessary.

From a practical standpoint, the foobar is now ready to run.

Configuration

Time to start Wine configuration program: winecfg

Let’s click the Sound tab

Select OSS or ALSA driver

Choose Hardware acceleration - Full

Mark - driver's emulation - default frequency 44100, 16 bits per sample

Now we can improve our Ubuntu.

We must add a script to have the foobar start like other Linux applications. Issue the command:

sudo gedit /usr/bin/foobar2000

Type in the following text:

#!/bin/sh cd ~/.foobar2000/ if [ "$1" != "" ]; then wine foobar2000.exe "$1" else wine foobar2000.exe fi

If we installed Wine with CJK we will have to change wine to wineloc -l ja_JP. Now we should save the file and close the gedit.

The file has to have exec rights:

sudo chmod +x /usr/bin/foobar2000

Let’s add the foobar entry to the GNOME menu. Create a config file then:

sudo gedit /usr/share/applications/foobar2000.desktop

Type in the following text:

[Desktop Entry] Type=Application Name=foobar2000 GenericName=Plays Music Version=1.0 Encoding=UTF-8 Terminal=false Exec=/usr/bin/foobar2000 Comment=Plays Music Icon=/home/user's_name/.foobar2000/foobar2000.png Categories=GNOME;GTK;AudioVideo;Audio;Player;

As you can see the file contains links to the foobar2000.png icon.

We should modify the path as the icon is required. A few of them can be found here andthere. The chosen one should be named foobar2000.png in the ~/.foobar2000/ directory.

Foobar can be run from the GNOME menu or from a terminal:

$ foobar2000

It’s up to the user what he will change yet in foobar configuration. There are a lot of good howtos and handy advice on the forum so I’m not going to elaborate on that.

Summary

Now it’s time for the saddest part of the guide — namely, “what is not working under Linux”.

  • ColumnsUI works. It doesn’t crash during basic operations. Only the menu under the right click button, e.g. in Layout option, pops up after a double click.
  • Some plugins demanding .NET Framework do not work correctly or at all.
  • PanelsUI — it needs the gdiplus.dll file to run. It should be placed in the program’s installation directory or in ~/.wine/drive_c/windows/system32.
  • foo_uie_albumart — it works but you will need the gdiplus.dll, libpng13.dll, and zlib1.dll files. They should be placed in the program’s installation directory or in~/.wine/drive_c/windows/system32. The libraries can be grabbed from theHTTP://www.dll-files.com/ website.
  • Ego Spectrum Analyzer — it hangs the application.
  • ProjectM — it doesn’t load at all.
  • Queuemanager — it doesn’t load at all.
  • foo_run — it loads but doesn’t work.
  • Tray’s icon looks ugly, it has a white background and it needs transparency.
  • In most cases foobar works in Wine without a problem. I experienced some unwelcome behavior, however — sound frequently choked during basic operations like directory look up under Nautilus control, or foobar options look through. It seems to me (I’m not sure, this is only my supposition) that the devil lies in my sound card, or to be precise, in its driver, or is caused by its emulation under Wine. I have Audigy 2 Platinum. If anyone bumped into the same problem drop me a line, please.

Let’s see how the foobar looks. This screenshot presents simple example of foobar’s configuration: ColumnsUI plus several plugins. It works.

BloggerAds