dtk-container-toolkit.spec 1.68 KB
Newer Older
songlinfeng's avatar
songlinfeng committed
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
Name: dtk-container-toolkit
Version: %{version}
Release: %{release}
Group: Development Tools

Vendor: HCUOpt CORPORATION
Packager: HCUOpt CORPORATION

Summary: DTK Container Toolkit
License: Apache-2.0

Source0: dtk-ctk
Source1: dtk-container-runtime
Source2: dtk-cdi-hook
Source3: LICENSE

%description
Provides tools and utilities to enable HCU support in containers.

%prep
cp %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} .

%install
mkdir -p %{buildroot}%{_bindir}
install -m 755 -t %{buildroot}%{_bindir} dtk-container-runtime
install -m 755 -t %{buildroot}%{_bindir} dtk-ctk
install -m 755 -t %{buildroot}%{_bindir} dtk-cdi-hook

%posttrans
if [ ! -e %{_bindir}/nvidia-container-runtime-hook ]; then
  # repairing lost file nvidia-container-runtime-hook
  ln -sf %{_bindir}/dtk-container-runtime %{_bindir}/nvidia-container-runtime-hook
fi

# Generate the default config; If this file already exists no changes are made.
%{_bindir}/dtk-ctk --quiet config --config-file=%{_sysconfdir}/dtk-container-runtime/config.toml --in-place

%{_bindir}/dtk-ctk runtime configure --runtime=docker --set-as-default
echo -e "\e[032m ================================== \e[0m"
echo -e "\e[033m Please restart Docker service:     \e[0m"
echo -e "\e[033m    sudo systemctl restart docker   \e[0m"
echo -e "\e[032m ================================== \e[0m"

%postun
if [ "$1" = 0 ]; then  # package is uninstalled, not upgraded
  if [ -L %{_bindir}/nvidia-container-runtime-hook ]; then rm -f %{_bindir}/nvidia-container-runtime-hook; fi
fi

%files
%license LICENSE
%{_bindir}/dtk-ctk
%{_bindir}/dtk-container-runtime
%{_bindir}/dtk-cdi-hook
%changelog
* %{release_date} HCUOpt CORPORATION %{version}-%{release}
- initialize version