mirror of
				https://github.com/byReqz/go-etcher.git
				synced 2025-11-04 08:41:30 +00:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			0.0.3
			...
			d0f0957932
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					
						
						
							
						
						d0f0957932
	
				 | 
					
					
						||
| 
						 | 
					
						
						
							
						
						17bb76627f
	
				 | 
					
					
						||
| 
						 | 
					
						
						
							
						
						427c4fd990
	
				 | 
					
					
						
							
								
								
									
										7
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on: [push]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  test:
 | 
				
			||||||
 | 
					    uses: byReqz/workflows/.github/workflows/golint_with_codeql.yml@main
 | 
				
			||||||
							
								
								
									
										43
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								main.go
									
									
									
									
									
								
							@@ -1,19 +1,20 @@
 | 
				
			|||||||
package main
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"crypto/sha256"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"os"
 | 
						ac "github.com/JoaoDanielRufino/go-input-autocomplete"
 | 
				
			||||||
 | 
						"github.com/briandowns/spinner"
 | 
				
			||||||
 | 
						"github.com/fatih/color"
 | 
				
			||||||
 | 
						"github.com/schollz/progressbar/v3"
 | 
				
			||||||
 | 
						flag "github.com/spf13/pflag"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"time"
 | 
					 | 
				
			||||||
	"log"
 | 
						"log"
 | 
				
			||||||
	"strings"
 | 
						"os"
 | 
				
			||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
	"crypto/sha256"
 | 
						"strings"
 | 
				
			||||||
	"github.com/schollz/progressbar/v3"
 | 
						"time"
 | 
				
			||||||
	"github.com/fatih/color"
 | 
					 | 
				
			||||||
	"github.com/briandowns/spinner"
 | 
					 | 
				
			||||||
	flag "github.com/spf13/pflag"
 | 
					 | 
				
			||||||
	ac "github.com/JoaoDanielRufino/go-input-autocomplete"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var device string
 | 
					var device string
 | 
				
			||||||
@@ -119,7 +120,7 @@ func PrintAvail() {
 | 
				
			|||||||
			size = size * 512
 | 
								size = size * 512
 | 
				
			||||||
			size = size / 1024 / 1024 / 1024
 | 
								size = size / 1024 / 1024 / 1024
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			fmt.Print("     * ", "/dev/" + target)
 | 
								fmt.Print("     * ", "/dev/"+target)
 | 
				
			||||||
			if size > 0 {
 | 
								if size > 0 {
 | 
				
			||||||
				fmt.Print(" [", size, "GB]\n")
 | 
									fmt.Print(" [", size, "GB]\n")
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
@@ -179,7 +180,7 @@ func main() {
 | 
				
			|||||||
		inputsize = statinput.Size()
 | 
							inputsize = statinput.Size()
 | 
				
			||||||
		inputisblock = false
 | 
							inputisblock = false
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		inputsize, err = image.Seek(0, io.SeekEnd)
 | 
							inputsize, _ = image.Seek(0, io.SeekEnd)
 | 
				
			||||||
		inputisblock = true
 | 
							inputisblock = true
 | 
				
			||||||
		_, _ = image.Seek(0, 0)
 | 
							_, _ = image.Seek(0, 0)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -200,7 +201,7 @@ func main() {
 | 
				
			|||||||
		_, _ = target.Seek(0, 0)
 | 
							_, _ = target.Seek(0, 0)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	prehash := sha256.New()
 | 
						prehash := sha256.New()
 | 
				
			||||||
	if ! (force || disable_hash) {
 | 
						if !(force || disable_hash) {
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			s.Stop()
 | 
								s.Stop()
 | 
				
			||||||
			fmt.Println("\r[", color.RedString("✘"), "]  Getting file details                     ")
 | 
								fmt.Println("\r[", color.RedString("✘"), "]  Getting file details                     ")
 | 
				
			||||||
@@ -218,23 +219,23 @@ func main() {
 | 
				
			|||||||
		s.Stop()
 | 
							s.Stop()
 | 
				
			||||||
		fmt.Println("\r[", color.GreenString("✓"), "]  Getting file details                     ")
 | 
							fmt.Println("\r[", color.GreenString("✓"), "]  Getting file details                     ")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	inputmb := fmt.Sprint("[", inputsize / 1024 / 1024, "MB]")
 | 
						inputmb := fmt.Sprint("[", inputsize/1024/1024, "MB]")
 | 
				
			||||||
	devicemb := fmt.Sprint("[", targetsize / 1024 / 1024, "MB]")
 | 
						devicemb := fmt.Sprint("[", targetsize/1024/1024, "MB]")
 | 
				
			||||||
	var inputblock string
 | 
						var inputblock string
 | 
				
			||||||
	var targetblock string
 | 
						var targetblock string
 | 
				
			||||||
	if inputisblock == true {
 | 
						if inputisblock {
 | 
				
			||||||
		inputblock = "[Blockdevice]"
 | 
							inputblock = "[Blockdevice]"
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		inputblock = "[File]"
 | 
							inputblock = "[File]"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if targetisblock == true {
 | 
						if targetisblock {
 | 
				
			||||||
		targetblock = "[Blockdevice]"
 | 
							targetblock = "[Blockdevice]"
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		targetblock = "[File]"
 | 
							targetblock = "[File]"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fmt.Println("[", color.BlueString("i"), "]  Input device/file: " + input, inputmb, inputblock)
 | 
						fmt.Println("[", color.BlueString("i"), "]  Input device/file: "+input, inputmb, inputblock)
 | 
				
			||||||
	fmt.Println("[", color.BlueString("i"), "]  Output device/file: " + device, devicemb, targetblock)
 | 
						fmt.Println("[", color.BlueString("i"), "]  Output device/file: "+device, devicemb, targetblock)
 | 
				
			||||||
	if force == false {
 | 
						if !force {
 | 
				
			||||||
		if inputsize > targetsize {
 | 
							if inputsize > targetsize {
 | 
				
			||||||
			fmt.Println("[", color.RedString("w"), "]", color.RedString(" Warning:"), "Input file seems to be bigger than the destination!")
 | 
								fmt.Println("[", color.RedString("w"), "]", color.RedString(" Warning:"), "Input file seems to be bigger than the destination!")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -242,7 +243,7 @@ func main() {
 | 
				
			|||||||
		var yesno string
 | 
							var yesno string
 | 
				
			||||||
		_, _ = fmt.Scanln(&yesno)
 | 
							_, _ = fmt.Scanln(&yesno)
 | 
				
			||||||
		yesno = strings.TrimSpace(yesno)
 | 
							yesno = strings.TrimSpace(yesno)
 | 
				
			||||||
		if ! (yesno == "y" || yesno == "Y") {
 | 
							if !(yesno == "y" || yesno == "Y") {
 | 
				
			||||||
			log.Fatal("aborted")
 | 
								log.Fatal("aborted")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -273,7 +274,7 @@ func main() {
 | 
				
			|||||||
		s.Stop()
 | 
							s.Stop()
 | 
				
			||||||
		fmt.Println("\r[", color.GreenString("✓"), "]  Syncing                  ")
 | 
							fmt.Println("\r[", color.GreenString("✓"), "]  Syncing                  ")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if ! (force || disable_hash) {
 | 
						if !(force || disable_hash) {
 | 
				
			||||||
		s.Prefix = "[ "
 | 
							s.Prefix = "[ "
 | 
				
			||||||
		s.Suffix = " ]  Verifying"
 | 
							s.Suffix = " ]  Verifying"
 | 
				
			||||||
		s.Start()
 | 
							s.Start()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user