diff --git a/cmd/install.go b/cmd/install.go index 7b0ad47..e978c23 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "runtime" + "strings" "sync" "github.com/AlecAivazis/survey/v2" @@ -82,7 +83,25 @@ func newInstall(installOpts installOpts, release string) (error, string) { return nil, release } log.Info("attempting to install quarto version: ", release) - res, err := pipeline.DownloadReleaseVersion(release, runtime.GOOS, installOpts.progress) + osType := runtime.GOOS + + // quarto has a specific custom version for rhel7/centos7 because + // of the old version of glibc so if on linux we need to also check + // what version to pull + if osType == "linux" { + // check if rhel7 system + if _, err := os.Stat("/etc/redhat-release"); err == nil { + releaseVersion, err := os.ReadFile("/etc/redhat-release") + if err != nil { + return err, "" + } + if strings.Contains(string(releaseVersion), "release 7") { + osType = "rhel7" + } + } + } + + res, err := pipeline.DownloadReleaseVersion(release, osType, installOpts.progress) if err != nil { return err, "" } diff --git a/internal/gh/assets.go b/internal/gh/assets.go index 94cc753..5e03009 100644 --- a/internal/gh/assets.go +++ b/internal/gh/assets.go @@ -23,6 +23,8 @@ func getOsAssetSuffix(os string) osAssetSuffix { return macos case "windows": return win + case "rhel7": + return rhel7 default: return unknown } @@ -35,6 +37,7 @@ const ( linuxamd64 macos win + rhel7 ) func (o osAssetSuffix) String() string { @@ -45,6 +48,8 @@ func (o osAssetSuffix) String() string { return "macos.tar.gz" case win: return "win.zip" + case rhel7: + return "linux-rhel7-amd64.tar.gz" default: return "unknown" } @@ -78,10 +83,10 @@ func (wc *WriteCounter) Write(p []byte) (int, error) { // targetOs should be "windows", "darwin", "linux" func DownloadReleaseAsset(client *github.Client, tag string, targetOs string, progress bool) (string, error) { switch targetOs { - case "windows", "darwin", "linux": + case "windows", "darwin", "linux", "rhel7": break default: - return "", fmt.Errorf("invalid target os: %s, must be one of linux,darwin,windows", targetOs) + return "", fmt.Errorf("invalid target os: %s, must be one of linux,darwin,windows,rhel7", targetOs) } release, err := GetRelease(client, tag) if err != nil {