'Checks if necessary packages are already installed'

def check(self):

    result = True
    for p in self.PKGS:
        args = ['dpkg-query', '--show', '--showformat=${Status}', p]
        output = subprocess.Popen(args, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True).stdout.read()
        if (output != 'install    ok    installed'):
            result = False
    return result
