#!/bin/sh

rm /usr
rm /boot/home/config/rstartd
ln -s /boot/home/config /usr
ln -s /boot/home/config/X11/var/X11 /boot/var/X11


if [ -e "$HOME/config/boot/UserBootscript" ]; then
	if [ -z "`grep 'ln -s /boot/home/config /usr' "$HOME/config/boot/UserBootscript"`" ]; then
		cat >> "$HOME/config/boot/UserBootscript" << TAGEOF

# Added by X11 package
mv /usr /usr_old
ln -s /boot/home/config /usr

TAGEOF
	fi
fi


if [ -e "$HOME/.profile" ]; then
	if [ -z "`grep 'export DISPLAY=127.0.0.1:0' "$HOME/.profile"`" ]; then
		cat >> "$HOME/.profile" << TAGEOF

# Added by X11 package
export DISPLAY=127.0.0.1:0
export C_INCLUDE_PATH=\$C_INCLUDE_PATH:/usr/X11/include
export CPLUS_INCLUDE_PATH=\$CPLUS_INCLUDE_PATH:/usr/X11/include

TAGEOF
	fi


	if [ -z "`grep 'export PATH=$PATH:/usr/X11/bin' "$HOME/.profile"`" ]; then
		cat >> "$HOME/.profile" << TAGEOF

export PATH=\$PATH:/usr/X11/bin

TAGEOF
	fi


	if [ -z "`grep 'export LIBRARY_PATH=$LIBRARY_PATH:/usr/X11/lib' "$HOME/.profile"`" ]; then
		cat >> "$HOME/.profile" << TAGEOF

export LIBRARY_PATH=\$LIBRARY_PATH:/usr/X11/lib

TAGEOF
	fi


	if [ ! -z "`grep 'export LANG' "$HOME/.profile"`" ]; then
	sed 's/export LANG/#export LANG/g' .profile >.profile.tmp
	rm .profile
	mv .profile.tmp .profile
	fi
fi
fc-cache/fc-cache -f -v
