import re


def parse_conf(dir):
    """
    Extract the Autoinstall and md5sum fields from the 
    package.conf file
    
    Args:
     - dir: directory name
    Returns:
     (autoinstall value, checksum value), where
         autoinstall value is "True" or "False"
    """
    md5pat = re.compile('^md5sum=(.*)$')
    autopat = re.compile('^Autoinstall=(.*)$')
    checksum = None
    autoinstall = None
    
    with open(dir + '/package.conf', 'r') as fp:
        for line in fp:
            m = md5pat.match(line)
            if m:
                checksum = m.group(1)
            else:
                m = autopat.match(line)
                if m:
                    autoinstall = m.group(1)
            if autoinstall and checksum:
                return (autoinstall, checksum)
    return (autoinstall, checksum)