#!/bin/sh

#IP an den httpserver für die Module anpassen.
#Der mediatomb upnp server ist auskomentiert in der letzen Zeile.
#Zum starten, den tree nach /mediatomb auf dem usb-device kopieren.
#vfat oder ext format sollte egal sein.
#Die USB und sshd Dateien werden im / vom http-server erwartet.

IP="192.168.1.23"


## USB Module laden und mounten

mkdir /lib/modules
cd /lib/modules
wget http://$IP/scsi_mod.o
chmod a+x scsi_mod.o
wget http://$IP/sd_mod.o
chmod a+x sd_mod.o
wget http://$IP/usb-storage.o
chmod a+x usb-storage.o

cd /
insmod scsi_mod
insmod sd_mod
insmod usb-storage

mknod /dev/sda  b 8 0
mknod /dev/sda1 b 8 1
mknod /dev/sda2 b 8 2

mkdir -m 777 /mnt
mkdir -m 777 /mnt/usbdevice

mount /dev/sda1 /mnt/usbdevice


## sshd laden und starten

cd /tmp

wget http://$IP/sshd
wget http://$IP/scp
wget http://$IP/ssh_host_rsa_key
wget http://$IP/ssh_host_dsa_key
wget http://$IP/shadow
wget http://$IP/passwd

cp shadow /etc
cp passwd /etc

chmod 600 ssh_host_rsa_key
chmod 600 ssh_host_dsa_key
chmod 755 scp
cp scp /bin
chmod 755 sshd
/tmp/sshd -f sshd_config


#/mnt/usbdevice/mediatomb/mediatomb.sh &



