Never Mail me: Hunny

Never Mail me: Hunny Never Mail me: Hunny Never click here!
powered by EUserv
This page is part of my Western Digital My Book World Edition scratch pad.

Making your system grown up

Before you start, read here!

Most things I explain on the other pages require access to a shell, either by a serial connection or by ssh. I also recommend you familiarise yourself with ipkg and optware and install a late busybox and make a bash your default shell. But do not install further things you do not really need, before you read: Silencio!

Doing these steps (especially installing the new busybox) gives you all the tools you really need. The pre-installed busybox is minimal and leaves most of the programs without the sophisticated switches. As an example find does not understand -o and -a, -atime. To see the difference, you call the original crippled program by e.g. /bin/find and the more sophisticated by /opt/bin/find. Sometimes it might be handy to use the original, and the system itself needs them, so leave intact! But for your shell, put /opt/bin first in your PATH variable.

This is what I did:
1) Update to the latest firmware with help of the GUI. My FW version is 01.02.06. Everything I write on these pages refers to this version.
2) Prepare the box to use optware and install bash and a complete busybox.

wget http://mybookworld.wikidot.com/local--files/optware/setup-whitelight.sh
sh setup-whitelight.sh
/opt/bin/ipkg update
/opt/bin/ipkg install busybox
/opt/bin/ipkg install bash
ln -s /opt/bin/bash /bin/bash

3) Edit your /etc/passwd to make use of bash. DO NOT change whatever may be instead of the :x: !! There was a discussion about firmware updates that changed behaviour of using shadow passwords or not, and how to fix.

root:x:0:0:root:/root:/opt/bin/bash

Useful changes to your profile

4) Edit the "original" .bash_profile, it does set a PATH unsuitable for this box. This is my .bash_profile:

# .bash_profile
source .profile
umask 022
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

5) Edit .bashrc as well and delete the lines that modify PATH.
6) Edit your .profile. Most of this is a matter of taste. Change to your flavour. But to make use of the newly installed busybox, you SHOULD add /opt/bin early in your PATH.

# depending on how you call your .profile you might prefer 
PATH=/opt/bin/:$PATH 
# or 
PATH=/opt/bin/:/usr/bin:/bin:/usr/sbin:/sbin 
# in case user has his own bin 
test -d ~/bin && PATH=$PATH:~/bin 
 
# an easy way to expand PATH to current dir 
alias ap='PATH=$PATH:$PWD' 
 
# some handy ls'es 
alias l='ls -al' 
alias sd='ls -CFh' 
alias sda='ls -CFa' 
alias lt='ls -lth' 
alias la='ls -la --time=atime' 

# depending on your terminal setting, you might prefer to call MC in ascii mode
alias mc='mc -a' 
 
# some handy cd 
alias ..='cd ..' 
alias cdSM='cd /DataVolume/Public/Shared\ Music/' 
 
alias md=mkdir 
alias rd=rmdir 
alias halt='sync; /usr/sbin/xfs_quota -x -c off;/etc/rc.poweroff;sync;exit' 
alias reboot='sync; /usr/sbin/xfs_quota -x -c off;/etc/rc.reboot;sync;exit' 
 
# my own locate. grep from a daily updated list (shares and system) 
locate() 
{ 
 grep -i $* /shares/Public/VAR/?list.txt 
} 
 
# my preferred hexdump 
hd() 
{ 
 hexdump -e '"%08_ax: " 16/1 "%02x " " "' -e '16/1 "%_p" "\n"' $* 
}  
 
# some things I want to see when I log on 
tail -50 /var/log/messages 
date  

Midnight Commander

While I feel quite at home on my bash, there is one tool even I like to use. Yes, you can get it via optware as well. Response to your keys may be poor, as the box does not know much about terminals. But you can teach your keys to the MC.