Don’t just install everything into /usr/local

If you use windows then this is probably going to be very, very boring.
Every now and again you find yourself needing to install some piece of software on your computer from a source package. You tar xjf the package and descend into the subdirectory and type ./configure.
At this point I would yell stop! Rather than putting it into the default location of /usr/local, consider putting it in /usr/local/<package-version>.
How does this help I hear you ask. Well, using a simple script (in the extended entry), you create a set of symbolic links in the /usr/local directories which reference the files in the /usr/local/<package-version> directories.
If you decide to remove the package then simply remove the /usr/local/<package-version> directory and all the symlinks become broken. By using symlinks -rd /usr/local you clean the file system up and everything is peachy. If you don’t have a copy of symlinks, it is available from the debian repository, where you should find the source package somewhere near the bottom.

#!/bin/bash -p
package=$1
destdir=${2:-/usr/local}
me=${0##*/}
[[ -z $package ]] && {
echo "Usage: $me <package> [destination = /usr/local]"
exit 2
}
cd $destdir/$package || {
echo "$me: package $package does not seem to be installed"
exit 1
}
# build the directory structure - this is a weakness
find . -type d | cpio -o | (cd $destdir; cpio -id)
find . -type f -exec $echo ln -s $destdir/$package/{} ../{} \;

Oh, and for solaris, as I’m using the file in various locations surrounded by symbols you will have to just pass it into a sub-program to execute the link command. Apparently solaris doesn’t just substitute the name of the target for the link; instead it will only substitute the name of the target when it is isolated (i.e. you would need to use the {} on their own without anything surrounding them – which explains the space between the closing brace and the backslashed semicolon – old habits). I supposed I could throw a bit of perl at this problem but… it works on my box so frell the rest of you :).
Meh, the entire problem is annoying; generally I would always have to create a program to process the {} operation anyway to prevent space characters from getting in the way but as we say in the trade 99% is better than 0%. If you want a 100% solution you need to add a script that performs the link – one per line produced from the find.

Differences between the busybox shell and the real bourne shell

