#!/bin/sh

case "$1" in
    remove)
        update-service --remove "/etc/sv/redis-ppc-cache-1" || true
        update-service --remove "/etc/sv/redis-ppc-cache-2" || true
        update-service --remove "/etc/sv/redis-ppc-cache-3" || true
        ;;
    purge)
        update-service --remove "/etc/sv/redis-ppc-cache-1" || true
        rm -fv "/etc/sv/redis-ppc-cache-1/supervise" || true
        find "/opt/redis/ppc-cache-6411" -maxdepth 1 -type f -exec rm -fv \; || true
        
        update-service --remove "/etc/sv/redis-ppc-cache-2" || true
        rm -fv "/etc/sv/redis-ppc-cache-2/supervise" || true
        find "/opt/redis/ppc-cache-6412" -maxdepth 1 -type f -exec rm -fv \; || true
        
        update-service --remove "/etc/sv/redis-ppc-cache-3" || true
        rm -fv "/etc/sv/redis-ppc-cache-3/supervise" || true
        find "/opt/redis/ppc-cache-6413" -maxdepth 1 -type f -exec rm -fv \; || true
        
        ;;
esac