Monday, November 12, 2012

Handle ZIP Archives with non-ASCII Filename

The workhorse is lsar/unar from The Unarchiver project.
http://code.google.com/p/theunarchiver/

Installation (Ubuntu 12.04 or above):

sudo apt-get install unar

Usage:

# Try list files first 
# Filename encoding will be automatically detected
lsar foo.zip
# If filename is already correct, unarchive
unar foo.zip

# If automatic detection fails
# Manually specify a encoding and check the result
lsar -e ENC foo.zip
# Once correct encoding is found, unarchive
unar -e ENC foo.zip

Reference: 

http://manpages.ubuntu.com/manpages/precise/en/man1/lsar.1.html
http://manpages.ubuntu.com/manpages/precise/en/man1/unar.1.html

Saturday, November 3, 2012

Install Ubuntu 12.04 on MacBook Pro 8.1

Description:

My origin environment is solely OS X 10.7.
I install Ubuntu 12.04 as another OS, i.e., the result is dual-boot.

Disclaimer:

My MBP has Intel graphic only. If yours has Nvidia graphic, things may be totally different.

Prerequisite:

1. Free space allocated for Ubuntu 12.04.
Disk Utility in OS X 10.7 can help you. Hold option to enable its hidden partition feature.

2. Direct (no VPN, etc.) wired Internet connection.

Procedure:

1. Install rEFIt to OSX:
http://refit.sourceforge.net/

2. Install ELILO
http://sourceforge.net/projects/elilo/
You may follow "Starting Linux with elilo" section below.
http://refit.sourceforge.net/doc/c2s2_startos.html
To be sure, you can reboot and try load ELILO without a elilo.conf, it should show some stupid error messages.

3. Download Ubuntu net install kernel and create elilo.conf
Download the following file:
http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/netboot.tar.gz
And extract "initrd.gz" and "linux" file to the directory where ELILO is installed.
Create elilo.conf like the following:
image=linux
initrd=initrd.gz
label=Ubuntu


4. Reboot and launch Ubuntu 12.04 installer through ELILO
The installation process should be easy to follow.
When asked to partition, choose a option that use all unused space. (The guided option seems to lack the chance of review. If you want to a scheme different from single / and swap, you should use manual. )

5. Install Firmware for WiFi
My WiFi chip is BCM4331, check yours using the following command:
lspci -vvnn | grep 14e4
For BCM4331, "firmware-b43-installer" package won't work since its postinst script is slightly outdated.
http://pad.lv/912941
So we do the following:
Install "b43-fwcutter" package.
Manually  download  and extract firmware following b43 upstream's instruction below:
http://linuxwireless.org/en/users/Drivers/b43#If_you_are_using_the_b43_driver_from_3.2_kernel_or_newer:

6. Re-enable rEFIt
For unknown reasons, GRUB installed by Ubuntu cannot boot Mac OS X correctly. So we need some additional steps:
6.1 Hold option key and power on the MacBook Pro.
6.2 Select the volume different from Recovery
6.3 Select OS X in rEFIt menu
6.4 Open Terminal in OSX and do the following:
cd /efi/refit
./enable.sh
6.5 (Optional) You may want to remove ELILO stuff installed before so it won't pollute your rEFIt menu later.
6.6 (Optional) You may want to remove Mac OS X entries in GRUB's menu, do the following in Ubuntu's Terminal:
sudo chmod -x /etc/grub.d/30_os-prober
sudo update-grub

Optional Steps:

0. As a reminder, two-finger click on Trackpad become right-click.

1. Enable two-finger scrolling
System Settings => Mouse and Touchpad => Touchpad
Change "Scrolling" to "Two-finger scrolling".
The direction seems to opposite to that OS X 10.7's. I don't know whether this is changable.

2. Install Ubuntu Tweak
http://ubuntu-tweak.com/
It contains some tweak options that otherwise require text file editing to change.
( I'm absolutely fine with CLI and text file editing, but a sane GUI environment should not depends on such stuff too much. ) 
It may crash from time to time, just relaunch it.

3. Disable Overlay scrollbars:
If you find overlay scrollbars insane like me, disable it.
Ubuntu Tweak =>
Tweaks =>
Miscellaneous =>
"Overlay scrollbars:" => Off
Better to logout and re-login so all the application would have sane

scrollbars.

4. Install restricted crap, e.g., MP3
As a reminder, MP3 support is needed for Ubuntu One Music Store to work.
"ubuntu-restricted-extras" should be suffice for most cases.
https://help.ubuntu.com/community/RestrictedFormats
I personally don't like Microsoft fonts and Adobe Flash though.
You can avoid Microsoft fonts by reject its EULA.
Adobe Flash can be removed by removing "flashplugin-installer" package.

5. Install Google Chrome
http://www.google.com/chrome/
My favorite browser remains Firefox.
But I use Google Chrome whenever I'm forced to use Adobe Flash.