updated on Sun Jan 22 20:01:29 UTC 2012
[aur-mirror.git] / sysrqd-git / sysrqd.install
blobb2893a4a374778cca4deef788bdeed3bc24870b2
1 post_install() {
2 cat<<'EOF' > /etc/rc.d/sysrqd || return 1
3 #!/bin/bash                                        
5 #                                        
6 # writen by sputnick for archlinux/AUR  <gilles DOT quenot AT gmail DOT com>
7 # adapted from debian sysrqd init script - Julien Danjou <acid@debian.org>  
8 #                                                                           
10 . /etc/rc.conf
11 . /etc/rc.d/functions
13 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
14 DAEMON=/usr/sbin/sysrqd                                          
15 NAME=sysrqd                                                      
16 DESC="sysrq daemon"                                              
17 SECRET=/etc/sysrqd.secret                                        
18 PID=$(pgrep -f /usr/sbin/sysrqd)                                 
20 [[ -x $DAEMON && -f $SECRET ]] || exit 0
22 # Include sysrqd defaults if available
23 [[ -f /etc/conf.d/sysrqd ]] && . /etc/conf.d/sysrqd          
25 case "$1" in
26   start)    
27         stat_busy "Starting $DESC: "
28         [[ ! $PID ]] && $DAEMON -- $DAEMON_OPTS
30                 if(($? > 0 )); then
31                         stat_fail
32                 else
33                         add_daemon $NAME
34                         stat_done
35                 fi
36         ;;
37   stop)
38         stat_busy "Stopping $DESC: "
39                 [[ $PID ]] && kill $PID &> /dev/null
41                 if(( $? > 0 )); then
42                         stat_fail
43                 else
44                         rm_daemon $NAME
45                         stat_done
46                 fi
48         ;;
49   restart|force-reload)
50         stat_busy "Restarting $DESC: "
51                 $0 stop
52         sleep 1
53                 $0 start
54         ;;
55   *)
56         N=/etc/rc.d/$NAME
57         printf "Usage: $N {start|stop|restart|force-reload}\n" >&2
58         exit 1
59         ;;
60 esac
62 exit 0
63 EOF
64 chmod 0755 /etc/rc.d/sysrqd || return 1
66 cat<<EOF
67 - Add sysrqd to /etc/rc.conf to run sysrqd at bootup
69 - Create a password file:
70   echo "mypassword" > /etc/sysrqd.secret
71   chmod 0600 /etc/sysrqd.secret
73 - Optionnaly, create a bind file to bind to a specific IP
74   echo 192.168.2.13 > /etc/sysrqd.bind
76 EOF
77         
80 post_upgrade() {
81         /bin/true
84 pre_remove() {
85         /bin/rm -f /usr/sbin/sysrqd      /etc/rc.d/sysrqd
88 op=$1
89 shift
91 $op "$@"