#!/bin/sh

if [ "`ls /usr/lib|grep libSDL`" = "" ]; then
ln -fs /mnt/hd/user/lib/libSDL-1.2.so.0.7.2 /usr/lib/libSDL-1.2.so.0
ln -fs /usr/lib/libSDL-1.2.so.0	/usr/lib/libSDL-1.2.so

ln -s /mnt/hd/user/lib/libSDL_gfx.so.13.0.0 /usr/lib/libSDL_gfx.so.13
ln -s /usr/lib/libSDL_gfx.so.13	/usr/lib/libSDL_gfx.so

ln -s /mnt/hd/user/lib/libSDL_image-1.2.so.0.1.3 /usr/lib/libSDL_image-1.2.so.0
ln -s /usr/lib/libSDL_image-1.2.so.0	/usr/lib/libSDL_image-1.2.so

ln -s /mnt/hd/user/lib/libSDL_mixer-1.2.so.0.2.4  /usr/lib/libSDL_mixer-1.2.so.0
ln -s /usr/lib/libSDL_mixer-1.2.so.0	/usr/lib/libSDL_mixer-1.2.so

ln -s /mnt/hd/user/lib/libSDL_ttf-2.0.so.0.6.1 /usr/lib/libSDL_ttf-2.0.so.0
ln -s /usr/lib/libSDL_ttf-2.0.so.0	/usr/lib/libSDL_ttf-2.0.so
fi

if [ "`ls /usr/lib|grep libfreetype`" = "" ]; then
ln -s /mnt/hd/user/lib/libfreetype.so.6.3.8	/usr/lib/libfreetype.so.6
ln -s /usr/lib/libfreetype.so.6	/usr/lib/libfreetype.so
fi

if [ "`ls /usr/lib|grep libjpeg`" = "" ]; then
ln -s /mnt/hd/user/lib/libjpeg.so.62.0.0	/usr/lib/libjpeg.so.62
ln -s /usr/lib/libjpeg.so.62	/usr/lib/libjpeg.so
fi

if [ "`ls /usr/lib|grep libogg`" = "" ]; then
ln -s /mnt/hd/user/lib/libogg.so.0.5.2	/usr/lib/libogg.so.0
ln -s /usr/lib/libogg.so.0	/usr/lib/libogg.so
fi

if [ "`ls /usr/lib|grep libpng`" = "" ]; then
ln -s /mnt/hd/user/lib/libpng.so.3.0.0	/usr/lib/libpng.so.3
ln -s /usr/lib/libpng.so.3	/usr/lib/libpng.so

ln -s /mnt/hd/user/lib/libpng12.so.0.0.0	/usr/lib/libpng12.so.0
ln -s /usr/lib/libpng12.so.0	/usr/lib/libpng12.so
fi

if [ "`ls /usr/lib|grep libvorbis`" = "" ]; then
ln -s /mnt/hd/user/lib/libvorbis.so.0.3.0	/usr/lib/libvorbis.so.0
ln -s /usr/lib/libvorbis.so.0	/usr/lib/libvorbis.so

ln -s /mnt/hd/user/lib/libvorbisenc.so.2.0.1	/usr/lib/libvorbisenc.so.2
ln -s /usr/lib/libvorbisenc.so.2	/usr/lib/libvorbisenc.so
ln -s /mnt/hd/user/lib/libvorbisfile.so.3.1.0	/usr/lib/libvorbisfile.so.3
ln -s /usr/lib/libvorbisfile.so.3	/usr/lib/libvorbisfile.so
fi

if [ "`ls /usr/lib|grep libz`" = "" ]; then
ln -s /mnt/hd/user/lib/libz.so.1.2.3	/usr/lib/libz.so.1
ln -s /usr/lib/libz.so.1		/usr/lib/libz.so
fi

if [ "`ls /usr/lib|grep libiconv`" = "" ]; then
ln -s /mnt/hd/user/lib/libiconv.so.2.2.0 /usr/lib/libiconv.so.2
ln -s /usr/lib/libiconv.so.2 /usr/lib/libiconv.so

ln -s /mnt/hd/user/lib/libiconv.so.2.2.0 /usr/lib/libiconv.so.2
ln -s /usr/lib/libiconv.so.2 /usr/lib/libiconv.so
fi

