#!/bin/bash
set -e

./configure --prefix=/usr \
            --bindir=/bin \
            --sysconfdir=/etc \
            --with-rootlibdir=/lib \
            --with-xz \
            --with-zstd \
            --with-zlib &&

make &&

make -j1 install &&

for target in depmod insmod lsmod modinfo modprobe rmmod; do
  ln -sfv ../bin/kmod /sbin/"${target}"
done

ln -sfv kmod /bin/lsmod