#!/bin/sh
set -e

zedd="/usr/lib/zfs-linux/zed.d"
etcd="/etc/zfs/zed.d"

if [ "$1" != "failed-upgrade" ] && [ -d "${etcd}" ] && [ -d "${zedd}" ] ; then
    while read -r file ; do
        etcfile="${etcd}/${file}"
        ( [ -L "${etcfile}" ] || [ -e "${etcfile}" ] ) && continue
        ln -sT /dev/null "${etcfile}"
    done < "${zedd}/DEFAULT-ENABLED"
fi

# Automatically added by dh_installsystemd/13.11.4
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	deb-systemd-invoke stop 'zfs-zed.service' >/dev/null || true
fi
# End automatically added section


