mirror of
https://github.com/krislamo/kernmod.git
synced 2025-04-10 20:14:22 +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|
|
Vagrant.configure("2") do |config|
|
||||||
config.vm.box = "debian/bullseye64"
|
config.vm.box = VAGRANT_BOX
|
||||||
config.vm.synced_folder ".", "/vagrant"
|
config.vm.synced_folder ".", "/vagrant"
|
||||||
config.vm.network "private_network", type: "dhcp"
|
config.vm.network "private_network", type: "dhcp"
|
||||||
config.vm.provision "shell", path: "build.sh"
|
config.vm.provision "shell", path: "build.sh"
|
||||||
|
52
build.sh
52
build.sh
@ -11,9 +11,20 @@ TEMPDIR="$(mktemp -d)"
|
|||||||
INSTALL=0
|
INSTALL=0
|
||||||
BUILDDIR="$TEMPDIR/${PACKAGE}_$VERSION-$REVISION"
|
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
|
# Build debian package
|
||||||
function build_deb {
|
function build_deb {
|
||||||
[ $INSTALL -eq 1 ] && install_headers
|
[ $INSTALL -eq 1 ] && debian_headers
|
||||||
mkdir -p "$BUILDDIR/usr/src/${PACKAGE}-$VERSION"
|
mkdir -p "$BUILDDIR/usr/src/${PACKAGE}-$VERSION"
|
||||||
mkdir -p "$BUILDDIR/etc"
|
mkdir -p "$BUILDDIR/etc"
|
||||||
mkdir -p "$BUILDDIR/DEBIAN"
|
mkdir -p "$BUILDDIR/DEBIAN"
|
||||||
@ -24,6 +35,11 @@ function build_deb {
|
|||||||
dpkg-deb --build "${PACKAGE}_$VERSION-$REVISION"
|
dpkg-deb --build "${PACKAGE}_$VERSION-$REVISION"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Build redhat package
|
||||||
|
function build_rpm {
|
||||||
|
[ $INSTALL -eq 1 ] && rhel_headers
|
||||||
|
}
|
||||||
|
|
||||||
# Display details on module
|
# Display details on module
|
||||||
function info_mod {
|
function info_mod {
|
||||||
modinfo "$PACKAGE"
|
modinfo "$PACKAGE"
|
||||||
@ -33,22 +49,36 @@ function info_mod {
|
|||||||
cat /var/log/messages | grep "$PACKAGE"
|
cat /var/log/messages | grep "$PACKAGE"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install Linux headers for current kernel
|
# Install Linux headers for current debian kernel
|
||||||
function install_headers {
|
function debian_headers {
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y linux-headers-$(uname -r)
|
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
|
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
|
if [ ! -z "$(ls -Al $SCRATCH | grep -e ^d)" ]; then
|
||||||
cd "$SCRATCH"
|
cd "$SCRATCH"
|
||||||
for d in */ ; do
|
for d in */ ; do
|
||||||
if [ -f "$(basename $d)/override.sh" ]; then
|
if [ -f "$(basename $d)/override.sh" ]; then
|
||||||
SRCDIR="$(pwd)/$(basename $d)"
|
SRCDIR="$(pwd)/$(basename $d)"
|
||||||
. "$(basename $d)/override.sh"
|
. "$(basename $d)/override.sh"
|
||||||
build_deb
|
[ $DISTRO -eq 1 ] && build_deb
|
||||||
|
[ $DISTRO -eq 2 ] && build_rpm
|
||||||
if [ $INSTALL -eq 1 ]; then
|
if [ $INSTALL -eq 1 ]; then
|
||||||
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
||||||
info_mod
|
info_mod
|
||||||
@ -59,7 +89,13 @@ if [ ! -z "$(ls -Al $SCRATCH | grep -e ^d)" ]; then
|
|||||||
done
|
done
|
||||||
else
|
else
|
||||||
INSTALL=1
|
INSTALL=1
|
||||||
build_deb
|
if [ $DISTRO -eq 1 ]; then
|
||||||
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
build_deb
|
||||||
info_mod
|
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
|
fi
|
||||||
|
0
src/RHEL/helloworld.spec
Normal file
0
src/RHEL/helloworld.spec
Normal file
Loading…
x
Reference in New Issue
Block a user