Initial commit

This commit is contained in:
2020-12-17 15:56:58 -08:00
commit f41b0258c6
3 changed files with 42 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
*
!/.vault
!/.vault/*

38
Makefile Normal file
View File

@@ -0,0 +1,38 @@
.PHONY: help init open close
PASSFILE := $(CURDIR)/.passfile
PASSFILE_OPT := $(shell [ -f $(PASSFILE) ] && echo "-passfile $(PASSFILE)" || echo "")
VAULT := $(CURDIR)/.vault
VIEW := $(CURDIR)/vault
CACHED := $(shell [ -f $(PASSFILE) ] && echo " [cached]" || echo "")
ISINIT := $(shell [ -d $(VAULT) ] && echo " [initialized]" || echo "")
ISOPEN := $(shell [ -d $(VIEW) ] && echo " [vault is open]" || echo "")
help: ## Display this message
@echo "Usage:$(CACHED)$(ISINIT)$(ISOPEN)" >&2
@sed -nE "s|^(.+):\\s+##\\s+(.+)\\s*$$|\\tmake \\1\\t- \\2|p" \
$(lastword $(MAKEFILE_LIST)) >&2
init: ## Initialize the vault
@if [ -d $(VAULT) ]; then \
echo "Vault has already been initialized" >&2; \
echo "Remove $(VAULT) to re-initialize" >&2; \
else \
mkdir -m700 $(VAULT); \
gocryptfs -init -aessiv $(PASSFILE_OPT) $(VAULT); \
fi
open: ## Open the vault
@if [ -d $(VAULT) ] && [ ! -d $(VIEW) ]; then \
mkdir -m700 $(VIEW); \
gocryptfs -quiet $(PASSFILE_OPT) $(VAULT) $(VIEW); \
fi
@echo "Vault is open" >&2
close: ## Close the vault
@if [ -d $(VAULT) ] && [ -d $(VIEW) ]; then \
fusermount -u $(VIEW); \
rmdir $(VIEW); \
fi
@echo "Vault is closed" >&2

1
README.md Normal file
View File

@@ -0,0 +1 @@
# Vault