ROOTPLOIT
Server: nginx/1.18.0
System: Linux snslocalproxy 6.8.0-149-generic #149~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 28 20:58:45 UTC x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //snap/docker/3613/meta/hooks/configure
#!/bin/bash

set -eux

HOOK_LOG="${SNAP_COMMON}/hooks/${SNAP_REVISION}/$(basename "$0").log" && mkdir -p "${HOOK_LOG%/*}"
exec &> >(tee -a "${HOOK_LOG}")

. "${SNAP}/usr/share/nvidia-container-toolkit/lib"

# If the user unset the data-root, set it to the default
data_root="$(snapctl get data-root)"
if [ -z "$data_root" ] ; then
    snapctl set data-root="${DEFAULT_DATA_ROOT}"
fi

# Flag to trigger service restart if any condition requires it #
SVC_RESTART=false

if nvidia_support_disabled; then

    # Remove nvidia runtime config, if it exists #
    jq -r 'del(.runtimes.nvidia)' "${SNAP_DATA}/config/daemon.json" > "${SNAP_DATA}/config/daemon.json.new"

    # If it was removed [ there was a change ], copy in the new config, remove CDI config,  and set service restart flag #
    if ! cmp "${SNAP_DATA}/config/daemon.json"{,.new} >/dev/null ; then
        mv "${SNAP_DATA}/config/daemon.json"{.new,}
        rm -f "${SNAP_DATA}/etc/cdi/nvidia.yaml"
        rm -f "${SNAP_DATA}/etc/nvidia-container-runtime/config.toml"
        SVC_RESTART=true
    fi

fi

# Restart services if required #
# If oneshot services are inactive they don't respond to restart, so stop/start #
if $SVC_RESTART ; then
    snapctl stop "${SNAP_NAME}"
    snapctl start "${SNAP_NAME}"
# Otherwise, just restart the nvidia-container-toolkit #
else
    snapctl stop "${SNAP_NAME}.nvidia-container-toolkit"
    snapctl start "${SNAP_NAME}.nvidia-container-toolkit"
fi