#!/bin/sh
# -------------------------------------------------------
# BuildLinks 1.0 - Found in CCLinux
# License: GPL2 (see LICENSE)
# -------------------------------------------------------
# Warning: the use of this script is deprecated.
# You should use this *only* if '/opt/sbin/linux' cannot
# load all libraries in /etc/ld.so.cache: in this case
# 'buildlinks' is the only solution.
# -------------------------------------------------------

echo "Buildlinks script."
if [ ! -d /opt/local/lib >/dev/null ]; then
	echo "Error!"
	echo "/opt/local/lib was not found!"
	echo "Make sure you mounted a linux root filesystem in /opt/local!"
	echo "Quitting..."
	exit 1
fi

cd /opt/local/lib
for i in *; do
	ln -s /opt/local/lib/$i /lib/$i >/dev/null 2>/dev/null
done
echo "All files in /opt/local/lib have been linked to /lib/*!"

if [ ! -d /opt/local/usr/lib ]; then
	echo "Error!"
	echo "/opt/local/usr/lib was not found!"
	echo "Make sure you mounted a linux root filesystem in /opt/local!"
	echo "Quitting..."
	exit 1
fi

cd /opt/local/usr/lib
for i in *; do
	ln -s /opt/local/usr/lib/$i /opt/lib/$i
done
echo "All files in /opt/local/usr/lib have been linked to /opt/lib/*!"

