home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / etc / init.d / apparmor < prev    next >
Encoding:
Text File  |  2009-04-08  |  2.7 KB  |  132 lines

  1. #!/bin/sh
  2. #
  3. #    $Id: rc.apparmor.debian 703 2007-05-28 04:42:26Z steve-beattie $
  4. #
  5. # ----------------------------------------------------------------------
  6. #    Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
  7. #    NOVELL (All rights reserved)
  8. #
  9. #    This program is free software; you can redistribute it and/or
  10. #    modify it under the terms of version 2 of the GNU General Public
  11. #    License published by the Free Software Foundation.
  12. #
  13. #    This program is distributed in the hope that it will be useful,
  14. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. #    GNU General Public License for more details.
  17. #
  18. #    You should have received a copy of the GNU General Public License
  19. #    along with this program; if not, contact Novell, Inc.
  20. # ----------------------------------------------------------------------
  21. # rc.apparmor by Steve Beattie
  22. #
  23. # /etc/init.d/apparmor
  24. #
  25. # chkconfig: 2345 01 99
  26. # description: AppArmor rc file. This rc script inserts the apparmor \
  27. #            module and runs the parser on the /etc/apparmor.d/ \
  28. #           directory.
  29. #
  30. ### BEGIN INIT INFO
  31. # Provides: apparmor
  32. # Required-Start:
  33. # Required-Stop:
  34. # Default-Start: 3 4 5
  35. # Default-Stop: 0 1 2 6
  36. # Short-Description: AppArmor initialization
  37. # Description: AppArmor rc file. This rc script inserts the apparmor
  38. #    module and runs the parser on the /etc/apparmor.d/
  39. #    directory.
  40. ### END INIT INFO
  41. APPARMOR_FUNCTIONS=/etc/apparmor/rc.apparmor.functions
  42.  
  43. . /lib/lsb/init-functions
  44.  
  45. aa_action() {
  46.     STRING="$1"
  47.     log_action_begin_msg "$STRING"
  48.     shift
  49.     $*
  50.     rc=$?
  51.     log_action_end_msg $rc
  52.     return $rc
  53. }
  54.  
  55. aa_log_action_begin() {
  56.     log_action_begin_msg "$@"
  57. }
  58.  
  59. aa_log_action_end() {
  60.     log_action_end_msg "$@"
  61. }
  62.  
  63. aa_log_success_msg() {
  64.     log_success_msg "$@"
  65. }
  66.  
  67. aa_log_warning_msg() {
  68.     log_action_msg "Warning: $@"
  69. }
  70.  
  71. aa_log_failure_msg() {
  72.     log_action_msg "Failure: $@"
  73. }
  74.  
  75. aa_log_skipped_msg() {
  76.     log_action_msg "Skipped: $@"
  77. }
  78.  
  79. aa_log_daemon_msg() {
  80.     log_daemon_msg "$@"
  81. }
  82.  
  83. aa_log_end_msg() {
  84.     log_end_msg "$@"
  85. }
  86.  
  87. usage() {
  88.     echo "Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status|kill}"
  89. }
  90.  
  91. # source apparmor function library
  92. if [ -f "${APPARMOR_FUNCTIONS}" ]; then
  93.     . ${APPARMOR_FUNCTIONS}
  94. else
  95.     aa_log_failure_msg "Unable to find AppArmor initscript functions"
  96.     exit 1
  97. fi
  98.  
  99. test -x ${PARSER} || exit 0 # by debian policy
  100.  
  101. case "$1" in
  102.     start)
  103.         apparmor_start
  104.         rc=$?
  105.         ;;
  106.     stop)
  107.         apparmor_stop
  108.         rc=$?
  109.         ;;
  110.     restart|reload|force-reload)
  111.         apparmor_restart
  112.         rc=$?
  113.         ;;
  114.     try-restart)
  115.         apparmor_try_restart
  116.         rc=$?
  117.         ;;
  118.     kill)
  119.         apparmor_kill
  120.         rc=$?
  121.         ;;
  122.     status)
  123.         apparmor_status
  124.         rc=$?
  125.         ;;
  126.     *)
  127.         usage
  128.         exit 1
  129.         ;;
  130.     esac
  131. exit $rc
  132.