#!/bin/ksh93

# preinstall, preremove

BASE="${PKG_INSTALL_ROOT}"
[[ ${BASE} = '/' ]] && BASE=

# since mother fucking debina package crap does not provide any hints, whether
# this script gets invoked from an actually running instance or just virtual
# root, we just check for PKG_PROC_script. If not there, script was not called
# from SVr4 pkg tools, i.e. we assume from ancient, braindamaged debian
# stuff (and blindly exec, what we would do on running machines).
DOEXE=0
if [[ -n ${PKG_PROC_script} && -z ${BASE} ]] || [[ -z ${PKG_PROC_script} ]] \
then
	REL=${ uname -r ; }
	[[ '4.4.0-96-generic' == ${REL} ]] && [[ -x /bin/systemctl  ]] && \
		[[ -e /lib/systemd/system/nvidia-persistenced.service ]] && \
			/bin/systemctl stop --no-block nvidia-persistenced 2>/dev/null
fi
return 0
