Main function

def entry(config, delete_files=None):
    """Main function"""
    home_dir = config.get('home_dir', '/var/lib/sachannelupdate')
    dns_ver = config.get('spamassassin_version', '1.4.3')
    remote_loc = config.get('remote_location')
    rule_dir = os.path.join(home_dir, 'rules')
    dest = os.path.join(home_dir, 'deploy')
    tardir = os.path.join(home_dir, 'archives')
    counterfile = os.path.join(home_dir, 'db', 'counters')

    check_required(config)

    if delete_files:
        cleanup(dest, tardir, counterfile)
        return

    cffiles = Queue()
    get_cf_files(rule_dir, cffiles)

    if process(dest, cffiles):
        version = get_counter(counterfile)
        filename = '%s.tar.gz' % version
        path = os.path.join(tardir, filename)
        package(dest, tardir, version)
        sign(config, path)
        hash_file(path)
        if upload(config, remote_loc, path):
            if update_dns(config, str(version), dns_ver):
                create_file(counterfile, "%d" % version)