From 954f0a5fd1635c8f51603c4a74177b2fa5b90536 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 11 May 2021 18:25:46 -0700 Subject: [PATCH] add fips build support for mc --- cmd/update-main.go | 25 +++++++------------------ cmd/update_fips.go | 23 +++++++++++++++++++++++ cmd/update_nofips.go | 23 +++++++++++++++++++++++ 3 files changed, 53 insertions(+), 18 deletions(-) create mode 100644 cmd/update_fips.go create mode 100644 cmd/update_nofips.go diff --git a/cmd/update-main.go b/cmd/update-main.go index 425e8bf7..3603900c 100644 --- a/cmd/update-main.go +++ b/cmd/update-main.go @@ -77,17 +77,8 @@ const ( ) var ( - // Newer official download info URLs appear earlier below. - mcReleaseInfoURLs = []string{ - mcReleaseURL + "mc.sha256sum", - mcReleaseURL + "mc.shasum", - } - // For windows our files have .exe additionally. - mcReleaseWindowsInfoURLs = []string{ - mcReleaseURL + "mc.exe.sha256sum", - mcReleaseURL + "mc.exe.shasum", - } + mcReleaseWindowsInfoURL = mcReleaseURL + "mc.exe.sha256sum" ) // mcVersionToReleaseTime - parses a standard official release @@ -264,18 +255,16 @@ func downloadReleaseURL(releaseChecksumURL string, timeout time.Duration) (conte // DownloadReleaseData - downloads release data from mc official server. func DownloadReleaseData(timeout time.Duration) (data string, err *probe.Error) { - releaseURLs := mcReleaseInfoURLs + releaseURL := mcReleaseInfoURL if runtime.GOOS == "windows" { - releaseURLs = mcReleaseWindowsInfoURLs + releaseURL = mcReleaseWindowsInfoURL } return func() (data string, err *probe.Error) { - for _, url := range releaseURLs { - data, err = downloadReleaseURL(url, timeout) - if err == nil { - return data, nil - } + data, err = downloadReleaseURL(releaseURL, timeout) + if err == nil { + return data, nil } - return data, err.Trace(releaseURLs...) + return data, err.Trace(releaseURL) }() } diff --git a/cmd/update_fips.go b/cmd/update_fips.go new file mode 100644 index 00000000..7e2921a8 --- /dev/null +++ b/cmd/update_fips.go @@ -0,0 +1,23 @@ +// Copyright (c) 2015-2021 MinIO, Inc. +// +// This file is part of MinIO Object Storage stack +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// +build fips + +package cmd + +// Newer official download info URLs appear earlier below. +var mcReleaseInfoURL = mcReleaseURL + "mc.fips.sha256sum" diff --git a/cmd/update_nofips.go b/cmd/update_nofips.go new file mode 100644 index 00000000..1c601585 --- /dev/null +++ b/cmd/update_nofips.go @@ -0,0 +1,23 @@ +// Copyright (c) 2015-2021 MinIO, Inc. +// +// This file is part of MinIO Object Storage stack +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// +build !fips + +package cmd + +// Newer official download info URLs appear earlier below. +var mcReleaseInfoURL = mcReleaseURL + "mc.sha256sum"