~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to parser/rc.aaeventd.suse

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge
  • Date: 2014-09-08 16:13:10 UTC
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20140908161310-zf42uss925jnp56t
Tags: upstream-2.8.96~2652
ImportĀ upstreamĀ versionĀ 2.8.96~2652

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
# ----------------------------------------------------------------------
3
 
#    Copyright (c) 1999, 2000, 2001, 2002, 2003 2004, 2005, 2006, 2007
4
 
#    NOVELL (All rights reserved)
5
 
#
6
 
#    This program is free software; you can redistribute it and/or
7
 
#    modify it under the terms of version 2 of the GNU General Public
8
 
#    License published by the Free Software Foundation.
9
 
#
10
 
#    This program is distributed in the hope that it will be useful,
11
 
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
#    GNU General Public License for more details.
14
 
#
15
 
#    You should have received a copy of the GNU General Public License
16
 
#    along with this program; if not, contact Novell, Inc.
17
 
# ----------------------------------------------------------------------
18
 
# rc.apparmor by Steve Beattie
19
 
#
20
 
# /etc/init.d/aaeventd
21
 
#   and its symbolic link
22
 
# /sbin/rcaaeventd
23
 
#
24
 
# chkconfig: 2345 01 99
25
 
# description: AppArmor Notification and Reporting daemon
26
 
#
27
 
### BEGIN INIT INFO
28
 
# Provides: aaeventd
29
 
# Required-Start: apparmor
30
 
# Required-Stop: $null
31
 
# Default-Start: 2 3 5
32
 
# Default-Stop:
33
 
# Short-Description: AppArmor Notification and Reporting
34
 
# Description: AppArmor Notification and Reporting daemon
35
 
### END INIT INFO
36
 
APPARMOR_FUNCTIONS=/lib/apparmor/rc.apparmor.functions
37
 
 
38
 
# source function library
39
 
if [ -f /etc/init.d/functions ]; then
40
 
        . /etc/init.d/functions
41
 
elif [ -f /etc/rc.d/init.d/functions ]; then
42
 
        . /etc/rc.d/init.d/functions
43
 
elif [ -f /lib/lsb/init-functions ]; then
44
 
        . /lib/lsb/init-functions
45
 
else
46
 
        exit 0
47
 
fi
48
 
 
49
 
# Ugh, SUSE doesn't implement action
50
 
sd_action() {
51
 
        STRING=$1
52
 
        shift
53
 
        "$@"
54
 
        rc=$?
55
 
        if [ $rc -eq 0 ] ; then
56
 
                log_success_msg $"$STRING "
57
 
        else
58
 
                log_failure_msg $"$STRING "
59
 
        fi
60
 
        return $rc
61
 
}
62
 
 
63
 
sd_log_success_msg() {
64
 
        log_success_msg $*
65
 
}
66
 
 
67
 
sd_log_warning_msg() {
68
 
        log_warning_msg $*
69
 
}
70
 
 
71
 
sd_log_failure_msg() {
72
 
        log_failure_msg $*
73
 
}
74
 
 
75
 
usage() {
76
 
    echo "Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}"
77
 
}
78
 
 
79
 
start_aa_event() {
80
 
        if [ -x "$AA_EV_BIN" -a "${APPARMOR_ENABLE_AAEVENTD}" = "yes" ] ; then
81
 
                sd_action "Starting AppArmor Event daemon" startproc -p $AA_EV_PIDFILE $AA_EV_BIN -p $AA_EV_PIDFILE
82
 
        elif [ -x "$SD_EV_BIN" -a "${APPARMOR_ENABLE_AAEVENTD}" = "yes" ] ; then
83
 
                sd_action "Starting AppArmor Event daemon" startproc -p $SD_EV_PIDFILE $SD_EV_BIN -p $SD_EV_PIDFILE
84
 
        fi
85
 
}
86
 
 
87
 
stop_aa_event() {
88
 
        if [ -x "$AA_EV_BIN" -a -f "$AA_EV_PIDFILE" ] ; then
89
 
                sd_action "Shutting down AppArmor Event daemon" killproc -G -p $AA_EV_PIDFILE -INT $AA_EV_BIN
90
 
        fi
91
 
        if [ -f "$SD_EV_PIDFILE" ] ; then
92
 
                sd_action "Shutting down AppArmor Event daemon" killproc -G -p $SD_EV_PIDFILE -INT $SD_EV_BIN
93
 
        fi
94
 
}
95
 
 
96
 
# source apparmor function library
97
 
if [ -f "${APPARMOR_FUNCTIONS}" ]; then
98
 
        . ${APPARMOR_FUNCTIONS}
99
 
else
100
 
        sd_log_failure_msg "Unable to find AppArmor initscript functions"
101
 
        exit 1
102
 
fi
103
 
 
104
 
case "$1" in
105
 
        start)
106
 
                start_aa_event
107
 
                rc=$?
108
 
                ;;
109
 
        stop)
110
 
                stop_aa_event
111
 
                rc=$?
112
 
                ;;
113
 
        restart|reload|force-reload|try-restart)
114
 
                stop_aa_event
115
 
                start_aa_event
116
 
                rc=$?
117
 
                ;;
118
 
        status)
119
 
                echo -n "Checking for service AppArmor Event daemon:"
120
 
                if [ "${APPARMOR_ENABLE_AAEVENTD}" = "yes" ]; then
121
 
                        /sbin/checkproc -p $AA_EV_PIDFILE $AA_EV_BIN
122
 
                        rc_status -v
123
 
                else
124
 
                        rc_status -u
125
 
                fi
126
 
                ;;
127
 
        *)
128
 
                usage
129
 
                exit 1
130
 
                ;;
131
 
esac
132
 
exit $rc
133