mirror of
https://github.com/restic/restic.git
synced 2025-10-27 07:40:53 +00:00
Add build.go
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
.PHONY: all clean debug
|
||||
|
||||
# include config file if it exists
|
||||
-include $(CURDIR)/config.mk
|
||||
|
||||
all: restic
|
||||
|
||||
debug: restic.debug
|
||||
|
||||
restic: $(wildcard *.go) $(wildcard ../../*.go) $(wildcard ../../*/*.go)
|
||||
go build -a
|
||||
|
||||
restic.debug: $(wildcard *.go) $(wildcard ../../*.go) $(wildcard ../../*/*.go)
|
||||
go build -a -tags debug -o restic.debug
|
||||
|
||||
clean:
|
||||
go clean
|
||||
rm -f restic restic.debug
|
||||
@@ -18,7 +18,8 @@ func init() {
|
||||
}
|
||||
|
||||
func (cmd CmdVersion) Execute(args []string) error {
|
||||
fmt.Printf("restic %s on %v\n", version, runtime.Version())
|
||||
fmt.Printf("restic %s\ncompiled at %s with %v\n",
|
||||
version, compiledAt, runtime.Version())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
var version = "compiled manually"
|
||||
var compiledAt = "unknown time"
|
||||
|
||||
type GlobalOptions struct {
|
||||
Repo string `short:"r" long:"repo" description:"Repository directory to backup to/restore from"`
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
VERSION=$(git log --max-count=1 --pretty='%ad-%h' --date=short HEAD 2>/dev/null)
|
||||
|
||||
if [ -n "$VERSION" ]; then
|
||||
if ! sh -c "git diff -s --exit-code && git diff --cached -s --exit-code"; then
|
||||
VERSION+="+"
|
||||
fi
|
||||
else
|
||||
VERSION="unknown version"
|
||||
fi
|
||||
|
||||
echo $VERSION
|
||||
Reference in New Issue
Block a user