# this package has no upstream, everything it ships lives in files/
pkg_name=baseinit
version=3.0.0
revision=3
build_style=custom
short_desc="the base basix boot sequence"
home_page="https://github.com/kkrruumm/basix-packages"
license="MIT"

depends="nitro s6-log chpst mdevd"

use_flags="gettys"

do_build() { :; }

do_install() {
    bcopy "$FILESDIR/sv/." /etc/sv
    if ! use gettys; then
        brm "/etc/sv/getty@"
    fi

    find "$DESTDIR/etc/sv" -type f \
        \( -name run -o -name setup -o -name finish -o -name fatal -o -name final \) \
        -exec chmod 0755 {} +

    for s in SYS LOG@; do
        bln "/etc/sv/$s" "/etc/nitro/$s"
    done

    # helpers and boot scripts, regular ass POSIX shell
    binstall "$FILESDIR/rc.lib" 0644 /usr/lib/nitro
    binstall "$FILESDIR/need" 0755 /usr/lib/nitro
    for s in "$FILESDIR"/scripts/*; do
        binstall "$s" 0755 /usr/lib/nitro/scripts
    done
}
