Rafael Calleja commited on
Commit ·
17f28ae
1
Parent(s): 3b540d4
add makefile
Browse files
Makefile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
REPOSITORY ?= github.com/rafaelcalleja/distrostore
|
| 2 |
+
GOPASS_FILE ?= .autorestic.yml
|
| 3 |
+
GOPASS_KEY ?= $(REPOSITORY)/$(GOPASS_FILE)
|
| 4 |
+
CURRENT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
| 5 |
+
COMMIT_MESSAGE ?= $(shell date)
|
| 6 |
+
|
| 7 |
+
RESTORE_DST ?= /tmp/restore
|
| 8 |
+
RESTORE_FROM ?= hdd
|
| 9 |
+
RESTORE_LOCATION ?= root_backup
|
| 10 |
+
|
| 11 |
+
default: backup
|
| 12 |
+
|
| 13 |
+
backup:
|
| 14 |
+
time autorestic -c $(CURRENT_DIR)/$(GOPASS_FILE) backup -a && \
|
| 15 |
+
git add -A && \
|
| 16 |
+
git commit -m "$(COMMIT_MESSAGE)" && \
|
| 17 |
+
git push
|
| 18 |
+
|
| 19 |
+
restore:
|
| 20 |
+
cd $(RESTORE_DST); time autorestic restore --from $(RESTORE_FROM) -l $(RESTORE_LOCATION) -c $(CURRENT_DIR)/$(GOPASS_FILE)
|
| 21 |
+
|
| 22 |
+
save:
|
| 23 |
+
gopass insert -f $(GOPASS_KEY) < $(GOPASS_FILE)
|
| 24 |
+
|
| 25 |
+
load:
|
| 26 |
+
gopass show $(GOPASS_KEY) >$(GOPASS_FILE)
|