#!/bin/sh

echo Installing apt...

bits=`isainfo -b`
osver=`uname -r`

if [ $bits = "64" ]; then
    sparctype='sparc64'
elif [ $bits = "32" ]; then
    sparctype='sparc'
else
    echo "Unknown platform"
    exit 1
fi

if [ $osver = "5.9" ]; then
    solaris='2.9'
elif [ $osver = "5.8" ]; then
    solaris='2.8'
elif [ $osver = "5.7" ]; then
    solaris='2.7'
elif [ $osver = "5.6" ]; then
    solaris='2.6'
else
    echo "Unsupported OS version"
    exit 1
fi


uri="ftp://rpm.rutgers.edu/rpm-packages/$sparctype-sun-solaris$solaris/RPMS.stable/libstdc++-2.10.0-7.solaris$solaris-$sparctype.rpm ftp://rpm.rutgers.edu/rpm-packages/$sparctype-sun-solaris$solaris/RPMS.stable/apt-0.3.19cnc38-10ru.solaris$solaris-$sparctype.rpm"

#echo $uri

/usr/local/bin/rpm -Uvh $uri

echo "rpm ftp://rpm.rutgers.edu rpm-packages/$sparctype-sun-solaris$solaris ${APT_RELEASES:-stable}" > /usr/local/etc/apt/sources.list

#if [ $#APT_EXTRA_RELEASES != '' ]; then
#    sed "s/stable/stable $APT_EXTRA_RELEASES/" /usr/local/etc/apt/sources.list | \
#    tee > /usr/local/etc/apt/sources.list
#fi

/usr/local/bin/apt-get update
/usr/local/bin/apt-get -yu upgrade




