Skip to content

Commit

Permalink
v1.0.0-DEV-11
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenfritz committed Feb 2, 2024
1 parent 62de22c commit 37f82f5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/buildstatus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
name: Checkout
uses: actions/checkout@v4
-
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
Expand Down
2 changes: 1 addition & 1 deletion cmd/admftrove/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

BINARY=admftrove
VERSION=1.0.0-DEV-10
VERSION=1.0.0-DEV-11
BUILD=`git rev-parse --short HEAD`
PLATFORMS=darwin linux windows
ARCHITECTURES=amd64
Expand Down
24 changes: 21 additions & 3 deletions cmd/admftrove/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
ft "github.com/steffenfritz/FileTrove"
)

// Version holds the version of ^FileTrove and is set by the build system
var Version string
// Version holds the version of FileTrove and is set by the build system
var Version string = "v1.0.0-DEV-11"

// Build is not usd anymore since DEV-11
// Build holds the sha1 fingerprint of the build and is set by the build system
var Build string
//var Build string

// logger is the structured logger that is used for all logging levels
var logger *slog.Logger
Expand Down Expand Up @@ -128,5 +129,22 @@ func main() {
return
}

// Update version 1.0.0-DEV-10 --> 1.0.0-DEV-11
if instversion == "1.0.0-DEV-10" {
_, err = ftdb.Exec("UPDATE filetrove SET version = '1.0.0-DEV-11' where version = '1.0.0-DEV-10'")
if err != nil {
logger.Error("Could not update database", slog.String("error", err.Error()))
return
}
updatetime := time.Now().Format(time.RFC3339)
_, err = ftdb.Exec("UPDATE filetrove SET lastupdate = ?", updatetime)
if err != nil {
logger.Error("Could not update last update time.", slog.String("error", err.Error()))
return
}
logger.Info("FileTrove database updated to version 1.0.0-DEV-11.")
return
}

}
}
12 changes: 7 additions & 5 deletions cmd/ftrove/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import (
ft "github.com/steffenfritz/FileTrove"
)

// version holds the version of FileTrove and is set by the build system, i.e. goreleaser
var Version string
// version holds the version of FileTrove. Due to different build systems and GH Actions set manually for now.
var Version string = "v1.0.0-DEV-11"

// commit holds the sha1 fingerprint of the build and is set by the build system, i.e. goreleaser
var Build string
// Build not used anymore since DEV-11
// Build holds the sha1 fingerprint of the build and is set by the build system, e.g. task, make
//var Build string

// tsStartedFormated is the formated timestamp when FileTrove was started
var tsStartedFormated string
Expand Down Expand Up @@ -79,7 +80,8 @@ func main() {
ft.PrintBanner()

if *printversion {
ft.PrintLicense(Version, Build)
//ft.PrintLicense(Version, Build)
ft.PrintLicense(Version)
return
}

Expand Down
11 changes: 6 additions & 5 deletions nsrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"bufio"
"bytes"
"errors"
"github.com/schollz/progressbar/v3"
"go.etcd.io/bbolt"
"io"
"net/http"
"os"
"strings"

"github.com/schollz/progressbar/v3"
"go.etcd.io/bbolt"
)

func CreateNSRLBoltDB(nsrlsourcefile string, nsrldbfile string) error {
Expand Down Expand Up @@ -83,19 +84,19 @@ func CreateNSRLBoltDB(nsrlsourcefile string, nsrldbfile string) error {
}

// GetNSRL downloads a prepared BoltDB database file from an online storage
func GetNSRL() error {
func GetNSRL(install string) error {
req, err := http.NewRequest("GET", "https://download.fritz.wtf/nsrl.db", nil)
if err != nil {
return err
}

resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()

f, err := os.OpenFile("db/nsrl.db", os.O_CREATE|os.O_WRONLY, 0644)
f, err := os.OpenFile(install+"/db/nsrl.db", os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return err
}
Expand Down

0 comments on commit 37f82f5

Please sign in to comment.