From 340f3bc424f0599867da01c080022132ea6868fd Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Wed, 9 Jan 2019 10:28:01 -0600 Subject: [PATCH] Add postinst and prerm scripts for debian and rpm [ROCm/amdsmi commit: b9b0b26a78afa008086701b8ccca6e7ce3bbeb99] --- projects/amdsmi/DEBIAN/control | 9 +++++++++ projects/amdsmi/DEBIAN/postinst | 19 +++++++++++++++++++ projects/amdsmi/DEBIAN/prerm | 19 +++++++++++++++++++ .../amdsmi/DEBIAN/x86_64-librocm_smi_lib.conf | 1 + projects/amdsmi/RPM/rpm_post | 1 + projects/amdsmi/RPM/rpm_postun | 3 +++ 6 files changed, 52 insertions(+) create mode 100644 projects/amdsmi/DEBIAN/control create mode 100755 projects/amdsmi/DEBIAN/postinst create mode 100755 projects/amdsmi/DEBIAN/prerm create mode 100644 projects/amdsmi/DEBIAN/x86_64-librocm_smi_lib.conf create mode 100755 projects/amdsmi/RPM/rpm_post create mode 100755 projects/amdsmi/RPM/rpm_postun diff --git a/projects/amdsmi/DEBIAN/control b/projects/amdsmi/DEBIAN/control new file mode 100644 index 0000000000..9b5ef4e5d6 --- /dev/null +++ b/projects/amdsmi/DEBIAN/control @@ -0,0 +1,9 @@ +Package: rocm_smi_lib +Architecture: amd64 +Maintainer: Advanced Micro Devices Inc. +Priority: optional +Version: MODULE_VERSION +Depends: +Homepage: https://github.com/RadeonOpenCompute/rocm_smi_lib +Description: System Management Interface Library for ROCm + diff --git a/projects/amdsmi/DEBIAN/postinst b/projects/amdsmi/DEBIAN/postinst new file mode 100755 index 0000000000..530d0f5d79 --- /dev/null +++ b/projects/amdsmi/DEBIAN/postinst @@ -0,0 +1,19 @@ +#/bin/bash + +set -e + +do_ldconfig() { + echo /opt/rocm/lib > /etc/ld.so.conf.d/x86_64-librocm_smi_lib.conf && ldconfig +} + +case "$1" in + configure) + do_ldconfig + ;; + abort-upgrade|abort-remove|abort-deconfigure) + echo "$1" + ;; + *) + exit 0 + ;; +esac diff --git a/projects/amdsmi/DEBIAN/prerm b/projects/amdsmi/DEBIAN/prerm new file mode 100755 index 0000000000..9b38307ae0 --- /dev/null +++ b/projects/amdsmi/DEBIAN/prerm @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +rm_ldconfig() { + rm -f /etc/ld.so.conf.d/x86_64-librocm_smi_lib.conf && ldconfig +} + +case "$1" in + remove) + rm_ldconfig + ;; + purge) + ;; + *) + exit 0 + ;; +esac + diff --git a/projects/amdsmi/DEBIAN/x86_64-librocm_smi_lib.conf b/projects/amdsmi/DEBIAN/x86_64-librocm_smi_lib.conf new file mode 100644 index 0000000000..a4551d4820 --- /dev/null +++ b/projects/amdsmi/DEBIAN/x86_64-librocm_smi_lib.conf @@ -0,0 +1 @@ +/opt/rocm/lib diff --git a/projects/amdsmi/RPM/rpm_post b/projects/amdsmi/RPM/rpm_post new file mode 100755 index 0000000000..e98d87941f --- /dev/null +++ b/projects/amdsmi/RPM/rpm_post @@ -0,0 +1 @@ +echo -e "/opt/rocm/lib\n/opt/rocm/lib64" > /etc/ld.so.conf.d/x86_64-librocm_smi_lib.conf && ldconfig diff --git a/projects/amdsmi/RPM/rpm_postun b/projects/amdsmi/RPM/rpm_postun new file mode 100755 index 0000000000..80a0da7b5d --- /dev/null +++ b/projects/amdsmi/RPM/rpm_postun @@ -0,0 +1,3 @@ +if [ $1 -eq 0 ]; then + rm -f /etc/ld.so.conf.d/x86_64-librocm_smi_lib.conf && ldconfig +fi