summaryrefslogtreecommitdiffstats
path: root/encap/src/encap-profiles/runit-1.7.2.ep
blob: d2765f657a7c9afb05fd552255017b1d94c6dd08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?xml version="1.0"?>

<!-- $Id$ -->

<encap_profile
	profile_ver="1.0"
	pkgspec="runit-1.7.2"
>

<prereq package="m4-1.4.4" />
<prereq package="patch-2.5.9" />

<environment
        variable="CC"
        value="gcc -static-libgcc"
        type="set"
/>

<environment
        variable="PATH"
PLATFORM_IF_MATCH(solaris)
        value="/usr/local/lib/bcfg2/bin:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin:"
PLATFORM_ELSE
        value="/usr/local/lib/bcfg2/bin:/usr/local/bin:"
PLATFORM_ENDIF
        type="prepend"
/>

PLATFORM_IF_MATCH(linux)
PLATFORM_ELSE
<environment
        variable="MAKE"
        value="gmake"
        type="set"
/>
PLATFORM_ENDIF

<source
url="http://encapsrcdist/mirror/runit/runit-1.7.2.tar.gz
     http://mirror.opensysadmin.com/runit/runit-1.7.2.tar.gz
     http://smarden.org/runit/runit-1.7.2.tar.gz"
use_objdir="no"
subdir="admin/runit-1.7.2"
>

<configure type="unset" />

<build>
./package/compile
./package/check
</build>

<install>
test -d ${ENCAP_SOURCE} || mkdir ${ENCAP_SOURCE}
test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME} || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}
test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/bin || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/bin
test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share
test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc
test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit
test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man
test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man/man8 || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man/man8
cp command/* ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/bin
cp -r doc/* ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit
cp -r etc ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit
cp -r package ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit
cp man/* ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man/man8
</install>

<clean type="unset" />

</source>

<prepackage>
# Make "this encap is installed" sentinal file available in /usr/local/var/encap
test -d var || mkdir var
test -d var/encap || mkdir var/encap
touch var/encap/${ENCAP_PKGNAME}
</prepackage>

<include_file name="bin/runsvdir-usrlocal-start" mode="0755"><![CDATA[
#!/bin/sh
PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
exec env - PATH=$PATH \
runsvdir -P /usr/local/var/service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'
]]></include_file>

<include_file name="inittab.boot" mode="0644"><![CDATA[

SV:123456:respawn:/usr/local/bin/runsvdir-usrlocal-start
]]></include_file>

<include_file name="upstart.boot" mode="0644"><![CDATA[
# /etc/event.d/SV 0644
#
# for runit - manage /usr/local/bin/runsvdir-usrlocal-start
#
start on runlevel-2
start on runlevel-3
start on runlevel-4
start on runlevel-5
stop on shutdown
respawn /usr/local/bin/runsvdir-usrlocal-start
]]></include_file>

<include_file name="inittab-install" mode="0755"><![CDATA[
#!/bin/sh -e
if grep SV: /etc/inittab >/dev/null
then
  echo 'inittab contains an SV: line. I assume that runsvdir is already running.
'
else
  echo 'Adding runsvdir to inittab...'
  rm -f /etc/inittab'{new}'
  cat /etc/inittab inittab.boot > /etc/inittab'{new}'
  mv -f /etc/inittab'{new}' /etc/inittab
  kill -HUP 1
  echo 'init should start runsvdir now.
'
fi
]]></include_file>

<include_file name="inittab-remove" mode="0755"><![CDATA[
#!/bin/sh -e
if grep SV: /etc/inittab >/dev/null
then
  echo 'Backing up inittab to .inittab.backup...'
  rm -f /etc/.inittab.backup
  cp -f /etc/inittab /etc/.inittab.backup
  echo 'Removing svscan lines from inittab...'
  rm -f /etc/inittab'{new}'
  grep -v SV: /etc/inittab > /etc/inittab'{new}'
  mv -f /etc/inittab'{new}' /etc/inittab
  kill -HUP 1
  echo 'init should stop runsvdir now.
'
else
  echo 'inittab does not contain a runsvdir line.
'
fi
]]></include_file>

<include_file name="postinstall" mode="0755"><![CDATA[
#!/bin/sh -e
umask 002
BASEDIR="`echo ${0} | xargs -n1 dirname`"
LOG=${BASEDIR}/postinstall.log
exec > $LOG 2>&1
printf "Running runit postinstall script...\n"
date
test -d /usr/local/var || mkdir /usr/local/var
test -d /usr/local/var/svlogd || mkdir /usr/local/var/svlog
test -d /usr/local/var/service || mkdir /usr/local/var/service
test -d /usr/local/etc || mkdir /usr/local/etc
test -d /usr/local/etc/default || mkdir /usr/local/etc/default
test -d /usr/local/etc/sv || mkdir /usr/local/etc/sv
if [ -f /etc/inittab ]; then
    printf "Installing to /etc/inittab ...\n"
    cd ${ENCAP_SOURCE}/${ENCAP_PKGNAME} && ./inittab-install
fi 
if [ -d /etc/event.d ]; then
    printf "Installing to /etc/event.d/SV (Upstart) ...\n"
    cd ${ENCAP_SOURCE}/${ENCAP_PKGNAME} && cp upstart.boot /etc/event.d/SV
fi
printf "Finished runit postinstall script.\n"
]]></include_file>

<include_file name="preremove" mode="0755"><![CDATA[
#!/bin/sh
printf "Running runit preremove script...\n"
date
if [ -f /etc/inittab ]; then
    printf "Removing from /etc/inittab ...\n"
    cd ${ENCAP_SOURCE}/${ENCAP_PKGNAME} && ./inittab-remove
fi
if [ -d /etc/event.d ]; then
    if [ -f /etc/event.d/SV ]; then
        printf "Removing /etc/event.d/SV (Upstart) ...\n"
        rm /etc/event.d/SV
    fi
fi
printf "Finished runit preremove script.\n"
]]></include_file>

<encapinfo>
description runit - a UNIX init scheme with service supervision
</encapinfo>

</encap_profile>