fix script itself

This commit is contained in:
Philip Henning 2024-01-11 22:38:01 +01:00
parent 240e01257d
commit c2e5c2295d
3 changed files with 12 additions and 8 deletions

View file

@ -11,8 +11,18 @@ set -euf -o pipefail
# age encryption / decryption helpers
# based on https://git.sr.ht/~digital/secretFiles
#
# For macOS coreutils and gnu-getopt are required to
# run this script.
# brew install coreutils gnu-getopt
#
#---------------------------------------------------
#TMPPATH="/dev/shm"
TMPPATH="/tmp"
[[ -d "/opt/homebrew/opt/coreutils/libexec/gnubin" ]] && export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:${PATH}"
[[ -d "/opt/homebrew/opt/gnu-getopt/bin" ]] && export PATH="/opt/homebrew/opt/gnu-getopt/bin:${PATH}"
# get recipients for age file to encrypt with
get-recipients-list() {
local target="${1}"
@ -75,7 +85,7 @@ edit-file() {
local working_directory="${2:-$(pwd)}"
local secret_path="${working_directory}/${1}"
local tmp_path="$(mktemp -p /dev/shm)"
local tmp_path="$(mktemp -p ${TMPPATH})"
local recipients_list=$(get-recipients-list "${secret_path}")
local identity="${MASTERKEY_FILE:-$([[ -f "$(realpath "${working_directory}/secrets/hostkeys/masterkey.privkey")" ]] && echo -n "$(realpath "${working_directory}/secrets/hostkeys/masterkey.privkey")" || echo -n "/dev/stdin")}"
@ -120,7 +130,7 @@ reencrypt-all() {
local working_directory="${2:-$(pwd)}"
local identity="${1:-/dev/stdin}"
local identity_file="$(mktemp -u -p /dev/shm)"
local identity_file="$(mktemp -u -p ${TMPPATH})"
# make the identity file reuseable, in case it actually is /dev/stdin
umask 177

View file

@ -20,9 +20,6 @@ export ANSIBLE_NOCOWS=1
# Include $(go env GOPATH) to PATH
[[ $(command -v go) ]] && [[ -d "$(go env GOPATH)/bin" ]] && export PATH="$(go env GOPATH)/bin:${PATH}"
# Include /opt/homebrew/opt/gnu-getopt/bin to PATH
[[ -d "/opt/homebrew/opt/gnu-getopt/bin" ]] && export PATH="/opt/homebrew/opt/gnu-getopt/bin:${PATH}"
{%@@ if profile == 'AINCRAD-wsl' or profile == 'AINCRAD' or profile == 'YOETUNHEIMR-wsl' or profile == 'yoetunheimr' or profile == 'ymir' @@%}
# Connect to windows ssh pageant
# https://github.com/BlackReloaded/wsl2-ssh-pageant

View file

@ -199,9 +199,6 @@ export PATH="${brew_path}:${PATH}"
# Functions (or more complex aliases)
source {{@@ env['HOME'] @@}}/.commonfunc
# Include /opt/homebrew/opt/gnu-getopt/bin to PATH
[[ -d "/opt/homebrew/opt/gnu-getopt/bin" ]] && export PATH="/opt/homebrew/opt/gnu-getopt/bin:${PATH}"
{%@@ if profile == 'ymir' @@%}
autoload -Uz compinit
zstyle ':completion:*' menu select