correct infinity loop during checkudevrules
[debian6500.git] / master / etc / init.d / checkudevrules
CommitLineData
95f543f2
LM
1#!/bin/bash
2VER=1.0
3# ============================================================================
4#
5# Copyright (C) THALES. All rights reserved
6# Author: Laurent Mazet
7# Date : 15/12/2014
8# ============================================================================
9
10### BEGIN INIT INFO
11# Provides: checkudevrules
da288040 12# Required-Start: udev checkroot
95f543f2
LM
13# Required-Stop:
14# Should-Start:
15# Default-Start: S
16# Default-Stop:
17# Short-Description: Check udev rules
18# Description: Check udev rules files (70-persistent-*.rules) and reboot if necessary
19### END INIT INFO
20
21FILES="/etc/udev/rules.d/70-persistent-{cd,net}.rules"
22ENABLE="yes"
23ETHx=eth0
24
25PATH=/sbin:/usr/sbin:/bin:/usr/bin
26
27[ -f /etc/default/checkudevrules ] && . /etc/default/checkudevrules
28[ "$ENABLE" = "yes" ] || exit 0
29
30. /lib/lsb/init-functions
31
32do_check () {
33
34 log_action_msg "Check if $ETHx exists..."
35
36 if ip link show $ETHx >&/dev/null; then
37 log_action_msg "Continue booting"
38 else
39 log_action_msg "Erase udev rules and reboot"
da288040 40 eval rm -f $FILES
95f543f2
LM
41 reboot
42 fi
43}
44
45case "$1" in
46 -v)
47 echo "$(basename $0), version $VER"
48 ;;
49 start)
50 do_check
51 ;;
52 restart|reload|force-reload|stop)
53 echo "Error: argument '$1' not supported" >&2
54 exit 3
55 ;;
56 *)
57 echo "Usage: $0 start" >&2
58 exit 3
59 ;;
60esac
61
62# vim:set tabstop=4 expandtab shiftwidth=4: