-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve arch and system autodetection #52 #57
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ import ( | |
"encoding/json" | ||
"fmt" | ||
"regexp" | ||
"strings" | ||
|
||
"github.com/marwanhawari/stew/constants" | ||
) | ||
|
@@ -125,8 +124,10 @@ func assetsFound(releaseAssets []string, releaseTag string) error { | |
|
||
func filterReleaseAssets(assets []string) []string { | ||
var filteredAssets []string | ||
re := regexp.MustCompile(`\.(sha(256|512)(sum)?)$`) | ||
|
||
for _, asset := range assets { | ||
if strings.HasSuffix(asset, ".sha256") { | ||
if re.MatchString(asset) { | ||
Comment on lines
+127
to
+130
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move this to the // RegexChecksum is a regular expression for matching checksum files
var RegexChecksum = `\.(sha(256|512)(sum)?)$` |
||
continue | ||
} | ||
filteredAssets = append(filteredAssets, asset) | ||
|
@@ -152,6 +153,7 @@ func DetectAsset(userOS string, userArch string, releaseAssets []string) (string | |
} | ||
|
||
filteredReleaseAssets := filterReleaseAssets(releaseAssets) | ||
|
||
for _, asset := range filteredReleaseAssets { | ||
if reOS.MatchString(asset) { | ||
detectedOSAssets = append(detectedOSAssets, asset) | ||
|
@@ -189,7 +191,7 @@ func DetectAsset(userOS string, userArch string, releaseAssets []string) (string | |
} | ||
} | ||
if finalAsset == "" { | ||
finalAsset, err = WarningPromptSelect("Could not automatically detect the release asset matching your OS/Arch. Please select it manually:", filteredReleaseAssets) | ||
finalAsset, err = WarningPromptSelect("Could not automatically detect the release asset matching your OS/Arch. Please select it manually:", detectedFinalAssets) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think if filtering fails, I'd rather be conservative and show the user everything, so could you please revert this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok But can we add some logic around interactive and non-I reactive terminals? I use stew in docker installations and “I will show you everything” is not working well in this scenario There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it can be an option, but everybody will forget it on a first run. Just like -y is always forgotten in “apt install package“ in scripts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For non-interactive installs, you should be installing from a stew install Stewfile.lock.json There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh. It will not work this way. I'm on Mac, my container is linux and maybe on different architecture There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does presenting users with a filtered list of options here help with non-interactive installs? |
||
if err != nil { | ||
return "", err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove
.dmg
and.appx
? Don't think these help because even if you can download them you want be able to properly install these formats through stew.