mkdev for sensors-detect

After installing the lm-sensors package it's usually good to probe available sensors unless those supported by the motherboard are already known. However, in Dapper (8.04) the user will get the following error

$ sensors-detect 
No i2c device files found. Use prog/mkdev/mkdev.sh to create them.

and that mkdev.sh or similar is nowhere to be found. Here's a script that will do what needs to be done:

#!/bin/bash
 
# Here you can set several defaults.
 
# The number of devices to create (max: 256)
NUMBER=32
 
# The owner and group of the devices
OUSER=root
OGROUP=root
# The mode of the devices
MODE=600
 
# This script doesn't need to be run if devfs is used
if [ -r /proc/mounts ] ; then
 if grep -q "/dev devfs" /proc/mounts ; then
  echo "You do not need to run this script as devfs is used."
  exit;
 fi
fi
 
i=0;
 
while [ $i -lt $NUMBER ] ; do
 echo /dev/i2c-$i
 mknod -m $MODE /dev/i2c-$i c 89 $i || exit
 chown "$OUSER:$OGROUP" /dev/i2c-$i || exit
 i=$[$i + 1]
done
#end of file

Copypaste that to your favorite editor, save as mki2cdev.sh, give it execution bits

chmod a+x mki2cdev.sh

and run it once as root

sudo ./mki2cdev.sh

and continue with sensors-detect. That error should finally be gone and sensors detected as wanted.