func()

in plugin/step/install/linux/apt/apt.go [178:206]


func (s *Step) findDEB() (string, error) {
	dirEntries, err := ioutil.ReadDir(s.downloadPath)
	if err != nil {
		return "", err
	}

	var matches []string
	for _, entry := range dirEntries {
		if s.packageRegex.MatchString(entry.Name()) {
			matches = append(matches, entry.Name())
		}
	}

	if len(matches) < 1 {
		return "", os.ErrNotExist
	}

	sort.Strings(matches)

	if s.Version != "" {
		for _, m := range matches {
			if strings.Contains(m, s.Version) {
				return m, nil
			}
		}
	}

	return matches[0], nil
}