Document Home

Valid HTML 4.01 Transitional

Nokia N810 and 770 Internet Tablets
Scripts

James F. Carter <jimc@math.ucla.edu>, 2006-03-24, updated 2008-03-15

Here are brief notes about the scripts I've written for the ITB that are mentioned elsewhere in this set of pages. Each headline is a link to the script, by which you may view or download it.

=== WARNING ===

Jim Carter provides these scripts WITHOUT ANY WARRANTY. Some of these scripts had a very baleful effect on the ability of my ITB to boot, until I got them debugged. YOU are responsible to review each script and to adapt it to the way you have set up your own ITB, backup server, etc. Back up your machine first, and refer to these notes if you mess up your root filesystem.

System Utility Scripts

backup-selen

Finds files newer than a timestamp file (marking the time of the previous backup), and uses rsync to send them to a directory on another machine. You need to edit this hostname and the backup directory, and you may also want to change the list of directories on the ITB that are backed up. Depends on having Gnu Find, from the findutils-find-xargs package, and rsync from the rsync package.

Any directory may have a file .rsync-filter to (among other things) exclude particular files or directories. Most important is to exclude the demo audio and video files, which are large and useless. An exclusion line for rsync is a hyphen, a single space, and a filename or glob pattern. Specifically:
In Directory Exclusion
/home/user/MyDocs/.videos - *.avi
/home/user/MyDocs/.sounds - *.mp3

I've installed it as /root/bin/backup-selen (this filename is arbitrary but matches what I do on other machines). I usually don't have my ssh-agent loaded with keys on the stealable ITB, so to do the backup, I make sure that Selen is awake and has a net connection, then on a machine with the ssh-agent loaded with a key valid on Fafnir (the server where the backup is going) I just do:

ssh -A selen /root/bin/backup-selen
battest

Plays your video(s) over and over and over, and does other CPU-intensive activities, to run down the battery in a standard way that can be timed. The program assumes that you have a web server on your intranet with a directory stuffed with several megabytes of files that can be downloaded over and over. You'll need to edit the URL of that material.

memuse

Reports total memory usage, showing private and shared mappings separately, and the shared ones only once per referent file. Run it to get a "before" reading, start some bloatware, then run it again. The script should work on any system with /proc/$PID/maps files. I don't know the earliest that this feature came in, but 2.4.20 (very old kernel) has it.

pine-url

This is a helper script for Pine so that it can make the web browser display a URL that was found in a mail message. It uses dbus to make this happen.

install-software

Just a laundry list of software, but it makes installation so much easier after you re-flash the N'th time you hork your root filesystem. Of course, edit the list according to what you want installed. It really helps if you have copies of the package files in a local cache, e.g. an intranet web server.

keyboard.pl

For dumping the keyboard layout from any of the files in /usr/share/keyboards. My keyboard hacks are described here.

en_GK.vkb

The en_US virtual keyboard with the punctuation rearranged to be more geek-friendly, i.e. not lacking punctuation used in shell commands, and with the most-used shell-active punctuation unshifted, like hyphen, double quote and dollar sign.

Abandon All Hope, Ye Who Enter Here

These scripts are for being myself on the ITB. While they work reliably for me, they are nonstandard and if anything goes wrong your ITB will not be able to boot. Please read the above link for a discussion of what I'm trying to accomplish, and some of the pitfalls.

init.d/S13networkJ

Pre-configures the wireless network. You'll need to fill in your own fixed IP address, netmask, ESSID and WEP key. This script turned out to be not that useful, since in case of horkage the watchdog timer will reboot in 30 seconds, but it does work and doesn't confuse the connection manager.

init.d/S13pickuser

This is a totally gross kludge which determines who is the first user in /etc/passwd in the users group, and logs in that user on the ITB, i.e. creates a file /tmp/pickuser containing that user's loginID. Subsequent scripts read that file.

init.d/S13selfheal

If /var/log/selfheal exists, the script appends a line to it, and if there are more than 3 lines (i.e. we're in an infinite loop of rebooting), the script reverts all hacked files in /etc to their original state. If you do boot successfully, remember to cp /dev/null /var/log/selfheal, or remove the file to turn off the safety feature. See the accompanying install-hacked script to re-install your hacked versions.

hacked/init.d/rc.jimc

/etc/init.d/rc was hacked to append the output of each startup script to /var/log/rc.log. It creates this file if needed, and rotates it if it gets large.

hacked/init.d/af-base-apps.jimc

Does su $USER to run various stuff, where formerly USER=user, but is now taken from /tmp/pickuser.

hacked/init.d/af-services.jimc

Does su $USER to run various stuff, where formerly USER=user, but is now taken from /tmp/pickuser.

hacked/init.d/af-startup.jimc

Does su $USER to run various stuff, where formerly USER=user, but is now taken from /tmp/pickuser.

hacked/init.d/maemo-launcher.jimc

Sets USER from /tmp/pickuser for launching various applications, where formerly it was hardwired for USER=user.

install-hacked

For all files in /etc of the form xyz.jimc, it copies these to the basename (xyz). This is to re-install the hacked files if selfheal has reverted your hacks.

install-hacked-setup

For all hacked files in the backup directory, this script makes a backup copy of the unhacked file, that selfheal can revert from. This is for installing hacks en masse after you re-flash your filesystem.

install-scripts

This installs the three S13 scripts described above and creates links in runlevels 2 3 4 5.

hacked/passwd.jimc

/etc/passwd with a line defining the jimc user. Of course you will want to put in your own loginID instead. The only password here is the root password :-) which is the same on all Maemo installations. So far, I have never found a situation where I'm asked for the root password -- except possibly on an incoming SSH connection if /etc/ssh/sshd_config is set up with insufficient paranoia. It should allow only publickey authentication for root, or for anyone else.

hacked/profile.user.jimc

This is .profile for the ordinary user, which execs bash, but only for an interactive shell. It also sets the path the way I like it, and some other settings.

hacked/sudoers.jimc

Sudoers is hacked to allow both user and jimc to do the various activities. I inserted this line at the beginning. There is a blank before and after the = and a blank after the comma; I'm not sure how picky sudo is about whitespace, but it's picky about everything else. Remember that /etc/sudoers must have mode 440, or else sudo will reject it and your ITB will be unable to boot.

User_Alias USERS = user, jimc
And I changed user on all other lines to USERS.

Document Home