mirror of https://github.com/ericonr/get-otp.git
Create initial encryption script.
This commit is contained in:
parent
2f1a62265c
commit
fa759a0c4b
|
@ -1,2 +1,3 @@
|
||||||
cbc-file
|
cbc-file
|
||||||
get-otp
|
get-otp
|
||||||
|
encrypt-otp
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/sh
|
||||||
|
dest="${OTP_ACCOUNTS:-$HOME/.local/share/otp_accounts}"
|
||||||
|
file="$1"
|
||||||
|
|
||||||
|
if [ ! -e "$file" ]; then
|
||||||
|
echo "'$file' doesn't exist!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if @PREFIX@/libexec/cbc-file lock "$file" > "$dest"; then
|
||||||
|
echo "'$dest' successfully generated!"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "couldn't create '$dest'"
|
||||||
|
exit 1
|
||||||
|
fi
|
10
makefile
10
makefile
|
@ -3,11 +3,13 @@ LDLIBS = -lbearssl -largon2
|
||||||
OPT = -O2
|
OPT = -O2
|
||||||
CFLAGS = -std=c99 $(OPT) -Wall -Wextra -Werror=implicit -pedantic
|
CFLAGS = -std=c99 $(OPT) -Wall -Wextra -Werror=implicit -pedantic
|
||||||
|
|
||||||
SCRIPT = get-otp
|
SCRIPT = get-otp encrypt-otp
|
||||||
|
|
||||||
all: $(EXE) $(SCRIPT)
|
all: $(EXE) $(SCRIPT)
|
||||||
|
|
||||||
$(SCRIPT): $(SCRIPT).in
|
get-otp: get-otp.in
|
||||||
|
encrypt-otp: encrypt-otp.in
|
||||||
|
%: %.in
|
||||||
sed -e 's|@PREFIX@|$(PREFIX)|' $^ > $@
|
sed -e 's|@PREFIX@|$(PREFIX)|' $^ > $@
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
|
@ -15,3 +17,7 @@ install: all
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/libexec
|
mkdir -p $(DESTDIR)$(PREFIX)/libexec
|
||||||
install -Dm755 cbc-file $(DESTDIR)$(PREFIX)/libexec/
|
install -Dm755 cbc-file $(DESTDIR)$(PREFIX)/libexec/
|
||||||
install -Dm755 get-otp $(DESTDIR)$(PREFIX)/bin/
|
install -Dm755 get-otp $(DESTDIR)$(PREFIX)/bin/
|
||||||
|
install -Dm755 encrypt-otp $(DESTDIR)$(PREFIX)/bin/
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(EXE) $(SCRIPT)
|
||||||
|
|
Loading…
Reference in New Issue