summaryrefslogtreecommitdiff
path: root/pcr/openrc/PKGBUILD
blob: f5b66d8b90c11245dcab12d667142e92496dc601 (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
# 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')
pkgver=0.38.1
pkgrel=1
arch=('i686' 'x86_64' 'armv7h')
url="https://github.com/OpenRC/"
license=('BSD2')
options=('!emptydirs')
source=("${pkgbase}-${pkgver}.tar.gz::https://github.com/OpenRC/openrc/archive/${pkgver}.tar.gz"
        "${pkgbase}.logrotate")
sha512sums=('3fc4fef60e25ae34039753c3de6471baba89a7ffcd25f6756cf00954ab63262d07c749441a53198099678e5769c9547179074152872aebc66fe7a220d0302804'
            '690612fddfb2c4cf8f6b5ba7239b9faf29eb3d9b152ab4dcf62694aa2852780440d08cee56d98a9597607f446b3697c911269562821a8402bb5747cbbae34bd9')

_makeargs=(
    BRANDING='Parabola GNU/Linux-libre'
    SYSCONFDIR=/etc
    PREFIX=/usr
    SBINDIR=/usr/bin
    LIBEXECDIR=/usr/lib/rc
    MKSELINUX=no
    MKPAM=pam
    MKTERMCAP=ncurses
    MKNET=no
    MKSYSVINIT=yes
)

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

package_openrc() {
    pkgdesc="Gentoo's universal init system"
    groups=('base-openrc')
    depends=('psmisc' 'pam' 'openrc-pid1')
    optdepends=('netifrc: Network Interface Management Scripts'
                'networkmanager-openrc: NetworkManager')
    backup=('etc/rc.conf'
            'etc/conf.d/consolefont'
            'etc/conf.d/keymaps'
            'etc/conf.d/hostname'
            'etc/conf.d/modules'
            'etc/conf.d/hwclock'
            etc/conf.d/agetty.tty{1,2,3,4,5,6})
        
    cd "${srcdir}/${pkgbase}-${pkgver}"

    make DESTDIR="${pkgdir}" "${_makeargs[@]}" install

    install -Dm644 "${srcdir}/${pkgbase}.logrotate" "${pkgdir}/etc/logrotate.d/${pkgbase}"

    sed -e 's/#unicode="NO"/unicode="YES"/' \
        -e 's/#rc_logger="NO"/rc_logger="YES"/' \
        -i "${pkgdir}/etc/rc.conf"

    install -d ${pkgdir}/usr/lib/openrc/cache

    # getty
    sed -e 's|#baud=""|baud="38400"|' \
        -e 's|#term_type="linux"|term_type="linux"|' \
        -e 's|#agetty_options=""|agetty_options=""|' \
        -i ${pkgdir}/etc/conf.d/agetty

    # license
    install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/LICENSE "$pkgdir/usr/share/licenses/${pkgbase}/LICENSE"
    
    # move these to $srcdir    
    for bin in shutdown reboot halt poweroff openrc-init init openrc-shutdown; do
        mv -v ${pkgdir}/usr/bin/${bin} ${srcdir}/${bin}
    done
    mv -v ${pkgdir}/etc/conf.d/agetty ${srcdir}/agetty.confd
    mv -v ${pkgdir}/etc/init.d/agetty ${srcdir}/agetty.initd
}

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}-${pkgver}"
    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')
    
    cd ${srcdir}
    install -d ${pkgdir}/usr/bin/ \
            -d ${pkgdir}/etc/conf.d/ \
            -d ${pkgdir}/etc/init.d/ \
            -d ${pkgdir}/etc/runlevels/default/

    local bin
    for bin in shutdown reboot halt poweroff openrc-init init openrc-shutdown; do
        mv -v ${bin} ${pkgdir}/usr/bin/${bin}
    done
    
    mv -v agetty.confd ${pkgdir}/etc/conf.d/agetty
    mv -v agetty.initd ${pkgdir}/etc/init.d/agetty
    for num in 1 2 3 4 5 6;do
        cp -v ${pkgdir}/etc/conf.d/agetty ${pkgdir}/etc/conf.d/agetty.tty$num
        ln -sf /etc/init.d/agetty ${pkgdir}/etc/init.d/agetty.tty$num
        ln -sf /etc/init.d/agetty.tty$num ${pkgdir}/etc/runlevels/default/agetty.tty$num
    done

}