#!/usr/bin/perl
#You must have the USB filesystem enabled to use UPDD.\nDo you want UPDD to try to enable it?

open XIN, "</etc/init.d/mountdevsubfs.sh";
open XOUT, ">/etc/init.d/mountdevsubfs.sh.new";

while($buf = <XIN>) {
  $buf2 = $buf;
  $buf=~s/^\s+//;
  $buf=~s/\s+$//;

  if($buf eq "case \"\$1\" in") {
    print XOUT "mkdir -p /dev/bus/usb/.usbfs\n";
    print XOUT "domount usbfs \"\" /dev/bus/usb/.usbfs usbfs -obusmode=0700,devmode=0600,listmode=0644\n";
    print XOUT "ln -s .usbfs/devices /dev/bus/usb/devices\n";
    print XOUT "mount --rbind /dev/bus/usb /proc/bus/usb\n\n";
    print XOUT $buf2;
  }
  else {
    print XOUT $buf2;
  }
}

`mv /etc/init.d/mountdevsubfs.sh.new /etc/init.d/mountdevsubfs.sh`;