Feature Bourne Shell Busybox Shell Bash
Subprocess Execution “ (the backtick) “ or $() As Busybox
Math Evaluation use expr (not builtin) $(( )) As Busybox; adds ((var=math))
Constants None None typeset -r
Integers None None typeset -i
Evaluation [ [ [
Extended Evaluation /bin/[[ (1) /bin/[[ (1) [[


(1)
The [[ operator is not the same as the program /bin/[[ as a program you need to still use double quotes around the variables to be expanded; thus defeating the reason for having them in the first place.

For Example:

# file="/tmp/let me go"
# touch "$file"
# [[ -e $file ]] && echo "There"

Yields [Busybox]:

[[: me: unknown operand

– as $file is word split before handing it to the command [[

Yields :

There

– due to $file not being split when passed to the test -e.

I’ve started so I’ll finish

I was saddened to hear that Magnus Magnusson has died at age 77. Most of us remember him as the quiz master for mastermind. A fiendish quiz show for the real swots.

Whiney applications…

If there’s one thing I can’t really stand, it’s applications that whinge about everything that goes wrong with an array of practically useless dialogs. One of my biggest gripes at the moment is of all things Thunderbird. It has to be one of the most whiney applications. When things go wrong it pops up a dialog which generally has only one option ‘ok’.
The most regular complaint dialog I get is because it’s incapable of connecting to the mail server. Outlook has solved this years ago with the connection status bar at the bottom of the screen. When things go well, the notification goes away once the communication has completed. When things go wrong you get a ‘send/receive errors’ item in the status bar. It expands to a dialog which gives you the status of each of the activities it was performing at the time.
Thunderbird…. every failed connection is a modal dialog box with ‘connection to foo failed’. I gather my email from many disparate sources and this is no end of an annoyance to me as normally when one fails they all fail.
Is is that there isn’t a graceful way of bringing up failure notifications to users?

It’s all about meme (Ipod Oracle)

Young dermot was consulting the Ipod Oracle, so I decided to do the same.
You have a set of questions you ask. Put the player in random and based on the songs that come up you answer the questions and put in a comment.
The List of questions are hidden here:

The Complete List of my answers are hidden here:

VAT me baby (play)

Apparently play.com are being naughty with the VAT situation. Pick a price in pounds. If it exceeds a certain value (£18) it is subject to vat in the UK. Make sure this is the case.
Translate the price to euro using something like XE’s universal currency converter. Then click on the ‘price in euros’ button on play. They’re pretty similar.
Read the fine print in the terms and conditions… item 26 states you will be charged tax where appropriate … item 32 states only if you’re in jersey. Apparently play are paying tax to addresses delivered in the UK, but not to addresses in other european countries (like Ireland).
So the long and short of it is that they’re pocketing the tax difference and then when customs screw you on delivery of your item and add a €5 handling fee you have every right to be angry with them. Suddenly those DVDs aren’t cheap anymore.
Mind you there’s a getout clause. If the value of the item does not exceed €22 then you should not be charged VAT on it. This information is outlined in the Customs Duty and VAT at Importation leaflet.

swapping, binaries and the pagefile attack

It was something brought up by Joanna Rutkowska that her original pagefile attack on Vista was now stalled because Microsoft removed the ability of administrative users to perform write operations on the physical disk. So what happens to all those developers of undelete utilities (use a second disk?).
Firstly, lets look at the attack in more detail. What happens is that the kernel is forced to swap out pages of memory from drivers that are loaded in the kernel. These pages are swapped out to disk. I for one find this to be an incredibly stupid place to swap out the pages, as after all, until the kernel is completely done with a driver the original copy remains on disk.
Ok, maybe it had something to do with the new paging mentality of vista (you can page onto a usb memory device if it’s fast enough).
Damn, I’m talking myself out of my own argument.
No, paging of code from binaries should revert to the on-disk copy unless they have made COW modifications to their segments (does windows do this?)

the fact that they’re on holiday is an advantage

being at work again raises a few interesting issues. One of them involves the period over Christmas. It seems like there’s nobody in the office (I am one of three/four). I have 0.6 days holiday left and I am troubled. Damn my work related guilt.

My Frelling Documents

The old new thing has a short article about the use of the My Documents, which links to a short entry about the use of the Documents folder on the Mac.
Let’s see how many folders I have on my little box that are not of my creation

05/05/2006  13:39    <DIR>          ACT Projects
05/05/2006  13:40    <DIR>          AdobeStockPhotos
24/11/2006  19:30    <DIR>          Bluetooth Exchange Folder
04/12/2006  22:29    <DIR>          Borland Studio Projects
23/08/2006  17:15    <DIR>          History
04/05/2006  14:02    <DIR>          InterVideo
06/12/2006  22:01    <DIR>          Java Development
12/10/2006  13:07    <DIR>          My Albums
05/05/2006  13:49    <DIR>          My Data Sources
01/11/2006  15:29    <DIR>          My Digital Editions
29/12/2006  03:06    <DIR>          My Downloads
05/08/2006  16:19    <DIR>          My DVDs
08/08/2006  18:26    <DIR>          My Games
05/05/2006  13:53    <DIR>          My MMS
25/12/2006  21:04    <DIR>          My Music
28/12/2006  11:42    <DIR>          My Pictures
11/05/2006  10:19    <DIR>          My Received Files
05/05/2006  13:53    <DIR>          My Shapes
05/05/2006  13:53    <DIR>          My Skype Content
11/05/2006  10:19    <DIR>          My Skype Pictures
27/12/2006  22:10    <DIR>          My Videos
07/12/2006  14:43    <DIR>          My Virtual Machines
21/12/2006  09:34    <DIR>          My Widgets
12/12/2006  10:11    <DIR>          Nero Recode
05/05/2006  13:53    <DIR>          NeroVision
27/11/2006  14:40    <DIR>          PSP Games
27/11/2006  14:56    <DIR>          PSP Sync
06/10/2006  17:18    <DIR>          Rogue Trooper
05/05/2006  18:23    <DIR>          SimCity 4
15/10/2006  23:57    <DIR>          Source Insight
05/10/2006  20:16    <DIR>          Tomb Raider - Legend
05/05/2006  13:59    <DIR>          TT Installer Logs
14/11/2006  12:14    <DIR>          Updater
05/05/2006  13:37    <DIR>          Visual FoxPro Projects
17/11/2006  22:39    <DIR>          Visual Studio 2005
25/09/2006  18:02    <DIR>          Visual Studio Projects

I mean, what the frel is TT Installer logs? For the most part, all code goes into a version controlled sub directory, which is not under my documents (that would be silly). Bleugh… the save game location being under My Games is fine, but not in my documents; maybe under Application Data/Local Settings/Games would make more sense. You can’t load them except from the game so why have them there.