mirror of
https://github.com/krislamo/kernmod.git
synced 2024-11-10 00:30:36 +00:00
testing
This commit is contained in:
parent
88e33a86bb
commit
f1192da2cb
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@ -3,6 +3,8 @@ if !VAGRANT_BOX || VAGRANT_BOX == "debian"
|
||||
VAGRANT_BOX = "debian/bullseye64"
|
||||
elsif VAGRANT_BOX == "rocky"
|
||||
VAGRANT_BOX = "rockylinux/8"
|
||||
elsif VAGRANT_BOX == "centos"
|
||||
VAGRANT_BOX = "centos/7"
|
||||
end
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
|
78
build.sh
78
build.sh
@ -22,6 +22,13 @@ function check_distro {
|
||||
fi
|
||||
}
|
||||
|
||||
# Install Linux headers for current debian kernel
|
||||
function debian_headers {
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get install -y linux-headers-$(uname -r)
|
||||
}
|
||||
|
||||
# Build debian package
|
||||
function build_deb {
|
||||
[ $INSTALL -eq 1 ] && debian_headers
|
||||
@ -35,6 +42,12 @@ function build_deb {
|
||||
dpkg-deb --build "${PACKAGE}_$VERSION-$REVISION"
|
||||
}
|
||||
|
||||
# Install Linux headers for current rhel kernel
|
||||
function rhel_headers {
|
||||
KERNEL_VERSION="$(uname -r | rev | cut -d '.' -f 2- | rev)"
|
||||
yum install -y kernel-headers-"$KERNEL_VERSION" kernel-devel
|
||||
}
|
||||
|
||||
# Build redhat package
|
||||
function build_rpm {
|
||||
EL_VER="$(uname -r | awk 'match($0,/el[0-9]/) {print substr($0, RSTART, RLENGTH)}')"
|
||||
@ -60,54 +73,45 @@ function info_mod {
|
||||
cat /var/log/messages | grep "$PACKAGE"
|
||||
}
|
||||
|
||||
# Install Linux headers for current debian kernel
|
||||
function debian_headers {
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get install -y linux-headers-$(uname -r)
|
||||
}
|
||||
|
||||
# Install Linux headers for current rhel kernel
|
||||
function rhel_headers {
|
||||
KERNEL_VERSION="$(uname -r | rev | cut -d '.' -f 2- | rev)"
|
||||
yum install -y kernel-headers-"$KERNEL_VERSION" kernel-devel
|
||||
}
|
||||
|
||||
# Find GNU/Linux distribution
|
||||
set -x
|
||||
DISTRO="$(check_distro)"
|
||||
if [ $DISTRO -eq 0 ]; then
|
||||
# Build and install (optional)
|
||||
function build_install {
|
||||
DISTRO="$(check_distro)"
|
||||
if [ $DISTRO -eq 0 ]; then
|
||||
echo "ERROR: GNU/Linux distribution not detected"
|
||||
exit -1
|
||||
fi
|
||||
elif [ $DISTRO -eq 1 ]; then
|
||||
build_deb
|
||||
[ $INSTALL -eq 1 ] && apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
||||
elif [ $DISTRO -eq 2 ]; then
|
||||
build_rpm
|
||||
if [ $INSTALL -eq 1 ]; then
|
||||
yum install -y epel-release
|
||||
yum install -y dkms
|
||||
rpm -i "~/rpmbuild/RPMS/noarch/$PACKAGE-$VERSION-$REVISION.$EL_VER.noarch.rpm"
|
||||
fi
|
||||
fi
|
||||
info_mod
|
||||
}
|
||||
|
||||
# Build and install helloworld module or module(s) in $SCRATCH
|
||||
if [ ! -z "$(ls -Al $SCRATCH | grep -e ^d)" ]; then
|
||||
function main_routine {
|
||||
if [ ! -z "$(ls -Al $SCRATCH | grep -e ^d)" ]; then
|
||||
cd "$SCRATCH"
|
||||
for d in */ ; do
|
||||
if [ -f "$(basename $d)/override.sh" ]; then
|
||||
SRCDIR="$(pwd)/$(basename $d)"
|
||||
. "$(basename $d)/override.sh"
|
||||
[ $DISTRO -eq 1 ] && build_deb
|
||||
[ $DISTRO -eq 2 ] && build_rpm
|
||||
if [ $INSTALL -eq 1 ]; then
|
||||
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
||||
info_mod
|
||||
fi
|
||||
cp "./${PACKAGE}_$VERSION-$REVISION.deb" \
|
||||
"$OUTDIR/${PACKAGE}_$VERSION-$REVISION-$(date +%s).deb"
|
||||
build_install
|
||||
fi
|
||||
done
|
||||
else
|
||||
else
|
||||
INSTALL=1
|
||||
if [ $DISTRO -eq 1 ]; then
|
||||
build_deb
|
||||
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
||||
elif [ $DISTRO -eq 2 ]; then
|
||||
build_rpm
|
||||
yum install -y epel-release
|
||||
yum install -y dkms
|
||||
rpm -i "~/rpmbuild/RPMS/noarch/$PACKAGE-$VERSION-$REVISION.$EL_VER.noarch.rpm"
|
||||
build_install
|
||||
fi
|
||||
info_mod
|
||||
}
|
||||
|
||||
# Program starts here unless KERNMOD_MAIN is not 0
|
||||
if [ "${KERNMOD_MAIN:-0}" -eq 0 ]; then
|
||||
set -x
|
||||
main_routine
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user