dcu-container-toolkit.spec 1.86 KB
Newer Older
1
Name: dcu-container-toolkit
songlinfeng's avatar
songlinfeng committed
2
3
4
5
6
7
8
9
10
11
Version: %{version}
Release: %{release}
Group: Development Tools

Vendor: HCUOpt CORPORATION
Packager: HCUOpt CORPORATION

Summary: DTK Container Toolkit
License: Apache-2.0

12
13
14
Source0: dcu-ctk
Source1: dcu-container-runtime
Source2: dcu-cdi-hook
songlinfeng's avatar
songlinfeng committed
15
Source3: LICENSE
16
Source4: dcu-docker
songlinfeng's avatar
songlinfeng committed
17
18
19
20
21

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

%prep
songlinfeng's avatar
songlinfeng committed
22
cp %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} .
songlinfeng's avatar
songlinfeng committed
23
24
25

%install
mkdir -p %{buildroot}%{_bindir}
26
27
28
29
install -m 755 -t %{buildroot}%{_bindir} dcu-container-runtime
install -m 755 -t %{buildroot}%{_bindir} dcu-ctk
install -m 755 -t %{buildroot}%{_bindir} dcu-cdi-hook
install -m 755 -t %{buildroot}%{_bindir} dcu-docker
songlinfeng's avatar
songlinfeng committed
30
31
32
33

%posttrans
if [ ! -e %{_bindir}/nvidia-container-runtime-hook ]; then
  # repairing lost file nvidia-container-runtime-hook
34
  ln -sf %{_bindir}/dcu-container-runtime %{_bindir}/nvidia-container-runtime-hook
songlinfeng's avatar
songlinfeng committed
35
36
37
fi

# Generate the default config; If this file already exists no changes are made.
38
%{_bindir}/dcu-ctk --quiet config --config-file=%{_sysconfdir}/dcu-container-runtime/config.toml --in-place
songlinfeng's avatar
songlinfeng committed
39

40
%{_bindir}/dcu-ctk runtime configure --runtime=docker --set-as-default
songlinfeng's avatar
songlinfeng committed
41
42
43
44
45
46
47
48
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
songlinfeng's avatar
songlinfeng committed
49
  if [ -e %{_bindir}/sdocker ]; then mv %{_bindir}/sdocker %{_bindir}/docker; fi
songlinfeng's avatar
songlinfeng committed
50
51
52
53
fi

%files
%license LICENSE
54
55
56
57
%{_bindir}/dcu-ctk
%{_bindir}/dcu-container-runtime
%{_bindir}/dcu-cdi-hook
%{_bindir}/dcu-docker
songlinfeng's avatar
songlinfeng committed
58
59
%changelog
* %{release_date} HCUOpt CORPORATION %{version}-%{release}
songlinfeng's avatar
songlinfeng committed
60
- initialize version