#!/bin/sh

set -e

period="daily hourly monthly weekly"
operation="balance defrag scrub trim"

if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
    for i in $period; do
        for op in $operation; do
            if [ -L "/etc/cron.$i/btrfs-$op" ] \
                   && [ ! -e "/etc/cron.$i/btrfs-$op" ]; then
                rm "/etc/cron.$i/btrfs-$op"
            fi
        done
    done
fi

#DEBHELPER#

exit 0
