33 lines
761 B
Bash
33 lines
761 B
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
NVIDIA_DOCKER_USER=#PACKAGE#
|
|
NVIDIA_DOCKER_ROOT=/var/lib/nvidia-docker
|
|
NVIDIA_DOCKER_PLUGIN=/usr/bin/nvidia-docker-plugin
|
|
|
|
case "$1" in
|
|
configure)
|
|
if [ -z "$2" ]; then
|
|
echo "Configuring user"
|
|
id -u "$NVIDIA_DOCKER_USER" >/dev/null 2>&1 || \
|
|
useradd -r -M -d "$NVIDIA_DOCKER_ROOT" -s /usr/sbin/nologin -c "NVIDIA Docker plugin" "$NVIDIA_DOCKER_USER"
|
|
fi
|
|
echo "Setting up permissions"
|
|
chown "$NVIDIA_DOCKER_USER": "$NVIDIA_DOCKER_ROOT"
|
|
setcap cap_fowner+pe "$NVIDIA_DOCKER_PLUGIN"
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|