#!/bin/sh

HOME=/home/developer
export HOME
libdir=/usr/lib/mad-developer

chmod 555 $libdir/*.sh $libdir/mad-developer $libdir/xterm-shell
chmod 555 $libdir/utfs-client

chown root:developer $libdir/devrootsh
#chmod 4550 $libdir/devrootsh
chmod 4555 $libdir/devrootsh

chown root:root /usr/bin/mad-developer
chmod 4555 /usr/bin/mad-developer

! test -f $HOME/.profile || {
	rm -f $HOME/.profile
	cp $libdir/dot-profile $HOME/.profile
	chown developer:developer $HOME/.profile
}

# FIX accidental /home/user/.profile insertion

case `md5sum /home/user/.profile 2>/dev/null` in
	58610121e1e0687eb56203b7c415db09*) rm -f /home/user/.profile ;;
esac

# mad-withhome.sh will add there, remove old if any.
rm -f $HOME/bin/remote-wrapper.sh 2>/dev/null || :
rm -f $HOME/bin/utfs-client 2>/dev/null || :

# for maemo (no-op...)
gtk-update-icon-cache -f /usr/share/icons/hicolor

# for qemu image, create developer home
$libdir/mad-withhome.sh true
