summaryrefslogtreecommitdiff
path: root/pcr/openrc/PKGBUILD
blob: a9e8cf43fef8aad90a7d856c10767f34eaa34d95 (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
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Maintainer: David P. <megver83@parabola.nu>
# Contributor: Luke Shumaker <lukeshu@parabola.nu>
#
# Maintainer (Artix): artoo <artoo@artixlinux.org>
# Maintainer (Artix): Chris Cromer <cromer@artixlinux.org>
# Contributor (Artix): williamh <williamh@gentoo.org>
#
# Maintainer (AUR):  Andrew Gregory <andrew.gregory.8@gmail.com>
# Maintainer (AUR): Lone_Wolf <lonewolf@xs4all.nl>
# Contributor (AUR): Bartłomiej Piotrowski <nospam@bpiotrowski.pl>

pkgbase=openrc
pkgname=('openrc' 'openrc-init' 'openrc-sysvinit' 'openrc-net')
pkgver=0.38.2
pkgrel=1
arch=('i686' 'x86_64' 'armv7h')
url="https://github.com/OpenRC/"
license=('BSD2')
options=('!emptydirs')
makedepends=('git')
validpgpkeys=('D57AEC44668E2E5073A440096E5416F430C46538') # William Hubbs <w.d.hubbs@gmail.com>
source=("git+https://github.com/OpenRC/openrc?signed#tag=${pkgver}"
        "${pkgbase}.logrotate")
sha512sums=('SKIP'
            '690612fddfb2c4cf8f6b5ba7239b9faf29eb3d9b152ab4dcf62694aa2852780440d08cee56d98a9597607f446b3697c911269562821a8402bb5747cbbae34bd9')

_makeargs=(
    BRANDING='Parabola GNU/Linux-libre'
    SYSCONFDIR=/etc
    PREFIX=/usr
    SBINDIR=/usr/bin
    LIBEXECDIR=/usr/lib/rc

    #MKNET=yes
    MKPAM=pam
    MKSELINUX=no
    MKSYSVINIT=yes
    MKTERMCAP=ncurses
)

build(){
    cd "$srcdir/$pkgbase"
    make "${_makeargs[@]}"

    # Go ahead and split the package now
    rm -rf "$srcdir/dest"

    # Put things in the main openrc package by default
    make DESTDIR="$srcdir/dest/openrc" "${_makeargs[@]}" install

    for file in \
      {usr,usr/lib/rc}/bin/shutdown \
      {usr,usr/lib/rc}/bin/reboot \
      {usr,usr/lib/rc}/bin/halt \
      {usr,usr/lib/rc}/bin/poweroff \
      usr/bin/openrc-shutdown \
      usr/bin/openrc-init \
      usr/bin/init \
      usr/share/man/man8/openrc-shutdown.8 \
      usr/share/man/man8/openrc-init.8
    do
        install -d -- "$srcdir/dest/openrc-init/${file%/*}"
        mv -T -- "$srcdir"/dest/{openrc,openrc-init}/"$file"
    done

    for file in etc/{init,conf}.d/{network,staticroute}; do
        install -d -- "$srcdir/dest/openrc-net/${file%/*}"
        mv -T -- "$srcdir"/dest/{openrc,openrc-net}/"$file"
    done
}

package_openrc() {
    pkgdesc="A dependency based init system"
    groups=('base-openrc')
    depends=('psmisc' 'pam' 'openrc-pid1')
    optdepends=('openrc-net: OpenRC ("newnet") network management scripts'
                'netifrc: Gentoo ("oldnet") network management scripts')
    backup=('etc/conf.d/agetty'
            'etc/conf.d/bootmisc'
            'etc/conf.d/consolefont'
            'etc/conf.d/devfs'
            'etc/conf.d/dmesg'
            'etc/conf.d/fsck'
            'etc/conf.d/hostname'
            'etc/conf.d/hwclock'
            'etc/conf.d/keymaps'
            'etc/conf.d/killprocs'
            'etc/conf.d/localmount'
            'etc/conf.d/modules'
            'etc/conf.d/mtab'
            'etc/conf.d/net-online'
            'etc/conf.d/netmount'
            'etc/conf.d/swap'
            'etc/conf.d/urandom'
            'etc/logrotate.d/openrc'
            'etc/pam.d/start-stop-daemon'
            'etc/pam.d/supervise-daemon'
            'etc/rc.conf')

    cp -rT -d --no-preserve=ownership,timestamp "$srcdir/dest/$pkgname" "$pkgdir"

    # Configuration
    sed -e 's/#unicode="NO"/unicode="YES"/' \
        -e 's/#rc_logger="NO"/rc_logger="YES"/' \
        -i "$pkgdir/etc/rc.conf"
    install -Dm644 "$srcdir/${pkgbase}.logrotate" "$pkgdir/etc/logrotate.d/${pkgbase}"

    # License
    install -Dm644 "$srcdir/$pkgbase/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_openrc-sysvinit() {
    pkgdesc="OpenRC support for using sysvinit as PID 1"
    depends=('openrc' 'sysvinit')
    provides=('openrc-pid1' 'initscripts')
    conflicts=('openrc-pid1' 'initscripts')
    backup=('etc/inittab')

    cd "$srcdir/$pkgbase"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    install -Dm644 support/sysvinit/inittab "$pkgdir/etc/inittab"
}

package_openrc-init() {
    pkgdesc="OpenRC alternative to sysvinit"
    groups=('base-openrc')
    depends=('openrc')
    provides=('openrc-pid1' 'init')
    conflicts=('openrc-pid1' 'init')
    backup=('etc/conf.d/agetty'.tty{1..6})

    cp -rT -d --no-preserve=ownership,timestamp "$srcdir/dest/$pkgname" "$pkgdir"

    # Enable agetty.tty{1..6} by default
    install -d "$pkgdir"/etc/conf.d/ \
               "$pkgdir"/etc/init.d/ \
               "$pkgdir"/etc/runlevels/default/
    local num
    for num in {1..6}; do
        echo "# This file inherits from '/etc/conf.d/agetty'" > "$pkgdir/etc/conf.d/agetty.tty$num"
        ln -sT agetty "$pkgdir/etc/init.d/agetty.tty$num"
        ln -sT "/etc/init.d/agetty.tty$num" "$pkgdir/etc/runlevels/default/agetty.tty$num"
    done

    # License
    install -Dm644 "$srcdir/$pkgbase/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_openrc-net() {
    pkgdesc="OpenRC new-style networking"
    depends=('openrc')
    backup=('etc/conf.d/network'
            'etc/conf.d/staticroute')

    cp -rT -d --no-preserve=ownership,timestamp "$srcdir/dest/$pkgname" "$pkgdir"

    # License
    install -Dm644 "$srcdir/$pkgbase/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}