From c9da1440e47aed21e6929f0637ccc4890f17a20a Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Mon, 3 Nov 2025 15:06:23 +0100 Subject: [PATCH 1/5] Add --temp-dir flag to allow users to choose where to download and extract images --- flash.go | 11 +++++++---- updater/download_image.go | 26 +++++++++++++++----------- updater/flasher.go | 6 +++--- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/flash.go b/flash.go index a439185..77c6b03 100644 --- a/flash.go +++ b/flash.go @@ -31,6 +31,7 @@ import ( func newFlashCmd() *cobra.Command { var forceYes bool + var tempDir string appCmd := &cobra.Command{ Use: "flash", Short: "Flash a Debian image on the board", @@ -61,15 +62,17 @@ NOTE: On Windows, required drivers are automatically installed with elevated pri " " + os.Args[0] + " flash ./my-image.tar.zst\n" + " " + os.Args[0] + " flash /path/to/debian-image.tar.zst\n" + " " + os.Args[0] + " flash /path/to/debian-image.tar.xz \n" + - " " + os.Args[0] + " flash /path/to/arduino-unoq-debian-image-20250915-173 \n", + " " + os.Args[0] + " flash /path/to/arduino-unoq-debian-image-20250915-173 \n" + + " " + os.Args[0] + " flash latest --temp-dir /path/to/custom/tempDir \n", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { checkDriversInstalled() - runFlashCommand(cmd.Context(), args, forceYes) + runFlashCommand(cmd.Context(), args, forceYes, tempDir) }, } appCmd.Flags().BoolVarP(&forceYes, "yes", "y", false, "Automatically confirm all prompts") + appCmd.Flags().StringVar(&tempDir, "temp-dir", "", "Path to the directory in which the image will be downloaded and extracted") // TODO: add --clean-install flag or something similar to distinguish between keeping and purging the /home directory return appCmd @@ -86,13 +89,13 @@ func checkDriversInstalled() { } } -func runFlashCommand(ctx context.Context, args []string, forceYes bool) { +func runFlashCommand(ctx context.Context, args []string, forceYes bool, tempDir string) { imagePath, err := paths.New(args[0]).Abs() if err != nil { feedback.Fatal(i18n.Tr("could not find image absolute path: %v", err), feedback.ErrBadArgument) } - err = updater.Flash(ctx, imagePath, args[0], forceYes) + err = updater.Flash(ctx, imagePath, args[0], forceYes, tempDir) if err != nil { feedback.Fatal(i18n.Tr("error flashing the board: %v", err), feedback.ErrBadArgument) } diff --git a/updater/download_image.go b/updater/download_image.go index d5c1890..5ae6fdf 100644 --- a/updater/download_image.go +++ b/updater/download_image.go @@ -46,8 +46,8 @@ type Release struct { // DownloadConfirmCB is a function that is called when a Debian image is ready to be downloaded. type DownloadConfirmCB func(target string) (bool, error) -func DownloadAndExtract(client *Client, targetVersion string, upgradeConfirmCb DownloadConfirmCB, forceYes bool) (*paths.Path, string, error) { - tmpZip, version, err := DownloadImage(client, targetVersion, upgradeConfirmCb, forceYes) +func DownloadAndExtract(client *Client, targetVersion string, upgradeConfirmCb DownloadConfirmCB, forceYes bool, tempDir string) (*paths.Path, string, error) { + tmpZip, version, err := DownloadImage(client, targetVersion, upgradeConfirmCb, forceYes, tempDir) if err != nil { return nil, "", fmt.Errorf("error downloading the image: %v", err) } @@ -69,7 +69,7 @@ func DownloadAndExtract(client *Client, targetVersion string, upgradeConfirmCb D return imagePath, version, nil } -func DownloadImage(client *Client, targetVersion string, upgradeConfirmCb DownloadConfirmCB, forceYes bool) (*paths.Path, string, error) { +func DownloadImage(client *Client, targetVersion string, upgradeConfirmCb DownloadConfirmCB, forceYes bool, tempDir string) (*paths.Path, string, error) { var err error feedback.Print(i18n.Tr("Checking for Debian image releases")) @@ -112,7 +112,7 @@ func DownloadImage(client *Client, targetVersion string, upgradeConfirmCb Downlo defer download.Close() // Download the zip - temp, err := GetTempDir("download-") + temp, err := GetTempDir("download-", tempDir) if err != nil { return nil, "", fmt.Errorf("could not create temporary download directory: %w", err) } @@ -166,14 +166,18 @@ func ExtractImage(archive, temp *paths.Path) error { // GetTempDir returns a temporary directory inside the user's cache directory. // The caller is responsible for removing the directory when no longer needed. -func GetTempDir(prefix string) (*paths.Path, error) { - userCacheDir, err := os.UserCacheDir() - if err != nil { - return nil, fmt.Errorf("could not get user's cache directory: %w", err) - } +func GetTempDir(prefix string, tempDir string) (*paths.Path, error) { + cacheDir := paths.New(tempDir) + + if cacheDir == nil { + userCacheDir, err := os.UserCacheDir() + if err != nil { + return nil, fmt.Errorf("could not get user's cache directory: %w", err) + } - cacheDir := paths.New(userCacheDir, "arduino-flasher-cli") - _ = cacheDir.MkdirAll() + cacheDir = paths.New(userCacheDir, "arduino-flasher-cli") + _ = cacheDir.MkdirAll() + } temp, err := paths.MkTempDir(cacheDir.String(), prefix) if err != nil { diff --git a/updater/flasher.go b/updater/flasher.go index 9daae0e..4d5233d 100644 --- a/updater/flasher.go +++ b/updater/flasher.go @@ -28,7 +28,7 @@ import ( "github.com/arduino/arduino-flasher-cli/updater/artifacts" ) -func Flash(ctx context.Context, imagePath *paths.Path, version string, forceYes bool) error { +func Flash(ctx context.Context, imagePath *paths.Path, version string, forceYes bool, tempDir string) error { if !imagePath.Exist() { client := NewClient() @@ -43,7 +43,7 @@ func Flash(ctx context.Context, imagePath *paths.Path, version string, forceYes } yes := strings.ToLower(yesInput) == "yes" || strings.ToLower(yesInput) == "y" return yes, nil - }, forceYes) + }, forceYes, tempDir) if err != nil { return fmt.Errorf("could not download and extract the image: %v", err) @@ -59,7 +59,7 @@ func Flash(ctx context.Context, imagePath *paths.Path, version string, forceYes version = v imagePath = tempImagePath } else if !imagePath.IsDir() { - temp, err := GetTempDir("extract-") + temp, err := GetTempDir("extract-", tempDir) if err != nil { return fmt.Errorf("error creating a temporary directory to extract the archive: %v", err) } From eaaca81598159438e2d9bda80c622355a5b1d089 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Mon, 3 Nov 2025 17:01:54 +0100 Subject: [PATCH 2/5] Check free disk space before starting an image download or extraction --- go.mod | 9 +++++++-- go.sum | 22 ++++++++++++++++++---- updater/download_image.go | 14 ++++++++++++++ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 1f966aa..c9c05b4 100644 --- a/go.mod +++ b/go.mod @@ -9,9 +9,10 @@ require ( github.com/jedib0t/go-pretty/v6 v6.6.8 github.com/leonelquinteros/gotext v1.7.2 github.com/schollz/progressbar/v3 v3.18.0 + github.com/shirou/gopsutil/v4 v4.25.10 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.9.1 - github.com/stretchr/testify v1.10.0 + github.com/stretchr/testify v1.11.1 go.bug.st/cleanup v1.0.0 go.bug.st/f v0.4.0 ) @@ -29,6 +30,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/dlclark/regexp2 v1.11.5 // indirect github.com/dominikbraun/graph v0.23.0 // indirect + github.com/ebitengine/purego v0.9.0 // indirect github.com/elliotchance/orderedmap/v3 v3.1.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.18.0 // indirect @@ -36,6 +38,7 @@ require ( github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.6.2 // indirect github.com/go-git/go-git/v5 v5.16.2 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/go-task/task/v3 v3.44.1 // indirect github.com/go-task/template v0.2.0 // indirect @@ -56,6 +59,7 @@ require ( github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect github.com/pjbgf/sha1cd v0.3.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sajari/fuzzy v1.0.0 // indirect @@ -65,11 +69,12 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/ulikunitz/xz v0.5.12 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect golang.org/x/crypto v0.37.0 // indirect golang.org/x/net v0.39.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.36.0 // indirect + golang.org/x/sys v0.37.0 // indirect golang.org/x/term v0.35.0 // indirect golang.org/x/text v0.24.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 386a8c9..e33781d 100644 --- a/go.sum +++ b/go.sum @@ -43,6 +43,8 @@ github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZ github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dominikbraun/graph v0.23.0 h1:TdZB4pPqCLFxYhdyMFb1TBdFxp8XLcJfTTBQucVPgCo= github.com/dominikbraun/graph v0.23.0/go.mod h1:yOjYyogZLY1LSG9E33JWZJiq5k83Qy2C6POAuiViluc= +github.com/ebitengine/purego v0.9.0 h1:mh0zpKBIXDceC63hpvPuGLiJ8ZAa3DfrFTudmfi8A4k= +github.com/ebitengine/purego v0.9.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o= github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE= github.com/elliotchance/orderedmap/v3 v3.1.0 h1:j4DJ5ObEmMBt/lcwIecKcoRxIQUEnw0L804lXYDt/pg= @@ -63,6 +65,9 @@ github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMj github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= github.com/go-git/go-git/v5 v5.16.2 h1:fT6ZIOjE5iEnkzKyxTHK1W4HGAsPhqEqiSAssSO77hM= github.com/go-git/go-git/v5 v5.16.2/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= @@ -125,6 +130,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/puzpuzpuz/xsync/v3 v3.5.1 h1:GJYJZwO6IdxN/IKbneznS6yPkVC+c3zyY/j19c++5Fg= github.com/puzpuzpuz/xsync/v3 v3.5.1/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -141,6 +148,8 @@ github.com/sebdah/goldie/v2 v2.7.1 h1:PkBHymaYdtvEkZV7TmyqKxdmn5/Vcj+8TpATWZjnG5 github.com/sebdah/goldie/v2 v2.7.1/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/shirou/gopsutil/v4 v4.25.10 h1:at8lk/5T1OgtuCp+AwrDofFRjnvosn0nkN2OLQ6g8tA= +github.com/shirou/gopsutil/v4 v4.25.10/go.mod h1:+kSwyC8DRUD9XXEHCAFjK+0nuArFJM0lva+StQAcskM= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= @@ -157,12 +166,14 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= @@ -181,17 +192,20 @@ golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= -golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= +golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ= golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA= diff --git a/updater/download_image.go b/updater/download_image.go index 5ae6fdf..c0896cf 100644 --- a/updater/download_image.go +++ b/updater/download_image.go @@ -27,11 +27,15 @@ import ( "github.com/arduino/go-paths-helper" "github.com/codeclysm/extract/v4" "github.com/schollz/progressbar/v3" + "github.com/shirou/gopsutil/v4/disk" "github.com/arduino/arduino-flasher-cli/feedback" "github.com/arduino/arduino-flasher-cli/i18n" ) +const GB = uint64(1024 * 1024 * 1024) +const NeededDiskSpace = uint64(15) + type Manifest struct { Latest Release `json:"latest"` Releases []Release `json:"releases"` @@ -183,5 +187,15 @@ func GetTempDir(prefix string, tempDir string) (*paths.Path, error) { if err != nil { return nil, fmt.Errorf("could not create .cache directory: %w", err) } + + // Check if there is enough free disk space before downloading/extracting an image + d, err := disk.Usage(temp.String()) + if err != nil { + return nil, err + } + if d.Free/GB < NeededDiskSpace { + return nil, fmt.Errorf("aborting: download and extraction requires up to 15Gb of free space") + } + return temp, nil } From b1473c64c8f2f1965a0c8b96e133033c88db2183 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Mon, 3 Nov 2025 17:08:33 +0100 Subject: [PATCH 3/5] Update dependencies --- .../shirou/gopsutil/v4/common.dep.yml | 74 +++++++++++++++++++ .../shirou/gopsutil/v4/disk.dep.yml | 74 +++++++++++++++++++ .../gopsutil/v4/internal/common.dep.yml | 74 +++++++++++++++++++ .../go/golang.org/x/sys/unix.dep.yml | 8 +- 4 files changed, 226 insertions(+), 4 deletions(-) create mode 100644 .licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/common.dep.yml create mode 100644 .licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/disk.dep.yml create mode 100644 .licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/internal/common.dep.yml diff --git a/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/common.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/common.dep.yml new file mode 100644 index 0000000..c5cef27 --- /dev/null +++ b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/common.dep.yml @@ -0,0 +1,74 @@ +--- +name: github.com/shirou/gopsutil/v4/common +version: v4.25.10 +type: go +summary: 'SPDX-License-Identifier: BSD-3-Clause' +homepage: https://pkg.go.dev/github.com/shirou/gopsutil/v4/common +license: other +licenses: +- sources: v4@v4.25.10/LICENSE + text: |- + gopsutil is distributed under BSD license reproduced below. + + Copyright (c) 2014, WAKAYAMA Shirou + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the gopsutil authors nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + ------- + internal/common/binary.go in the gopsutil is copied and modified from golang/encoding/binary.go. + + + + Copyright (c) 2009 The Go Authors. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- sources: v4@v4.25.10/README.md + text: New BSD License (same as psutil) +notices: [] diff --git a/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/disk.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/disk.dep.yml new file mode 100644 index 0000000..8679689 --- /dev/null +++ b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/disk.dep.yml @@ -0,0 +1,74 @@ +--- +name: github.com/shirou/gopsutil/v4/disk +version: v4.25.10 +type: go +summary: 'SPDX-License-Identifier: BSD-3-Clause' +homepage: https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk +license: other +licenses: +- sources: v4@v4.25.10/LICENSE + text: |- + gopsutil is distributed under BSD license reproduced below. + + Copyright (c) 2014, WAKAYAMA Shirou + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the gopsutil authors nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + ------- + internal/common/binary.go in the gopsutil is copied and modified from golang/encoding/binary.go. + + + + Copyright (c) 2009 The Go Authors. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- sources: v4@v4.25.10/README.md + text: New BSD License (same as psutil) +notices: [] diff --git a/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/internal/common.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/internal/common.dep.yml new file mode 100644 index 0000000..e990ca3 --- /dev/null +++ b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/internal/common.dep.yml @@ -0,0 +1,74 @@ +--- +name: github.com/shirou/gopsutil/v4/internal/common +version: v4.25.10 +type: go +summary: 'SPDX-License-Identifier: BSD-3-Clause' +homepage: https://pkg.go.dev/github.com/shirou/gopsutil/v4/internal/common +license: other +licenses: +- sources: v4@v4.25.10/LICENSE + text: |- + gopsutil is distributed under BSD license reproduced below. + + Copyright (c) 2014, WAKAYAMA Shirou + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the gopsutil authors nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + ------- + internal/common/binary.go in the gopsutil is copied and modified from golang/encoding/binary.go. + + + + Copyright (c) 2009 The Go Authors. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- sources: v4@v4.25.10/README.md + text: New BSD License (same as psutil) +notices: [] diff --git a/.licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml b/.licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml index 6dacbe6..d9d7ef1 100644 --- a/.licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml +++ b/.licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/sys/unix -version: v0.36.0 +version: v0.37.0 type: go summary: Package unix contains an interface to the low-level operating system primitives. homepage: https://pkg.go.dev/golang.org/x/sys/unix -license: bsd-3-clause +license: bsd-3-clause licenses: -- sources: sys@v0.36.0/LICENSE +- sources: sys@v0.37.0/LICENSE text: | Copyright 2009 The Go Authors. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: sys@v0.36.0/PATENTS +- sources: sys@v0.37.0/PATENTS text: | Additional IP Rights Grant (Patents) From a3a3b72a86d5eb60c8aafa162b5e548b82c265a7 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Mon, 3 Nov 2025 17:19:48 +0100 Subject: [PATCH 4/5] Manually review licenses --- .../go/github.com/shirou/gopsutil/v4/common.dep.yml | 2 +- .../go/github.com/shirou/gopsutil/v4/disk.dep.yml | 2 +- .../go/github.com/shirou/gopsutil/v4/internal/common.dep.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/common.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/common.dep.yml index c5cef27..6185644 100644 --- a/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/common.dep.yml +++ b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/common.dep.yml @@ -4,7 +4,7 @@ version: v4.25.10 type: go summary: 'SPDX-License-Identifier: BSD-3-Clause' homepage: https://pkg.go.dev/github.com/shirou/gopsutil/v4/common -license: other +license: bsd-3-clause licenses: - sources: v4@v4.25.10/LICENSE text: |- diff --git a/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/disk.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/disk.dep.yml index 8679689..52a5db9 100644 --- a/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/disk.dep.yml +++ b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/disk.dep.yml @@ -4,7 +4,7 @@ version: v4.25.10 type: go summary: 'SPDX-License-Identifier: BSD-3-Clause' homepage: https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk -license: other +license: bsd-3-clause licenses: - sources: v4@v4.25.10/LICENSE text: |- diff --git a/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/internal/common.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/internal/common.dep.yml index e990ca3..7f29c14 100644 --- a/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/internal/common.dep.yml +++ b/.licenses/arduino-flasher-cli/go/github.com/shirou/gopsutil/v4/internal/common.dep.yml @@ -4,7 +4,7 @@ version: v4.25.10 type: go summary: 'SPDX-License-Identifier: BSD-3-Clause' homepage: https://pkg.go.dev/github.com/shirou/gopsutil/v4/internal/common -license: other +license: bsd-3-clause licenses: - sources: v4@v4.25.10/LICENSE text: |- From c6f32e491a5a40bf0f6bd770b368cb0c40ba2b63 Mon Sep 17 00:00:00 2001 From: MatteoPologruto <109663225+MatteoPologruto@users.noreply.github.com> Date: Mon, 3 Nov 2025 17:22:24 +0100 Subject: [PATCH 5/5] Update updater/download_image.go Co-authored-by: Per Tillisch --- updater/download_image.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/updater/download_image.go b/updater/download_image.go index c0896cf..963a476 100644 --- a/updater/download_image.go +++ b/updater/download_image.go @@ -194,7 +194,7 @@ func GetTempDir(prefix string, tempDir string) (*paths.Path, error) { return nil, err } if d.Free/GB < NeededDiskSpace { - return nil, fmt.Errorf("aborting: download and extraction requires up to 15Gb of free space") + return nil, fmt.Errorf("aborting: download and extraction requires up to %d GB of free space", NeededDiskSpace) } return temp, nil