updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / sysrqd / sysrqd.install
blob75b1595a9d7895d9ec8d7a651dba56309fe1220d
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
14 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
15 DAEMON=/usr/sbin/sysrqd                                          
16 NAME=sysrqd                                                      
17 DESC="sysrq daemon"                                              
18 SECRET=/etc/sysrqd.secret                                        
19 PID=$(pgrep -f /usr/sbin/sysrqd)                                 
21 [[ -x $DAEMON && -f $SECRET ]] || exit 0
23 # Include sysrqd defaults if available
24 [[ -f /etc/conf.d/sysrqd ]] && . /etc/conf.d/sysrqd          
26 case "$1" in
27   start)    
28         stat_busy "Starting $DESC: "
29         [[ ! $PID ]] && $DAEMON -- $DAEMON_OPTS
31                 if(($? > 0 )); then
32                         stat_fail
33                 else
34                         add_daemon $NAME
35                         stat_done
36                 fi
37         ;;
38   stop)
39         stat_busy "Stopping $DESC: "
40                 [[ $PID ]] && kill $PID &> /dev/null
42                 if(( $? > 0 )); then
43                         stat_fail
44                 else
45                         rm_daemon $NAME
46                         stat_done
47                 fi
49         ;;
50   restart|force-reload)
51         stat_busy "Restarting $DESC: "
52                 $0 stop
53         sleep 1
54                 $0 start
55         ;;
56   *)
57         N=/etc/rc.d/$NAME
58         printf "Usage: $N {start|stop|restart|force-reload}\n" >&2
59         exit 1
60         ;;
61 esac
63 exit 0
64 EOF
65 chmod 0755 /etc/rc.d/sysrqd || return 1
67 cat<<EOF
68 - Add sysrqd to /etc/rc.conf to run sysrqd at bootup
70 - Create a password file:
71   echo "mypassword" > /etc/sysrqd.secret
72   chmod 0600 /etc/sysrqd.secret
74 - Optionnaly, create a bind file to bind to a specific IP
75   echo 192.168.2.13 > /etc/sysrqd.bind
77 EOF
78         
81 post_upgrade() {
82         /bin/true
85 pre_remove() {
86         /bin/rm -f /usr/sbin/sysrqd      /etc/rc.d/sysrqd
89 op=$1
90 shift
92 $op "$@"