if [ "`ls /usr/lib|grep libparagui`" = "" ]; then
ln -s /mnt/hd/user/lib/libparagui-1.1.so.8.0.0 /usr/lib/libparagui-1.1.so.8
ln -s /usr/lib/libparagui-1.1.so.8 /usr/lib/libparagui-1.1.so
fi

if [ "`ls /usr/lib|grep libsigc`" = "" ]; then
ln -s /mnt/hd/user/lib/libsigc-1.2.so.5.0.7 /usr/lib/libsigc-1.2.so.5
ln -s /usr/lib/libsigc-1.2.so.5 /usr/lib/libsigc-1.2.so
fi

if [ "`ls /usr/lib|grep libbz2`" = "" ]; then
ln -s /mnt/hd/user/lib/libbz2.so.1.0.3 /usr/lib/libbz2.so.1.0.3
ln -s /mnt/hd/user/lib/libbz2.so.1.0 /usr/lib/libbz2.so.1.0
ln -s /mnt/hd/user/lib/libbz2.so /usr/lib/libbz2.so
fi

if [ "`ls /usr/lib|grep libSDL_net`" = "" ]; then
ln -s /mnt/hd/user/lib/libSDL_net-1.2.so.0.0.5 /usr/lib/libSDL_net-1.2.so.0
ln -s /usr/lib/libSDL_net-1.2.so.0 /usr/lib/libSDL_net-1.2.so
fi

if [ "`ls /usr/lib|grep libxml`" = "" ]; then
ln -s /mnt/hd/user/lib/libxml2.so.2.6.24 /usr/lib/libxml2.so.2
ln -s /usr/lib/libxml2.so.2 /usr/lib/libxml2.so
fi


if [ "`ls /usr/lib|grep libmad`" = "" ]; then
ln -s /mnt/hd/user/lib/libmad.so.0.2.1 /usr/lib/libmad.so.0.2.1
ln -s /usr/lib/libmad.so.0.2.1 /usr/lib/libmad.so.0.2
ln -s /usr/lib/libmad.so.0.2 /usr/lib/libmad.so.0
ln -s /usr/lib/libmad.so.0 /usr/lib/libmad.so
fi

if [ "`ls /usr/lib|grep libid3tag`" = "" ]; then
ln -s /mnt/hd/user/lib/libid3tag.so.0.3.0 /usr/lib/libid3tag.so.0.3.0
ln -s /usr/lib/libid3tag.so.0.3.0 /usr/lib/libid3tag.so.0.3
ln -s /usr/lib/libid3tag.so.0.3 /usr/lib/libid3tag.so.0
ln -s /usr/lib/libid3tag.so.0 /usr/lib/libid3tag.so
fi

if [ "`ls /usr/lib|grep libsmpeg`" = "" ]; then
ln -s /mnt/hd/user/lib/libsmpeg-0.4.so.0.1.3 /usr/lib/libsmpeg-0.4.so.0.1.3
ln -s /usr/lib/libsmpeg-0.4.so.0.1.3 /usr/lib/libsmpeg-0.4.so.0.1
ln -s /usr/lib/libsmpeg-0.4.so.0.1 /usr/lib/libsmpeg-0.4.so.0
ln -s /usr/lib/libsmpeg-0.4.so.0 /usr/lib/libsmpeg-0.4.so
ln -s /usr/lib/libsmpeg-0.4.so.0.1.3 /usr/lib/libsmpeg.so.0.1.3
ln -s /usr/lib/libsmpeg.so.0.1.3 /usr/lib/libsmpeg.so.0.1
ln -s /usr/lib/libsmpeg.so.0.1 /usr/lib/libsmpeg.so.0
ln -s /usr/lib/libsmpeg.so.0 /usr/lib/libsmpeg.so
fi



if [ "`ls /usr/lib|grep libdevctl`" = "" ]; then
ln -s /mnt/hd/user/lib/libdevctl.so /usr/lib/libdevctl.so
fi

if [ ! -d /usr/local/lib/timidity ]; then
if [ -d /mnt/hd/user/timidity ]; then
	mkdir -p /usr/local/lib
	ln -s /mnt/hd/user/timidity /usr/local/lib/timidity
fi
fi


