File: eu_init

package info (click to toggle)
eagle-usb 2.1.1-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,108 kB
  • ctags: 2,612
  • sloc: ansic: 27,560; sh: 5,440; perl: 3,269; xml: 1,079; tcl: 915; makefile: 878
file content (180 lines) | stat: -rwxr-xr-x 4,427 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/bash
# $Id: eu_init,v 1.15 2005/01/16 22:04:34 Tux Exp $

# Copyright (C) 2003-2005 Olivier Borowski
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

# Goal :
#	Startup script for eagle-usb ADSL modems.
# Params :
#	$1 = start/stop/status/restart/force-reload/reload/{none}
# Params set by setvars :
#	$DISTRIB

#================== Mandrake, RedHat... ==================
# chkconfig: 235 99 01
# description: Launch ADSL connexion
#========================= SuSE ==========================
### BEGIN INIT INFO
# Provides:       eagle-usb
# Required-Start: syslog
# Required-Stop:
# Default-Start:  2 3 5
# Default-Stop:
# Description:   Launch ADSL connexion
### END INIT INFO
#=========================================================

# the following line will be replaced by the absolute path of setvars
exit 123
PARAM="$1"
PATH_SAV="$PATH"

if [ "$DISTRIB" = "Slackware" ] ; then
	echo_failure() { return 1 ; }
	echo_success() { return 0 ; }
	CMDECHO="echo -en"
	# assume "no param" = "start"
	test -z "$PARAM" && PARAM="start"
elif [ -f /etc/rc.d/init.d/functions ] ; then
	# Source function library.
	. /etc/rc.d/init.d/functions
	CMDECHO="echo -en"
elif [ -e /etc/rc.status ] ; then
	. /etc/rc.status
	echo_failure() {
		rc_failed 1
		rc_status -v
		return 1
	}
	echo_success() {
		rc_status -v
		return 0
	}
	CMDECHO="echo -en"
else
	echo_failure() {
		echo "[FAILED]"
		return 1
	}
	echo_success() {
		echo "[  OK  ]"
		return 0
	}
	CMDECHO="doInUtf8 echo -e"
fi
PATH="$PATH_SAV"

# See how we were called.
case "$PARAM" in
	start)
		$CMDECHO $START_SERVICE_MSG
		mkdir -p `dirname $SYSCONF_FILE`
		touch $SYSCONF_FILE
		if [ $ASYNCHRONOUS_START -eq 0 ] ; then
			if fctStartAdsl ; then
				echo_success
			else
				echo_failure
			fi
		else
			fctStartAdsl &
			echo_success
			#if fctStartAdsl ; then
			#	echo_success
			#else
			#	echo_failure
			#fi &
		fi
		echo
		#$CMDECHO
		;;
	stop)
		$CMDECHO $STOP_SERVICE_MSG
		rm -f $SYSCONF_FILE
		fctStopAdsl
		echo_success
		echo
		#$CMDECHO
		;;
	status)
		eaglediag
		#if [ "$DISTRIB" = "Fedora" ] && [ "$PPPOX" != "none" ] ; then
		#	status pppd
		#fi
		;;
	restart|force-reload)
		$0 stop
		sleep 1
		$0 start
		;;
	reload)
		$CMDECHO $RELOAD_SERVICE_MSG
		$0 start
		echo
		#$CMDECHO
		;;
	*)
		$CMDECHO $USAGE_SERVICE_MSG
		exit 1
esac

exit 0

#***************************************************************************
# $Log: eu_init,v $
# Revision 1.15  2005/01/16 22:04:34  Tux
# - add license header
#
# Revision 1.14  2005/01/04 21:14:05  Tux
# - switch strings to utf-8
#
# Revision 1.13  2004/11/21 15:29:41  Tux
# - replaced == with -eq
#
# Revision 1.12  2004/09/28 19:43:46  Tux
# - prevent PATH from being modified by "/etc/rc.d/init.d/functions" on Aurox
#
# Revision 1.11  2004/09/23 20:37:59  Tux
# - add support for slackware (we do not use rc.eagle-usb anymore)
#
# Revision 1.10  2004/09/16 20:48:24  Tux
# - removed useless $SYSCONF_DIR variable
#
# Revision 1.9  2004/09/15 19:25:03  Tux
# - make sure that parent folders of the lock file exist
#
# Revision 1.8  2004/09/14 20:59:16  Tux
# *** empty log message ***
#
# Revision 1.7  2004/09/14 20:42:25  Tux
# - useless to create lock file's parents folders (should be done before)
# - echo_success/echo_failure sould not be called asynchronously
#
# Revision 1.6  2004/07/16 21:52:51  Tux
# - use $SYSCONF_FILE
# - asynchronous start should display [OK] / [Error] too
#
# Revision 1.5  2004/05/30 01:55:21  Tux
# - "splash_late" service does not exist on SuSE9.1, using "syslog" instead
#
# Revision 1.4  2004/05/23 19:59:10  Tux
# - "force-reload" now acts as "restart"
#
# Revision 1.3  2004/04/21 20:02:27  Tux
# *** empty log message ***
#
#***************************************************************************/