#!/bin/sh

# Change to planet

# tradnet -> planet
change_planet () {
    if [ -r /tmp/SeTT_PX ]; then
	T_PX=`cat /tmp/SeTT_PX`
    elif [ -z "$T_PX" -a -n "$1" ]; then
	T_PX=$1
    else
	T_PX=/
    fi
    cd $T_PX

    sbin/planet -f
}

# Installer must call me with -f !!
if [ "$1" = "-f" ]; then
    change_planet
    exit
fi

if [ `ls -l /sbin/netconfig | sed 's/.*-> *//'` = "netconfig.tradnet" ]; then
    if [ ! -x /usr/bin/perl ]; then

cat <<EOF > /tmp/tmpmsg

However perl is required to use Planet, it is not installed.
Please install perl first.
 
EOF

	dialog --title "ERROR" --msgbox "`cat /tmp/tmpmsg`" 8 70
	rm -f /tmp/tmpmsg
	exit 1
    fi

cat <<EOF > /tmp/tmpmsg

Now you use the old 'tradnet' as a network enabler. Change it
into the new 'Planet' that is suitable for laptops ?

You have to reboot the system after changing, and you have to
redo the network configuration again for the first time of using
Planet.
 
EOF

    dialog --title "Change to Planet?" --yesno "`cat /tmp/tmpmsg`" 12 70
    if [ ! $? = 0 ]; then
	rm -f /tmp/tmpmsg
	exit
    fi
    rm -f /tmp/tmpmsg
    change_planet
fi

exec /sbin/enetconfig.planet -noforce
