diff --git a/.gitignore b/.gitignore index 246d589..3b7c47f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ duetbackup duetbackup-* +duetbackup.exe +*.tgz diff --git a/compile.fish b/compile.fish index 1785e18..050e2ac 100755 --- a/compile.fish +++ b/compile.fish @@ -1,7 +1,16 @@ #!/usr/bin/env fish -env GOOS=linux GOARCH=arm go build -o duetbackup-linux-arm duetbackup.go -env GOOS=linux GOARCH=arm GOARM=7 go build -o duetbackup-linux-armv7 duetbackup.go -env GOOS=linux go build -o duetbackup-linux_amd64 duetbackup.go -env GOOS=windows go build -o duetbackup-windows_amd64 duetbackup.go -env GOOS=darwin go build -o duetbackup-darwin_amd64 duetbackup.go +env GOOS=linux GOARCH=arm go build duetbackup.go +and tar czf duetbackup-linux_arm.tgz duetbackup LICENSE + +env GOOS=linux GOARCH=arm64 go build duetbackup.go +and tar czf duetbackup-linux_arm64.tgz duetbackup LICENSE + +env GOOS=linux go build duetbackup.go +and tar czf duetbackup-linux_amd64.tgz duetbackup LICENSE + +env GOOS=windows go build -o duetbackup.exe duetbackup.go +and zip -r duetbackup-windows_amd64.zip duetbackup.exe LICENSE + +env GOOS=darwin go build duetbackup.go +and tar czf duetbackup-darwin_amd64.tgz duetbackup LICENSE diff --git a/duetbackup.go b/duetbackup.go index 25569ce..e3809f2 100644 --- a/duetbackup.go +++ b/duetbackup.go @@ -57,10 +57,8 @@ func (f *file) UnmarshalJSON(b []byte) (err error) { // FIXME This needs to be solved better! // Get timezone offset to append to the date string that has no timezone offset once.Do(func() { - loc, _ := time.LoadLocation("Europe/Berlin") - _, offset := time.Now().In(loc).Zone() - o := int64(offset) / 3600 - offsetString = fmt.Sprintf("%+03d:00", o) + _, offset := time.Now().Zone() + offsetString = fmt.Sprintf("%+03d:00", int64(offset) / 3600) }) // Parse date string @@ -78,7 +76,7 @@ func getFileList(baseURL string, dir string, first uint64) (*filelist, error) { fileListURL := "rr_filelist?dir=" - resp, err := http.Get(baseURL + fileListURL + dir) + resp, err := httpClient.Get(baseURL + fileListURL + dir) if err != nil { return nil, err } @@ -241,7 +239,7 @@ func getAddress(domain string, port uint64) string { func connect(address, password string) error { path := "rr_connect?password=" + url.QueryEscape(password) + "&time=" + url.QueryEscape(time.Now().Format("2006-01-02T15:04:05")) - _, err := http.Get(address + path) + _, err := httpClient.Get(address + path) return err }