if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ]; then
    if [ -x "/usr/bin/svctl" ]; then
        # holds units to enable. Extracted to this variable to prevent multiple svctl compiles when multiple units are enabled
        s6toenable=""
        # only enable on new installation, hence we need to check if unit is missing before compile
        for unit in #UNITFILES#; do
            # exit 3 means unit is unknown, add it to the list of units to enable
            if svctl isenabled $unit >/dev/null 2>&1; [ "$?" = "3" ]; then
                s6toenable="$s6toenable $unit"
            fi
        done
        # finally compile files, enable units and update s6-rc database
        svctl compile || true
        if [ -n "$s6toenable" ]; then
            svctl enable $s6toenable || true
        fi
        svctl update || true
    fi
fi
