mirror of
https://github.com/shokinn/.files.git
synced 2025-01-18 21:22:25 +00:00
fix script itself
This commit is contained in:
parent
240e01257d
commit
c2e5c2295d
|
@ -11,8 +11,18 @@ set -euf -o pipefail
|
||||||
# age encryption / decryption helpers
|
# age encryption / decryption helpers
|
||||||
# based on https://git.sr.ht/~digital/secretFiles
|
# 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 for age file to encrypt with
|
||||||
get-recipients-list() {
|
get-recipients-list() {
|
||||||
local target="${1}"
|
local target="${1}"
|
||||||
|
@ -75,7 +85,7 @@ edit-file() {
|
||||||
|
|
||||||
local working_directory="${2:-$(pwd)}"
|
local working_directory="${2:-$(pwd)}"
|
||||||
local secret_path="${working_directory}/${1}"
|
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 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")}"
|
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 working_directory="${2:-$(pwd)}"
|
||||||
local identity="${1:-/dev/stdin}"
|
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
|
# make the identity file reuseable, in case it actually is /dev/stdin
|
||||||
umask 177
|
umask 177
|
||||||
|
|
|
@ -20,9 +20,6 @@ export ANSIBLE_NOCOWS=1
|
||||||
# Include $(go env GOPATH) to PATH
|
# Include $(go env GOPATH) to PATH
|
||||||
[[ $(command -v go) ]] && [[ -d "$(go env GOPATH)/bin" ]] && export PATH="$(go env GOPATH)/bin:${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' @@%}
|
{%@@ if profile == 'AINCRAD-wsl' or profile == 'AINCRAD' or profile == 'YOETUNHEIMR-wsl' or profile == 'yoetunheimr' or profile == 'ymir' @@%}
|
||||||
# Connect to windows ssh pageant
|
# Connect to windows ssh pageant
|
||||||
# https://github.com/BlackReloaded/wsl2-ssh-pageant
|
# https://github.com/BlackReloaded/wsl2-ssh-pageant
|
||||||
|
|
|
@ -199,9 +199,6 @@ export PATH="${brew_path}:${PATH}"
|
||||||
# Functions (or more complex aliases)
|
# Functions (or more complex aliases)
|
||||||
source {{@@ env['HOME'] @@}}/.commonfunc
|
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' @@%}
|
{%@@ if profile == 'ymir' @@%}
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
zstyle ':completion:*' menu select
|
zstyle ':completion:*' menu select
|
||||||
|
|
Loading…
Reference in a new issue