aboutsummaryrefslogtreecommitdiff
path: root/meta-yerba/recipes-core/runit/runit_2.3.1.bb
blob: 66ed6ba5809b92462540139fb953e520322df742 (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
SUMMARY = "runit - a UNIX init scheme with service supervision"
DESCRIPTION = "runit is a cross-platform Unix init scheme with service supervision"
HOMEPAGE = "https://smarden.org/runit/"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://package/COPYING;md5=a97395d42a16fff3c0a1cf4b48757696"

SRC_URI = "git://github.com/g-pape/runit;protocol=https;branch=next"
SRCREV = "0e52a89654d375a8d634c5d9d18ab29fdb666976"
S = "${WORKDIR}/git"

do_compile() {
    cd ${S}
    export CC="${CC}"
    export CFLAGS="${CFLAGS} -D_GNU_SOURCE -static"
    export LDFLAGS="${LDFLAGS} -static -Wl,z -Wl,noexecstack"
    echo "${CC} ${CFLAGS}" > src/conf-cc
    echo "${CC} ${LDFLAGS}" > src/conf-ld
    ./package/compile
}

do_install() {
    install -d ${D}/sbin ${D}/usr/bin ${D}/usr/sbin ${D}/etc/runit ${D}/etc/service
    
    if [ -d ${S}/command ]; then
        install -m 0755 ${S}/command/runit-init ${D}/sbin/
        install -m 0755 ${S}/command/runit ${D}/sbin/
        install -m 0755 ${S}/command/runsvdir ${D}/usr/sbin/
        install -m 0755 ${S}/command/runsv ${D}/usr/sbin/
        install -m 0755 ${S}/command/sv ${D}/usr/bin/
        install -m 0755 ${S}/command/svlogd ${D}/usr/sbin/
        install -m 0755 ${S}/command/chpst ${D}/usr/bin/
        install -m 0755 ${S}/command/runsvchdir ${D}/usr/sbin/
        ln -sf sbin/runit-init ${D}/sbin/init
    fi
    
    cat > ${D}/etc/runit/1 << 'EOF'
#!/bin/sh
echo "Starting runit stage 1"
EOF
    cat > ${D}/etc/runit/2 << 'EOF'
#!/bin/sh
echo "Starting runit stage 2"
exec runsvdir -P /etc/service
EOF
    cat > ${D}/etc/runit/3 << 'EOF'
#!/bin/sh
echo "Shutting down runit stage 3"
EOF
    chmod 0755 ${D}/etc/runit/* 2>/dev/null || true
}

FILES:${PN} = "/sbin/runit-init /usr/sbin/runsvdir /usr/bin/sv /usr/sbin/svlogd /etc/runit /etc/service /sbin/runit /sbin/init /usr/sbin/runsv /usr/sbin/runsvchdir /usr/bin/chpst"
RDEPENDS:${PN} += "busybox"

PROVIDES += "runit-init"

# Prevents yocto from shitting itself and telling me "oh its a fatal QA issue the binaries are stripped" LET ME LIVE
INSANE_SKIP:${PN} += "already-stripped debug-files"