Much ado about scripting, Linux & Eclipse: card subject to change

2006-07-30

Welcome Back, Opie

Well, after a few weeks with GPE, I decided it was time for better app support, so I've switched back to OPIE. Here's the log:

    Network

  • Fix /etc/network/interfaces - set up wlan:
     # Wireless interfaces
     auto wlan0
     iface wlan0 inet dhcp
     address 192.168.0.100
     netmask 255.255.255.0
     gateway 192.168.0.1
     wireless_essid %YOURSSID%
     wireless_key s:%YOURSTRINGBASEDPASSWORD%
     wireless_mode managed
  • Start up the wireless network
    $ /etc/init.d/networking restart
    SSH

  • Install openssh-ssh (client), openssh-sshd (server), and openssh-sftp (for use with synching later)
  •  $ ipkg install openssh-ssh openssh-sshd openssh-sftp
  • Edit /etc/ssh/sshd_config. Change the default port from 22 to something else.
  • Edit /etc/ssh/ssh_config. Add aliases to local desktop and zaurus, eg:
     Host dbz
     Hostname divbyzero.homelinux.net
     Port 11122
     Host zaurus
     Hostname 192.168.0.100
     Port 10122
  • Restart openssh:
     $ /etc/init.d/sshd restart
  • Disable dropbear - make it exit before doing anything. Can't uninstall it since it's required by task-bootstrap.
     $ /etc/init.d/dropbear stop;  mv /usr/sbin/dropbear /usr/sbin/DISABLED_dropbear;  vi /etc/init.d/dropbear 
  • SSH from remote desktop to zaurus:
     $ ssh -p %anotherPort% %zaurusUser%@%zaurusIPaddress%
     $ ssh -p 10122 nickb@192.168.0.100
    
  • Create .ssh keys:
     $ ssh-keygen -t rsa -b 2048
  • Copy ~/.ssh/*.pub on machine from which you want to connect to the Zaurus keylessly into ~/.ssh/authorized_keys on the zaurus. Try reconnecting as above, should not get a password prompt.
  • Terminal tools

  • Add source for perl: create /etc/ipkg/perl-feed.conf, containing:
     src/gz x11 http://divbyzero.homelinux.net:8080/mirrors/www.openzaurus.org/
    official/unstable/3.5.4.1/feed/perl
  • Then install:
     $ ipkg install bash less perl rsync
  • Add a new user
     $  adduser nickb;  cd /var; chmod o+w,g+w tmp;
  • NOTE: DO NOT set all files in /tmp (just tmp) to be o+w,g+w or Opie won't boot gui on reboot!!

  • Bash config: Edit /etc/passwd to make root and your other user(s) use bash instead of sh.
     root:encryptedpasswordhere:0:0:root:/home/root:/bin/bash
     nickb:encryptedpasswordhere:1000:1000:nickb:/home/nickb:/bin/bash
  • Create /etc/bashrc and /etc/alias files, then point to them with .bashrc and .bash_profile files in home folder:
     #  ~/.bash_profile
     . ~/.bashrc
     #  ~/.bashrc
     [ -f /etc/bashrc ] && . /etc/bashrc
     #  /etc/bashrc
     source /etc/alias
     # 1;34: blue, 1;33: yellow, 1;32: green, 1;31: red, 1;30: grey, etc.
     if [ $UID -eq 0 ]; then # root
       prompt="\[\033[1;31m\]\u@\h\[\033[0;39m\]:\[\033[1;31m\]\w\\[\033[0;39m\] \$ ";
     else
       prompt="\[\033[1;30m\]\u@\h\[\033[0;39m\]:\[\033[1;34m\]\w\\[\033[0;39m\] \$ ";
     fi
     # If this is an xterm set the title to user@host:dir
     case $TERM in
       xterm*)
         export PS1="\! "$prompt"\[\e]30;\u@\H:\w\a\]"
         export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
         ;;
       *)
         export PS1=$prompt
         ;;
     esac
     #  /etc/alias
     alias   ll="ls -lA"
     alias   rm='rm -i'
     alias   cp='cp -i'
     alias   mv='mv -i'
     alias   al='vi /etc/alias'
     alias   sra='source /etc/alias'
     alias   H='history 50'
    
  • Sound

  • Copy an mp3 file to your SD card (or scp the file onto the hard disk. Open Opie Media Player, add the dir where you put the file, and play it. While playing, start a Console and adjust the volume - run alsamixer and adjust sliders for Bass, Treble, PCM (main volume) and Mono.
     $ alsamixer
    Mail

  • Install mutt, mailx, sendmail, ssmtp, fetchmail
     $ ipkg install mutt mailx sendmail ssmtp fetchmail
  • Edit /etc/ssmtp/ssmtp.conf to enable smtp to send mail using you existing smtp setup from another machine:
     root=<me@myemail.com>
     mailhub=smtp.1and1.com
     # Where will the mail seem to come from?
     rewriteDomain=smtp.myemail.com
     # The full hostname
     hostname=me@myemail.com
     # auth user must be your remote email username
     AuthUser=me@myemail.com
     # AuthPass must be your remote email password
     AuthPass=mypassword
    
  • Games

  • Install games (let's be real, this is the real reason I switched to OPIE!)
     $ ipkg install task-opie-games task-opie-extra-games atomic
  • This will include: Asteroids, Atomic, Backgammon, Bounce, buzzword, fifteen (slider puzzle), go!, Kill Bill, KCheckers, KPacman, Mindbreaker, Mine Hunt (a la mine sweeper), OYatzee, ParaShoot, Patience (solitaire), SFCave, Snake, Tetrix, Tictac (toe), Word Game (a la Scrabble), ZLines (a la FivePlus, Lines, etc.), ZSame.
  • Refresh icons in Opie desktop - run Settings > Reload Icons, or the following:
     $ /opt/QtPalmtop/bin/icon-reload.sh
  • Backup/Rsync

  • Back up install using rsync from remote machine (this can be put in a script file and run in your crontab):
     #!/bin/sh
     # Save as ~/BIN/zaurus-sync.sh
     cd /home/nickb/zaurus/_RSYNC_Zaurus_SLC3200_OPIE
     for f in usr etc home; do 
      rsync -qrpogtz root@zaurus:/$f .; 
     done
  • Edit your crontab with crontab -e. You might want something like this, to run a backup once a week at 4am:
     # m h  dom mon dow   command
     0 4 * * 6 /home/nickb/BIN/zaurus-sync.sh 
Note that for this to run unassisted, the user on your desktop whose crontab this is added to much have ssh key access to root@zaurus, where "zaurus" is an alias as defined above in /etc/ssh/ssh_config on the desktop.

3 comments:

Anonymous said...

Hi,

How you can install sendmail? I did not find it in a feed.Or can you post your feed for your zaurus.

CU

nickb said...

There's a few feeds you can use. Searching my mirror, I find:

find . -name "*sendmail*"
./unstable/3.5.4.1/feed/perl/libmail-sendmail-perl_0.79-r0_arm.ipk

find . -name "*smtp*"
./unstable/3.5.4/feed/base/libesmtp-dev_1.0.3r1-r0_arm.ipk
./unstable/3.5.4/feed/base/libesmtp_1.0.3r1-r0_arm.ipk
./unstable/3.5.4/feed/base/ssmtp-doc_2.61-r5_arm.ipk
./unstable/3.5.4/feed/base/ssmtp_2.61-r5_arm.ipk
./unstable/3.5.4/feed/perl/perl-module-net-smtp_5.8.7-r14_arm.ipk
./unstable/3.5.4/sources/libesmtp-1.0.3r1.tar.bz2
./unstable/3.5.4/sources/libesmtp-1.0.3r1.tar.bz2.md5
./unstable/3.5.4/sources/ssmtp_2.61.orig.tar.gz.md5
./unstable/3.5.4/sources/ssmtp_2.61.orig.tar.gz
./unstable/3.5.4.1/feed/base/libesmtp-dev_1.0.3r1-r0_arm.ipk
./unstable/3.5.4.1/feed/base/libesmtp_1.0.3r1-r0_arm.ipk
./unstable/3.5.4.1/feed/base/ssmtp-doc_2.61-r5_arm.ipk
./unstable/3.5.4.1/feed/base/ssmtp_2.61-r5_arm.ipk
./unstable/3.5.4.1/feed/perl/perl-module-net-smtp_5.8.7-r14_arm.ipk
./unstable/3.5.4.1/feed/perl/perl-module-net-smtp_5.8.7-r14_armv5te.ipk

I use ssmtp to send mail using my existing smtp accounts (eg.,
smtp.gmail.com). If you don't have an existing smtp account, drop me a line and I'll invite you to gmail.

Cheers,

Nick

Anonymous said...

thx,
i have now setup ssmtp fetchmail and mutt, now i can read mails i the way i love it ;-)
PS:
I have a smtp account in my server.

Christian