#!/bin/sh
#
# download.sh, 1.6     01/07/28
# Download script to kill incompatible daemons and
# start the appropriate download utility.
#
DOWNLOAD="${0}32"
if [ -f /usr/bin/isainfo ]; then
    isainfo -kv | grep "64-bit" >/dev/null
    if [ $? -eq 0 ]; then
      DOWNLOAD="${0}64"
    fi
fi

#
# Stop RM6/7 daemons
#
if [ -f /etc/init.d/amdemon ]; then
    /etc/init.d/amdemon stop
fi
if [ -f /etc/init.d/SM7monitor ]; then
    /etc/init.d/SM7monitor stop
fi


# Start download utility
$DOWNLOAD $*


#
# Start RM6/7 daemons
#
if [ -f /etc/init.d/amdemon ]; then
    /etc/init.d/amdemon start
fi
if [ -f /etc/init.d/SM7monitor ]; then
    /etc/init.d/SM7monitor start
fi
