Align shell style all over the repo
This commit is contained in:
parent
afb13d9c9c
commit
d5e71c46f7
16 changed files with 113 additions and 86 deletions
|
@ -1,4 +1,15 @@
|
|||
#!/bin/sh
|
||||
# env
|
||||
# Written in 2020 by Lucas
|
||||
# CC0 1.0 Universal/Public domain - No rights reserved
|
||||
#
|
||||
# To the extent possible under law, the author(s) have dedicated all
|
||||
# copyright and related and neighboring rights to this software to the
|
||||
# public domain worldwide. This software is distributed without any
|
||||
# warranty. You should have received a copy of the CC0 Public Domain
|
||||
# Dedication along with this software. If not, see
|
||||
# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
|
||||
usage()
|
||||
{
|
||||
printf "Usage: %s newkey\n" "${0##*/}" >&2
|
||||
|
@ -18,21 +29,21 @@ newsekrit()
|
|||
|
||||
[ $# -eq 1 ] || usage
|
||||
newkey=$1
|
||||
gpg2 -k "$newkey" >/dev/null || err "Can't find key \"$newkey\""
|
||||
gpg2 -k "$newkey" >/dev/null || err "can't find key $newkey"
|
||||
|
||||
umask 077
|
||||
newdir=$(mktemp -dt sekrit-XXXXXXXXXX) ||
|
||||
err "Failed to create temporary directory"
|
||||
err "failed to create temporary directory"
|
||||
scratch=$(mktemp -tp "$newdir" .sekrit-scratch-XXXXXXXXXX) ||
|
||||
err "Failed to create scratch file"
|
||||
err "failed to create scratch file"
|
||||
trap 'rm -fr -- "$scratch" "$newdir"' INT QUIT TERM
|
||||
|
||||
for entry in $(sekrit ls | grep -v ^DONE); do
|
||||
printf "%s... " "$entry"
|
||||
sekrit get "$entry" >|"$scratch" ||
|
||||
err "Failed to export entry \"$entry\""
|
||||
err "failed to export entry $entry"
|
||||
newsekrit add "$entry" <"$scratch" ||
|
||||
err "Failed to import entry \"$entry\""
|
||||
err "failed to import entry $entry"
|
||||
printf "OK\n"
|
||||
done
|
||||
rm -f "$scratch"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue