From 40d19f0ad6058487642a6f629ebd02d4667e91c1 Mon Sep 17 00:00:00 2001 From: Joachim Desroches Date: Wed, 21 Apr 2021 11:03:00 +0200 Subject: [PATCH] [__jool] Use explorer to determine alpine kernel version. --- type/__jool/explorer/alpine-kernel-modules | 13 +++++++++++++ type/__jool/man.rst | 7 ------- type/__jool/manifest | 12 ++---------- 3 files changed, 15 insertions(+), 17 deletions(-) create mode 100755 type/__jool/explorer/alpine-kernel-modules diff --git a/type/__jool/explorer/alpine-kernel-modules b/type/__jool/explorer/alpine-kernel-modules new file mode 100755 index 0000000..e3a1a35 --- /dev/null +++ b/type/__jool/explorer/alpine-kernel-modules @@ -0,0 +1,13 @@ +#!/bin/sh +# Explorer for the __jool type to determine if we need the -virt or the -lts modules. + +[ "$(sh -e "${__explorer:?}"/os)" = 'alpine' ] || exit 0 + +case $(uname -r) in +*-virt) + printf "jool-modules-virt" + ;; +*-lts) + printf "jool-modules-lts" + ;; +esac diff --git a/type/__jool/man.rst b/type/__jool/man.rst index 9b47a21..3220bc2 100644 --- a/type/__jool/man.rst +++ b/type/__jool/man.rst @@ -36,13 +36,6 @@ pool6 The IPv6 prefix used to map IPv4 addresses, `64:ff9b::/96` if unspecified. -BOOLEAN PARAMETERS ------------------- -vm - Wether this instance is running in a VM or not: configures the kernel - modules that will be installed. - - EXAMPLES -------- diff --git a/type/__jool/manifest b/type/__jool/manifest index b116363..a0ff4ce 100755 --- a/type/__jool/manifest +++ b/type/__jool/manifest @@ -23,7 +23,7 @@ os=$(cat "${__global:?}/explorer/os") case "$os" in 'alpine') - : + packages="jool-tools jool-tools-openrc $(cat "${__object:?}"/explorer/alpine-kernel-modules)" ;; *) printf "This type has no implementation for %s. Please contribute one if you can.\n" "$os" @@ -31,15 +31,7 @@ case "$os" in ;; esac - -if [ -f "${__object:?}/parameter/vm" ]; -then - kernel_modules="jool-modules-virt" -else - kernel_modules="jool-modules-lts" -fi - -for pkg in jool-tools jool-tools-openrc "$kernel_modules"; +for pkg in $packages; do __package "$pkg" done