Commit 464e28ad0323bf2db7e1002e1f950610fc4a90d3

  • avatar
  • Sergey 'Jin' Bostandzhyan <jin @deve…per.digitalstrom.org>
  • Thu Sep 02 11:50:22 CEST 2010
Fixed and improved pkg_hooks

Also minor fix in runit script
targets/dss11/recipes/dss/dss.inc
(55 / 50)
  
55LICENSE="GPLv3"
66DEPENDS = "boost poco gsoap libical js libxml2 avahi"
77RDEPENDS_${PN} += "svlogd2 runit"
8INC_PR="18"
8INC_PR="19"
99ARM_INSTRUCTION_SET = "arm"
1010
1111# INITSCRIPT_NAME = "dss.sh"
9090 done
9191}
9292
93pkg_postinst_${PN}() {
94#!/bin/sh
95
96FOUND=0
97for line in `mount -t aufs`; do
98 if [[ "`echo $line | cut -f 3`" == "/usr/share/dss" ]]; then
99 FOUND=1
100 echo "Overlay on /usr/share/dss is already mounted, proceeding..."
101 break
102 fi
103done
104
105if [[ $FOUND -eq 0 ]]; then
106 echo -n "Mounting aufs overlay on /usr/share/dss..."
107 mount /usr/share/dss
108 if [[ $? -ne 0 ]]; then
109 echo
110 echo "Failed to mount aufs overlay on /usr/share/dss!"
111 echo "Manual interaction required, aborting package installation!"
112 exit 1
113 fi
114 echo " done."
115 break
116fi
117
118if [[ -f "/etc/runit/dss/supervise/stat" ]]; then
119 if [[ "`cat /etc/runit/dss/supervise/stat`" == "down" ]]; then
120 echo "Starting dSS..."
121 sv -w 15 up /etc/runit/dss
122 if [[ $? -ne 0 ]]; then
123 echo "sv command return error, could not start dSS!"
124 fi
125 fi
126fi
127
128}
129
93130pkg_prerm_${PN}() {
94#/bin/sh
131#!/bin/sh
95132
96if test -e "/etc/runit/dss/supervise/stat"; then
97 if test `cat /etc/runit/dss/supervise/stat` = "run"; then
133if [[ -f "/etc/runit/dss/supervise/stat" ]]; then
134 if [[ "`cat /etc/runit/dss/supervise/stat`" == "run" ]]; then
98135 echo "Stopping dSS..."
99136 sv -w 15 down /etc/runit/dss
100 if [ "$?" -ne "0" ]; then
137 if [[ $? -ne 0 ]]; then
101138 echo "sv command returned error, could not stop dSS!"
102139 exit 1
103140 fi
142142fi
143143
144144for line in `mount -t aufs`; do
145 if test `echo $line | cut -f 3` = "/usr/share/dss"; then
145 if [[ "`echo $line | cut -f 3`" == "/usr/share/dss" ]]; then
146146 echo -n "Unmounting aufs overlay on /usr/share/dss..."
147147 umount /usr/share/dss
148 if [ "$?" -ne "0" ]; then
148 if [[ $? -ne 0 ]]; then
149149 echo
150150 echo "Failed to unmount aufs overlay on /usr/share/dss!"
151151 echo "Manual interaction required, aborting package removal!"
152152 exit 1
153153 fi
154154 echo " done."
155 break
155156 fi
156157done
157158
158159}
159160
160161pkg_preinst_${PN}() {
161#/bin/sh
162#!/bin/sh
162163
163if test -e "/etc/runit/dss/supervise/stat"; then
164 if test `cat /etc/runit/dss/supervise/stat` = "run"; then
164if [[ -f "/etc/runit/dss/supervise/stat" ]]; then
165 if [[ "`cat /etc/runit/dss/supervise/stat`" == "run" ]]; then
165166 echo "Stopping dSS..."
166167 sv -w 15 down /etc/runit/dss
167 if [ "$?" -ne "0" ]; then
168 if [[ $? -ne 0 ]]; then
168169 echo "sv command returned error, could not stop dSS!"
169170 exit 1
170171 fi
171172 fi
172173fi
173174
175
174176for line in `mount -t aufs`; do
175 if test `echo $line | cut -f 3` = "/usr/share/dss"; then
177 if [[ "`echo $line | cut -f 3`" == "/usr/share/dss" ]]; then
176178 echo -n "Unmounting aufs overlay on /usr/share/dss..."
177179 umount /usr/share/dss
178 if [ "$?" -ne "0" ]; then
180 if [[ $? -ne 0 ]]; then
179181 echo
180182 echo "Failed to unmount aufs overlay on /usr/share/dss!"
181183 echo "Manual interaction required, aborting package removal!"
182184 exit 1
183185 fi
184186 echo " done."
185 fi
186done
187
188}
189
190pkg_postinst_${PN}() {
191#/bin/sh
192
193FOUND=0
194for line in `mount -t aufs`; do
195 if test `echo $line | cut -f 3` = "/usr/share/dss"; then
196 FOUND=1
197 echo "Overlay on /usr/share/dss is already mounted, proceeding..."
198187 break
199188 fi
200189done
201190
202if [ "$FOUND" -eq "0" ]; then
203 echo -n "Mounting aufs overlay on /usr/share/dss..."
204 mount /usr/share/dss
205 if [ "$?" -ne "0" ]; then
206 echo
207 echo "Failed to mount aufs overlay on /usr/share/dss!"
208 echo "Manual interaction required, aborting package installation!"
209 exit 1
210 fi
211 echo " done."
212fi
213
214if test -e "/etc/runit/dss/supervise/stat"; then
215 if test `cat /etc/runit/dss/supervise/stat` = "down"; then
216 echo "Starting dSS..."
217 sv -w 15 up /etc/runit/dss
218 if [ "$?" -ne "0" ]; then
219 echo "sv command return error, could not start dSS!"
220 fi
221 fi
222fi
223
224191}
225192
226193pkg_postrm_${PN}() {
227#/bin/sh
194#!/bin/sh
228195
229if test -d "/etc/runit/dss"; then
196if [[ -d "/etc/runit/dss" ]]; then
230197 rm -rf /etc/runit/dss
231198fi
199
232200}
233201
234202
targets/dss11/recipes/dss/files/dss.run
(1 / 1)
  
66
77mkdir -p $LOGDIR
88mkdir -p $TRAFFICDIR
9chown a+rx $LOGDIR $TRAFFICDIR
9chmod a+rx $LOGDIR $TRAFFICDIR
1010
1111APP=/usr/bin/dss
1212OPTIONS="--prop:/config/jslogdirectory=/var/log/dss \