From 8db6afe8b95781e8a05c2aa13e3a72cdb7209c6e Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Tue, 14 Nov 2017 09:57:21 +0100 Subject: [PATCH] Add 'make backup' dev helper --- .gitignore | 3 ++- Makefile | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5c67e98..91db390 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /sshportal -*.db \ No newline at end of file +*.db +/data \ No newline at end of file diff --git a/Makefile b/Makefile index 96be17c..2f504c7 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ GIT_SHA ?= $(shell git rev-parse HEAD) GIT_TAG ?= $(shell git describe --tags --always) GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) LDFLAGS ?= -X main.GIT_SHA=$(GIT_SHA) -X main.GIT_TAG=$(GIT_TAG) -X main.GIT_BRANCH=$(GIT_BRANCH) +VERSION ?= $(shell grep 'VERSION =' main.go | cut -d'"' -f2) .PHONY: install install: @@ -20,3 +21,8 @@ dev: test: go test -i . go test -v . + +.PHONY: backup +backup: + mkdir -p data/backups + cp sshportal.db data/backups/$(shell date +%s)-$(VERSION)-sshportal.sqlite