-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnodegroupconfiguration-usbip.yaml
More file actions
68 lines (62 loc) · 2.38 KB
/
Copy pathnodegroupconfiguration-usbip.yaml
File metadata and controls
68 lines (62 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{{- if eq (include "virtualization-dra.isEnabled" .) "true"}}
apiVersion: deckhouse.io/v1alpha1
kind: NodeGroupConfiguration
metadata:
name: virtualization-install-usbip-modules
{{- include "helm_lib_module_labels" (list .) | nindent 2 }}
spec:
bundles:
- '*'
nodeGroups:
- '*'
weight: 30
content: |
# Copyright 2026 Flant JSC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
kernel_release="$(uname -r)"
bundle="$(bb-is-bundle)"
module_dir="/lib/modules/${kernel_release}/kernel/drivers/usb/usbip"
modules=("usbip-core.ko" "usbip-host.ko" "vhci-hcd.ko")
packages=()
modules_exist=true
for module in "${modules[@]}"; do
if [[ ! -e "${module_dir}/${module}" && ! -e "${module_dir}/${module}.zst" ]]; then
modules_exist=false
break
fi
done
if [[ "$modules_exist" == "true" ]]; then
bb-log-info "usbip kernel modules already exist for kernel ${kernel_release}."
return 0
fi
if bb-is-distro-like? "debian"; then
packages=("linux-modules-extra-${kernel_release}")
elif bb-is-distro-like? "rhel" || bb-is-distro-like? "centos" || bb-is-distro-like? "fedora"; then
packages=("kernel-modules-extra-${kernel_release}" "kernel-modules-extra")
elif [[ "$bundle" == "altlinux" ]]; then
packages=("kernel-modules-extra")
else
bb-log-warn "Unsupported OS for usbip kernel modules: bundle=${bundle}. Skipping."
return 0
fi
for pkg in "${packages[@]}"; do
bb-log-info "Installing package for usbip kernel modules (usbip_core, usbip_host, vhci_hcd): ${pkg}"
if bb-pkg install "$pkg"; then
return 0
fi
bb-log-warn "Failed to install package for usbip kernel modules: ${pkg}"
done
bb-log-warn "Could not install a package with usbip kernel modules for kernel ${kernel_release}."
return 0
{{- end }}