summaryrefslogtreecommitdiff
path: root/packages/sys-apps/openrc/openrc-0.34.11-r4.exheres-0
blob: 50af6321595308f052b71c3bcf456c27d8fda5d8 (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
# Copyright 2018 Redcore Linux Project
# Distributed under the terms of the GNU General Public License v2

require bash-completion zsh-completion
require github

SUMMARY="A dependency-based init system that works with the system-provided init program"
SLOT="0"
LICENCES="BSD-2"

MYOPTIONS="
    ( providers:
        runit
        sinit
        sysvinit
    ) [[
        *description = [ provider for the init daemon ]
        number-selected = at-most-one
    ]]
    dhcp [[ description = [
             Enable external networking tools
        ] ]]
    dkms [[ description = [
            Enable DKMS (dynamic kernel module support) integration
        ] ]]
    ncurses
    newnet [[ description = [
            Enable the new network stack (experimental)
        ] ]]
    pam
    plymouth [[ description = [
            Enable plymouth plugin for OpenRC
        ] ]]
"

PLATFORMS="~amd64 ~x86"

DEPENDENCIES="
    build+run:
        dkms? ( sys-kernel/dkms )
        ncurses? ( sys-libs/ncurses )
        pam? ( sys-libs/pam )
    run:
        providers:runit? ( sys-apps/runit )
        providers:sinit? ( sys-apps/sinit )
        providers:sysvinit? ( sys-apps/sysvinit )
        plymouth? ( sys-boot/plymouth-openrc-plugin )
        dhcp? (
            sys-apps/net-tools
            net-misc/dhcpcd
        )
"

REMOTE_IDS="github:OpenRC/${PN}"

DEFAULT_SRC_PREPARE_PATCHES=(
    # Redcore Linux : enable rclogger, disable cgroupsv2
    "${FILES}"/"${PN}"-enable-rclogger.patch
    "${FILES}"/"${PN}"-disable-cgroupsv2.patch
)


DEFAULT_SRC_COMPILE_PARAMS=(
    LIBNAME=lib
    LIBEXECDIR=/usr/$(exhost --target)/libexec/rc
    OS=Linux
)

DEFAULT_SRC_INSTALL_PARAMS=(
    PREFIX=/usr/$(exhost --target)
    SBINDIR=/usr/$(exhost --target)/bin
    SYSCONFDIR=/etc
    UPREFIX=/usr
    INCDIR=/usr/$(exhost --target)/include
    INCMODE=0755
    LIBDIR=/usr/$(exhost --target)/lib
    SHLIBDIR=/usr/$(exhost --target)/lib
    LIBMODE=0755
    BASHCOMPDIR=${BASHCOMPLETIONDIR}
    ZSHCOMPDIR=${ZSHCOMPLETIONDIR}
)

pkg_setup() {
    exdirectory --allow /etc/sysctl.d
}

src_prepare() {
    default

    # Redcore Linux : enable dkms integration
    if option dkms; then
        expatch "${FILES}"/"${PN}"-dkms.patch
    fi

    edo sed -e 's#readelf #${READELF:-readelf} #g'  \
            -i src/test/runtests.sh
}

src_compile() {
    export BRANDING="Redcore Linux"

    export DEBUG=
    export MKTERMCAP=$(optionv ncurses)

    export AR=$(exhost --tool-prefix)ar
    export RANLIB=$(exhost --tool-prefix)ranlib
    export CC=$(exhost --tool-prefix)cc

    MAKE_ARGS="
        ${DEFAULT_SRC_COMPILE_PARAMS[@]}
        MKAUDIT=no
        MKBASHCOMP=$(option bash-completion yes no)
        MKNET=$(option newnet yes no)
        MKPAM=$(optionv pam)
        MKSELINUX=no
        MKSTATICLIBS=no
        MKSYSVINIT=no
        MKZSHCOMP=$(option zsh-completion yes no)
    "

    emake ${MAKE_ARGS}
}

src_test() {
    export READELF=$(exhost --tool-prefix)readelf
    default
}

src_install() {
    emake \
        ${DEFAULT_SRC_INSTALL_PARAMS[@]} \
        ${MAKE_ARGS} \
        DESTDIR="${IMAGE}" install

    keepdir /usr/$(exhost --target)/libexec/rc/init.d
    keepdir /usr/$(exhost --target)/libexec/rc/tmp

    dodir /usr/share/"${PN}"
    edo cp -PR "${IMAGE}"/etc/runlevels "${IMAGE}"/usr/share/${PN}
    rm -rf "${IMAGE}"/etc/runlevels

    insinto /etc/logrotate.d
    newins "${FILES}"/openrc.logrotate openrc

    if option pam; then
        insinto /etc/pam.d
        newins "${FILES}"/system-services.pam system-services
        newins "${FILES}"/start-stop-daemon.pam start-stop-daemon
        newins "${FILES}"/start-stop-daemon.pam supervise-daemon
    fi

    dodoc ChangeLog *.md
    if option newnet; then
        dodoc README.newnet
    fi
}

pkg_postinst() {
    # Make our runlevels if they don't exist
    if [[ ! -e "${ROOT}"etc/runlevels ]] ||
            [[ -e "${ROOT}"etc/runlevels/.add_boot_init.created ]] ; then
        einfo "Copying across default runlevels"
        cp -RPp "${ROOT}"usr/share/${PN}/runlevels "${ROOT}"etc
        rm -f "${ROOT}"etc/runlevels/.add_boot_init.created
    else
        if [[ ! -e "${ROOT}"etc/runlevels/sysinit/devfs ]] ; then
            mkdir -p "${ROOT}"etc/runlevels/sysinit
            cp -RPp "${ROOT}"usr/share/${PN}/runlevels/sysinit/* \
                "${ROOT}"etc/runlevels/sysinit
        fi
        if [[ ! -e "${ROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
            mkdir -p "${ROOT}"etc/runlevels/shutdown
            cp -RPp "${ROOT}"usr/share/${PN}/runlevels/shutdown/* \
                "${ROOT}"etc/runlevels/shutdown
        fi
        if [[ ! -e "${ROOT}"etc/runlevels/nonetwork/local ]]; then
            cp -RPp "${ROOT}"usr/share/${PN}/runlevels/nonetwork \
                "${ROOT}"etc/runlevels
        fi
    fi

    # update the dependency tree after touching all files #224171
    [[ "${ROOT}" = "/" ]] &&
        "${ROOT}usr/$(exhost --target)/libexec"/rc/bin/rc-depend -u
}