]> TLD Linux GIT Repositories - rc-scripts.git/blob - lib/ifdown-sl
- disable lock checks (happens on LUKS2 and fails during system boot)
[rc-scripts.git] / lib / ifdown-sl
1 #!/bin/sh
2 #
3 #
4 PATH=/sbin:/usr/sbin:/bin:/usr/bin
5
6 . /etc/sysconfig/network
7 . /etc/rc.d/init.d/functions
8 . /lib/rc-scripts/functions.network
9
10 CONFIG=$1
11 source_config
12
13 # set all major variables
14 setup_ip_param
15
16 # signals ifup-sl not to persist
17 rm -f /var/run/sl-$DEVICE.dev
18
19 # we can use dip or direct slip connection via slattach
20 if is_no "$DIRECT_CONNECT"; then
21         PID=$(pidof dip-$DEVICE)
22 else
23         PID=$(pidof slattach)
24         for x in $PID; do
25                 if grep -q "$MODEMPORT" /proc/$x/cmdline; then
26                         logger -p daemon.info -t ifdown-sl \
27                                 "signal TERM send to \"$(ps -o cmd= $x)\" - this should be slattach"
28                         kill -TERM $x
29                         PID=$x
30                 fi
31         done
32 fi
33 #
34 # The proctitle for connected dip daemons is actually "-dip (ipaddr)"
35 #       with ipaddr = local on dial-out,  remote on dial-in
36 # Grab the PID of connected dial-out daemon.
37 #
38 if [ -z "$PID" ]; then
39         PID=$(pidof -- -dip\ \($IPADDR\))
40 fi
41 if [ -z "$PID" ]; then
42         exit 1
43 fi
44
45 kill $PID > /dev/null 2>&1
46 if [ ! -d /proc/$PID ]; then
47         /lib/rc-scripts/ifdown-post $1
48         exit 0
49 fi
50 sleep 2
51 if [ ! -d /proc/$PID ]; then
52         /lib/rc-scripts/ifdown-post $1
53         exit 0
54 fi
55
56 kill -KILL $PID > /dev/null 2>&1
57 if [ -d /proc/$PID ]; then
58         logger -p daemon.info -t ifdown-sl "ifdown-sl unable to kill sl-$DEVICE" &
59 else
60         /lib/rc-scripts/ifdown-post $1
61 fi
62
63 exit 1