mirror of
https://github.com/krislamo/kernmod.git
synced 2024-12-16 11:50:36 +00:00
testing
This commit is contained in:
parent
42c46c0556
commit
a92fd87ba2
9
Vagrantfile
vendored
9
Vagrantfile
vendored
@ -1,5 +1,12 @@
|
||||
VAGRANT_BOX=ENV["VAGRANT_BOX"]
|
||||
if !VAGRANT_BOX || VAGRANT_BOX == "debian"
|
||||
VAGRANT_BOX = "debian/bullseye64"
|
||||
elsif VAGRANT_BOX == "rocky"
|
||||
VAGRANT_BOX = "rockylinux/8"
|
||||
end
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "debian/bullseye64"
|
||||
config.vm.box = VAGRANT_BOX
|
||||
config.vm.synced_folder ".", "/vagrant"
|
||||
config.vm.network "private_network", type: "dhcp"
|
||||
config.vm.provision "shell", path: "build.sh"
|
||||
|
52
build.sh
52
build.sh
@ -11,9 +11,20 @@ TEMPDIR="$(mktemp -d)"
|
||||
INSTALL=0
|
||||
BUILDDIR="$TEMPDIR/${PACKAGE}_$VERSION-$REVISION"
|
||||
|
||||
# Test for distribution of GNU/Linux
|
||||
# 0 = unknown
|
||||
# 1 = debian
|
||||
# 2 = rocky/centos/rhel
|
||||
function check_distro {
|
||||
if [ -f /etc/debian_version ]; then echo 1
|
||||
elif [ -f /etc/rocky-release ] || [ -f /etc/centos-release ]; then echo 2
|
||||
else echo 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Build debian package
|
||||
function build_deb {
|
||||
[ $INSTALL -eq 1 ] && install_headers
|
||||
[ $INSTALL -eq 1 ] && debian_headers
|
||||
mkdir -p "$BUILDDIR/usr/src/${PACKAGE}-$VERSION"
|
||||
mkdir -p "$BUILDDIR/etc"
|
||||
mkdir -p "$BUILDDIR/DEBIAN"
|
||||
@ -24,6 +35,11 @@ function build_deb {
|
||||
dpkg-deb --build "${PACKAGE}_$VERSION-$REVISION"
|
||||
}
|
||||
|
||||
# Build redhat package
|
||||
function build_rpm {
|
||||
[ $INSTALL -eq 1 ] && rhel_headers
|
||||
}
|
||||
|
||||
# Display details on module
|
||||
function info_mod {
|
||||
modinfo "$PACKAGE"
|
||||
@ -33,22 +49,36 @@ function info_mod {
|
||||
cat /var/log/messages | grep "$PACKAGE"
|
||||
}
|
||||
|
||||
# Install Linux headers for current kernel
|
||||
function install_headers {
|
||||
# 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 and install helloworld module or module(s) in $SCRATCH
|
||||
# Install Linux headers for current rhel kernel
|
||||
function rhel_headers {
|
||||
VERSION="$(uname -r | rev | cut -d '.' -f 2- | rev)"
|
||||
yum install -y kernel-headers-"$VERSION"
|
||||
}
|
||||
|
||||
# Find GNU/Linux distribution
|
||||
set -x
|
||||
DISTRO="$(check_distro)"
|
||||
if [ $DISTRO -eq 0 ]; then
|
||||
echo "ERROR: GNU/Linux distribution not detected"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Build and install helloworld module or module(s) in $SCRATCH
|
||||
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"
|
||||
build_deb
|
||||
[ $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
|
||||
@ -59,7 +89,13 @@ if [ ! -z "$(ls -Al $SCRATCH | grep -e ^d)" ]; then
|
||||
done
|
||||
else
|
||||
INSTALL=1
|
||||
build_deb
|
||||
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
||||
info_mod
|
||||
if [ $DISTRO -eq 1 ]; then
|
||||
build_deb
|
||||
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
||||
elif [ $DISTRO -eq 2 ]; then
|
||||
build_rpm
|
||||
echo "end of debug: exiting..."
|
||||
exit 0
|
||||
yum install -y "./${PACKAGE}_$VERSION-$REVISION.rpm"
|
||||
fi
|
||||
fi
|
||||
|
0
src/RHEL/helloworld.spec
Normal file
0
src/RHEL/helloworld.spec
Normal file
Loading…
Reference in New Issue
Block a user