#!/bin/sh
#
# 66-init-diversity prerm
#

#set -e

case "$1" in
		remove|purge)
			# Exit with error code if 66 is detected as PID 1
			if [ -d /run/66/scandir ] && ( [ $(ps -p1 | grep -ic "s6-svscan") -eq 1 ] || [ $(ps -p1 | grep -ic "66-scandir") -eq 1 ] ) ; then
				echo "66 has been detected as the running init - stopping here"
				exit 1
			else
				66 remove boot@system 2>/dev/null
			fi
		;;	
		
		*) : 
		;;
esac


#DEBHELPER#

exit 0
