From Organic Design wiki
Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, this is only useful for a historic record of work done. You may find a link to the currently used concept or function in this article, if not you can contact the author to find out what has taken the place of this legacy item.
#!/usr/bin/perl -w

# Script to detect and auto-install the OS image
# on an ide disk connected to the system.

use strict;
my $bb = "/bin/busybox";
my %disks;
my @list = split /^/, `ls /proc/ide`;

# get list of connected devices
foreach my $file (@list) {
	if ($file =~ m/^(hd[a-d])/) {
		chomp $file;
		# filter for type=disk (ignore cdrom)
		if ( `cat /proc/ide/$file/media` =~ m/^disk/ ) {
			# construct a hash with the devices as keys
			$disks{$file}{'device'} = "/dev/$file\n";
			$disks{$file}{'model'} = `cat /proc/ide/$file/model`;

print $disks{hda}{device};
print "You are about to install the Peer OS onto the hard disk of your computer.\n";
print "This installer will ERASE ALL DATA on the target hard drive.\nIf this is not your intention or you do not understand what this means reply NO.\nIf you want to go ahead and initalise the hard drive, reply yes.\n\n";
print "Do you realy want to install? ";
#my $answer = <>;

#if (!grep /^y/i, $answer) { print "Aborting. Your disks were not modified.\n"; exit; }

#if ( keys( %disks ) > 1 ) {
#	print "\nMultiple hard drives detected:";
#	my @disks = keys %disks;
#	foreach (@disks) {
#		print "$_\n: model ${$_}{'model'}\n";
#	}
#	}

print "Initialising filesystem on hda\n";

system "mkfs";
#system "mount /dev/hda /install -t devfs";