updated on Tue Jan 10 00:10:07 UTC 2012
[aur-mirror.git] / zebra / zebra.install
blobb7ca9a8b32fc1b834bcbb734965abde888ea8302
1 # arg 1:the new package version
2 pre_install() {
4 #do pre-install stuff here
6 /bin/true
9 # arg 1:the new package version
10 post_install() {
11 cat > /etc/conf.d/zebra << "EOF"
12 ZEBRA_DAEMONS="zebra ospfd ripd bgpd" 
13 EOF
15 cat > /etc/rc.d/zebrad << "EOF"
16 #!/bin/bash
18 ZEBRA_DAEMONS=
19 [ -f /etc/conf.d/zebra ] && . /etc/conf.d/zebra
21 . /etc/rc.conf
22 . /etc/rc.d/functions
23 [ -f /usr/sbin/zebra ] || exit 0
24 [ -f /usr/sbin/ospfd ] || exit 0
25 [ -f /usr/sbin/ripd ] || exit 0
26 [ -f /usr/sbin/bgpd ] || exit 0
28 ZEBRAPID="/var/run/${daemon}.pid"
30 case "$1" in
31   start)
32     for daemon in $ZEBRA_DAEMONS; do
33         stat_busy "Starting Zebra ${daemon}: "
34         /usr/sbin/${daemon} -d &> /dev/null
35       if [ $? -gt 0 ]; then
36         stat_fail
37       else
38         echo
39         add_daemon ${daemon}
40         stat_done
41       fi
42     done
43     ;;
44   stop)
45     for daemon in $ZEBRA_DAEMONS; do
46         stat_busy "Stopping Zebra ${daemon}: "
47        PID="cat /var/run/$daemon.pid"
48        PID2=`$PID`
49        CMD=`kill $PID2 &> /dev/null`
50        CMD="/bin/rm /var/run/$daemon.pid"
51        CMD2=`$CMD &> /dev/null`
52         if [ -f /var/run/$daemon.pid ] ; then
53                 stat_fail
54         else
55                 stat_done
56       fi
57     done
58     ;;
59   restart)
60     $0 stop
61     sleep 1
62     $0 start
63     ;;
64   *)
65     echo "usage: $0 {start|stop|restart}"
66 esac
67 exit 0
68 EOF
69 chmod +x /etc/rc.d/zebrad
71 #do post-install stuff here
73 /bin/true
76 # arg 1:the new package version
77 # arg 2:the old package version
78 pre_upgrade() {
80 #do pre-upgrade stuff here
82 /bin/true
85 # arg 1:the new package version
86 # arg 2:the old package version
87 post_upgrade() {
89 #do post-upgrade stuff here
91 /bin/true
94 # arg 1:the old package version
95 pre_remove() {
97 #do pre-remove stuff here
99 /bin/true
102 # arg 1:the old package version
103 post_remove() {
104 rm /etc/rc.d/zebrad
105 rm /etc/conf.d/zebra
107 #do post-remove stuff here
109 /bin/true
112 op=$1
113 shift