Advertisement
Guest User

Untitled

a guest
May 28th, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #!/sbin/runscript
  2. # Copyright 1999-2012 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. # $Header: /var/cvsroot/gentoo-x86/app-laptop/laptop-mode-tools/files/laptop_mode.init-1.4,v 1.4 2012/01/01 14:44:49 hwoarang Exp $
  5.  
  6. extra_started_commands="reload"
  7.  
  8. depend() {
  9. need localmount
  10. use acpid hald
  11. after bootmisc
  12. }
  13.  
  14. checkconfig() {
  15. if [ ! -f /proc/sys/vm/laptop_mode ] ; then
  16. eerror "Kernel does not support laptop_mode"
  17. return 1
  18. fi
  19. }
  20.  
  21. start() {
  22. checkconfig || return 1
  23.  
  24. ebegin "Starting laptop_mode"
  25. # bug #342049 fix
  26. # check if dir exists and creates if it doesn't
  27. checkpath -q -d -m 755 /var/run/laptop-mode-tools
  28. touch /var/run/laptop-mode-tools/enabled
  29. /usr/sbin/laptop_mode auto >/dev/null
  30. eend $?
  31. }
  32.  
  33. stop() {
  34. ebegin "Stopping laptop_mode"
  35. rm -f /var/run/laptop-mode-tools/enabled
  36. /usr/sbin/laptop_mode stop >/dev/null
  37. eend $?
  38. }
  39.  
  40. reload() {
  41. if ! service_started "${SVCNAME}" ; then
  42. eerror "${SVCNAME} has not yet been started"
  43. return 1
  44. fi
  45.  
  46. ebegin "Reloading laptop_mode"
  47. /usr/sbin/laptop_mode stop >/dev/null
  48. rm -f /var/run/laptop-mode-tools/*
  49. /usr/sbin/laptop_mode auto force >/dev/null
  50. eend $?
  51. }
  52.  
  53. # vim: set ts=4 :
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement