#!/bin/sh

##############################################################################
#
# Make sure this script is being run by the superuser.
#
if [ "${LOGNAME}" != "root" ]; then
    echo
    echo "You MUST run this script as superuser!"
    echo
    echo "If you logged in as a normal user then su'ed to become"
    echo "superuser, you also need to add a hyphen '-' to the"
    echo "su command".
    echo
    exit 1
fi


if [ ! -f /etc/ltsp.conf ]; then
    echo
    echo "Couldn't find /etc/ltsp.conf, probably indicates that"
    echo "lts_core hasn't been installed yet"
    echo
    exit 1
fi

. /etc/ltsp.conf

if [ ! -d ${LTSP_DIR} ]; then
    echo
    echo "Could not find ${LTSP_DIR}"
    echo "Has it moved, without updating /etc/ltsp.conf ?"
    echo
    exit 1
fi

rm ${LTSP_DIR}/i386/bin/iojob
rm ${LTSP_DIR}/i386/bin/nomig
rm ${LTSP_DIR}/i386/bin/runon
rm ${LTSP_DIR}/i386/bin/runhome
rm ${LTSP_DIR}/i386/bin/cpujob
rm ${LTSP_DIR}/i386/bin/fastdecay
rm ${LTSP_DIR}/i386/bin/mosrun
rm ${LTSP_DIR}/i386/bin/nodecay
rm ${LTSP_DIR}/i386/bin/slowdecay
rm ${LTSP_DIR}/i386/etc/mosix
rm ${LTSP_DIR}/i386/lib/libmos.so
rm ${LTSP_DIR}/i386/lib/libmos.so.0
rm ${LTSP_DIR}/i386/lib/libmos.a
rm ${LTSP_DIR}/i386/usr/bin/mon
rm ${LTSP_DIR}/i386/usr/bin/migrate
rm ${LTSP_DIR}/i386/usr/bin/mosctl
rm ${LTSP_DIR}/i386/sbin/tune
rm ${LTSP_DIR}/i386/sbin/mtune
rm ${LTSP_DIR}/i386/sbin/setpe
rm ${LTSP_DIR}/i386/sbin/prep_tune
rm ${LTSP_DIR}/i386/sbin/tunepass
rm ${LTSP_DIR}/i386/sbin/tune_kernel

echo
echo "All Done ... ltsp_mosix_user should now be removed"
echo
