File: //snap/docker/3618/meta/hooks/install
#!/bin/bash
set -eu
. "${SNAP}/usr/share/nvidia-container-toolkit/lib"
# Since the install hook is also the post-refresh hook, we need to check if the data-root is set
# and set it to default if it's not set
data_root="$(snapctl get data-root)"
if [ -z "$data_root" ] ; then
snapctl set data-root="${DEFAULT_DATA_ROOT}"
fi
# ensure the layouts dir for /etc/{stuff} exists
mkdir -p "$SNAP_DATA/etc/docker"
mkdir -p "$SNAP_DATA/config"
ensure_nvidia_data_dirs
# copy the config file from $SNAP into $SNAP_DATA if it doesn't exist
if [ ! -f "$SNAP_DATA/config/daemon.json" ]; then
cp "$SNAP/config/daemon.json" "$SNAP_DATA/config/daemon.json"
fi