#!/bin/bash

PROGRAM="/usr/sbin/wicd"
RUNLEVEL=3
NEEDS="+network"

PIDFILE="/var/run/wicd/wicd.pid"

. /etc/init.d/smgl_init

start() {
  if [ -e $PIDFILE ]; then
    echo "Wicd appears to already be running."
    echo "If this is not the case, then remove "
    echo "$PIDFILE and try again..."
    exit 1
  else
    echo "Starting wicd daemon..."
    $PROGRAM 2>/dev/null 1>&2
  fi
  evaluate_retval
}

stop() {
  echo "Stopping wicd daemon..."
  if [ -e $PIDFILE ]; then
    kill $(cat $PIDFILE) 2>/dev/null
    rm -f $PIDFILE 2>/dev/null
  fi
  evaluate_retval
}
