mirror of
https://github.com/gryf/wicd.git
synced 2025-12-22 22:27:59 +01:00
Merged with r263 of the mainline 1.6 branch, which (somehow) contains more changes than what I originally had in "r265".
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License Version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
WICD_BIN=$/opt/wicd/daemon.py
|
||||
CMD=$0
|
||||
ARG=$1
|
||||
|
||||
# general config
|
||||
. /etc/rc.conf
|
||||
. /etc/rc.d/functions
|
||||
# Sanity checks.
|
||||
[ -x $WICD_BIN ] || exit 0
|
||||
set -- $(ps ax | grep 'python.*$WICD_BIN')
|
||||
PID=$1
|
||||
case "$ARG" in
|
||||
start)
|
||||
stat_busy "Starting wicd"
|
||||
if [ -z "$PID" ]; then
|
||||
$WICD_BIN
|
||||
fi
|
||||
if [ ! -z "$PID" -o $? -gt 0 ]; then
|
||||
stat_fail
|
||||
else
|
||||
add_daemon wicd
|
||||
stat_done
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
stat_busy "Stopping wicd"
|
||||
[ ! -z "$PID" ] && kill $PID &> /dev/null
|
||||
if [ $? -gt 0 ]; then
|
||||
stat_fail
|
||||
else
|
||||
rm_daemon wicd
|
||||
stat_done
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
$CMD stop
|
||||
sleep 1
|
||||
$CMD start
|
||||
;;
|
||||
*)
|
||||
echo "usage: $CMD {start|stop|restart}"
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# wicd wicd daemon
|
||||
# Daemon for managing network connections.
|
||||
# This file should be placed in /etc/init.d.
|
||||
#
|
||||
# Authors: Dan O'Reilly <oreilldf@gmail.com>
|
||||
#
|
||||
# Version: @(#)skeleton 2.85-23 28-Jul-2004 miquels@cistron.nl
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DESC="Network connection manager daemon"
|
||||
NAME="wicd"
|
||||
PROCNAME=wicd-daemon
|
||||
DAEMON=/opt/wicd/daemon.py
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
USER=root
|
||||
|
||||
# Gracefully exit if the package has been removed.
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service.
|
||||
#
|
||||
d_start() {
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE \
|
||||
--user $USER --exec $DAEMON -- $DAEMON_OPTS
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service.
|
||||
#
|
||||
d_stop() {
|
||||
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
|
||||
--oknodo --user $USER --name $PROCNAME
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting $NAME:"
|
||||
d_start
|
||||
echo " Done."
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping $NAME:"
|
||||
d_stop
|
||||
echo " Done."
|
||||
;;
|
||||
restart|force-reload)
|
||||
echo -n "Restarting $NAME:"
|
||||
d_stop
|
||||
sleep 1
|
||||
d_start
|
||||
echo " Done."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
#
|
||||
# wicd: wicd daemon
|
||||
#
|
||||
# chkconfig: 345 98 02
|
||||
# description: This is a daemon for managing network connections.
|
||||
#
|
||||
# processname: wicd
|
||||
# pidfile: /var/run/wicd.pid
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: $network
|
||||
### END INIT INFO
|
||||
WICD_BIN=/opt/wicd/daemon.py
|
||||
NAME=wicd-daemon
|
||||
|
||||
# Sanity checks.
|
||||
[ -x $WICD_BIN ] || exit 0
|
||||
|
||||
# so we can rearrange this easily
|
||||
processname=$WICD_BIN
|
||||
pidfile=/var/run/wicd.pid
|
||||
processargs="-P ${pidfile}"
|
||||
|
||||
start()
|
||||
{
|
||||
if [ -e ${pidfile} ]; then
|
||||
rm -f ${pidfile}
|
||||
fi
|
||||
ebegin "Starting wicd"
|
||||
start-stop-daemon --start --quiet --exec ${processname} -- ${processargs}
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
ebegin "Stopping wicd"
|
||||
start-stop-daemon --stop --quiet --name ${NAME} --pidfile ${pidfile}
|
||||
eend $?
|
||||
if [ -e ${pidfile} ]; then
|
||||
rm -f $pidfile
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# wicd: wicd daemon
|
||||
#
|
||||
# chkconfig: 345 20 89
|
||||
# description: This is a daemon for managing network connections.
|
||||
#
|
||||
# processname: wicd
|
||||
# pidfile: /var/run/wicd/wicd.pid
|
||||
#
|
||||
|
||||
WICD_BIN=/opt/wicd/daemon.py
|
||||
|
||||
# Sanity checks.
|
||||
[ -x $WICD_BIN ] || exit 11
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# so we can rearrange this easily
|
||||
processname=$WICD_BIN
|
||||
servicename=wicd
|
||||
pidfile=/var/run/wicd/wicd.pid
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start()
|
||||
{
|
||||
echo -n $"Starting wicd daemon: "
|
||||
daemon --check $servicename $processname --pid-file=$pidfile
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
echo -n $"Stopping wicd daemon: "
|
||||
killproc -p $pidfile $servicename
|
||||
RETVAL=$?
|
||||
echo
|
||||
if [ $RETVAL -eq 0 ]; then
|
||||
rm -f /var/lock/subsys/$servicename
|
||||
rm -f $pidfile
|
||||
fi
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status -p $pidfile $processname
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
condrestart)
|
||||
if [ -f /var/lock/subsys/$servicename ]; then
|
||||
stop
|
||||
start
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
|
||||
;;
|
||||
esac
|
||||
exit $RETVAL
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# wicd: wicd daemon
|
||||
#
|
||||
# description: This is a daemon managing network connections.
|
||||
#
|
||||
# processname: wicd-daemon
|
||||
# pidfile: /var/run/wicd.pid
|
||||
#
|
||||
WICD_BIN=/opt/wicd/daemon.py
|
||||
|
||||
# Sanity checks.
|
||||
[ -x $WICD_BIN ] || exit 0
|
||||
|
||||
PIDFILE=/var/run/wicd.pid
|
||||
$WICD_EXEC="$WICD_BIN -P $PIDFILE"
|
||||
|
||||
|
||||
wicd_start()
|
||||
{
|
||||
if [ "`pgrep dbus-daemon`" = "" ]; then
|
||||
echo "D-BUS must be running to start wicd"
|
||||
return
|
||||
fi
|
||||
|
||||
# Just in case the pidfile is still there, we may need to nuke it.
|
||||
if [ -e "$PIDFILE" ]; then
|
||||
rm -f $PIDFILE
|
||||
fi
|
||||
|
||||
echo "Starting wicd daemon: $WICD_BIN"
|
||||
$WICD_EXEC
|
||||
}
|
||||
|
||||
wicd_status()
|
||||
{
|
||||
local pidlist=`cat $PIDFILE 2>/dev/null`
|
||||
if [ -z "$pidlist" ]; then
|
||||
return 1
|
||||
fi
|
||||
local command=`ps -p $pidlist -o comm=`
|
||||
if [ "$command" != 'wicd-daemon' ]; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
wicd_stop()
|
||||
{
|
||||
echo -en "Stopping wicd: "
|
||||
local pidlist=`cat $PIDFILE 2>/dev/null`
|
||||
if [ ! -z "$pidlist" ]; then
|
||||
kill $pidlist &>/dev/null
|
||||
rm -f $PIDFILE &>/dev/null
|
||||
fi
|
||||
echo "stopped";
|
||||
}
|
||||
|
||||
wicd_restart()
|
||||
{
|
||||
wicd_stop
|
||||
wicd_start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'start')
|
||||
if ( ! wicd_status ); then
|
||||
wicd_start
|
||||
else
|
||||
echo "wicd is already running (will not start it twice)."
|
||||
fi
|
||||
;;
|
||||
'stop')
|
||||
wicd_stop
|
||||
;;
|
||||
'restart')
|
||||
wicd_restart
|
||||
;;
|
||||
'status')
|
||||
if ( wicd_status ); then
|
||||
echo "wicd is currently running"
|
||||
else
|
||||
echo "wicd is not running."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "usage $0 start|stop|status|restart"
|
||||
esac
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: wicd-daemon
|
||||
# Required-Start: dbus
|
||||
# Default-Start: 3 4 5
|
||||
# Default-Stop:
|
||||
# Description: wicd, a wired and wireless connection manager.
|
||||
### END INIT INFO
|
||||
|
||||
WICD_BIN=/opt/wicd/daemon.py
|
||||
test -x $WICD_BIN || exit 5
|
||||
|
||||
. /etc/rc.status
|
||||
rc_reset
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
checkproc $WICD_BIN
|
||||
if [ $? = 0 ]; then
|
||||
echo -n "wicd already running"
|
||||
rc_status -v
|
||||
rc_exit
|
||||
fi
|
||||
echo -n "Starting wicd"
|
||||
startproc $WICD_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down wicd"
|
||||
killproc -TERM $WICD_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
rc_status
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for wicd: "
|
||||
checkproc $WICD_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -115,7 +115,7 @@ class WicdDaemon(dbus.service.Object):
|
||||
if not auto_connect:
|
||||
print "--no-autoconnect detected, not autoconnecting..."
|
||||
self.SetForcedDisconnect(True)
|
||||
self.wireless_bus.Scan()
|
||||
self.wireless_bus.Scan()
|
||||
|
||||
def get_debug_mode(self):
|
||||
return self._debug_mode
|
||||
|
||||
Reference in New Issue
Block a user