diff --git a/config.yaml b/config.yaml index 65dc1fd..2b1da08 100644 --- a/config.yaml +++ b/config.yaml @@ -3,7 +3,8 @@ config: create: true dotpath: dotfiles variables: - ageidentity: ${{HOME}}/.age/phg-age-dotfiles + ageidentity: "{{@@ env['HOME'] @@}}/.age/phg-age-dotfiles" + ageidentity_pub: "{{@@ ageidentity@@}}.pub" SHELL_ERR_MESSAGE: \033[41;30m SHELL_RESET_COLOR: \033[0m trans_install: @@ -11,7 +12,7 @@ trans_install: [[ -f {{@@ ageidentity @@}} ]] && age --decrypt -i {{@@ ageidentity @@}} -o {1} {0} || ([[ ! -f {{@@ _dotfile_abs_dst @@}} ]] && (echo "{{@@ SHELL_ERR_MESSAGE @@}}Missing age identity file {{@@ ageidentity @@}}, cannot decrypt {0}, creating empty file instead{{@@ SHELL_RESET_COLOR @@}}"; echo "" > {1}) || (echo "{{@@ SHELL_ERR_MESSAGE @@}}Missing age identity file {{@@ ageidentity @@}}, cannot decrypt {0}{{@@ SHELL_RESET_COLOR @@}}"; cp {{@@ _dotfile_abs_dst @@}} {1})) trans_update: _encrypt: | - [[ -f {{@@ ageidentity @@}}.pub ]] && cat {0} | age -a -R {{@@ ageidentity @@}}.pub > {1} || echo "{{@@ SHELL_ERR_MESSAGE @@}}Missing age identity file {{@@ ageidentity @@}}.pub, cannot encrypt {0}{{@@ SHELL_RESET_COLOR @@}}" + [[ -f {{@@ ageidentity_pub @@}} ]] && cat {0} | age -a -R {{@@ ageidentity_pub @@}} > {1} || echo "{{@@ SHELL_ERR_MESSAGE @@}}Missing age identity file {{@@ ageidentity_pub @@}}, cannot encrypt {0}{{@@ SHELL_RESET_COLOR @@}}" actions: oh-my-zsh: | [[ ! -d ${{HOME}}/.oh-my-zsh ]] && sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" "" --unattended || echo "do nothing" >/dev/null diff --git a/dotfiles/commonfunc b/dotfiles/commonfunc index 822e760..5a7add3 100644 --- a/dotfiles/commonfunc +++ b/dotfiles/commonfunc @@ -148,6 +148,61 @@ zi () { __zoxide_zi "$@" } +####################################### +# Runs dotdrop installed by uv with the cfg option set to my dotdrop config file in my .files repo +# Globals: +# None +# Arguments: +# n arguments for using / configuring dotdrop +# Outputs: +# None +# Returns: +# None +####################################### +dotdrop() { + {{@@ env['HOME'] @@}}/.local/bin/dotdrop --cfg={{@@ env['HOME'] @@}}/.files/config.yaml ${@} +} + +####################################### +# Age encryption for my dotfiles. +# Globals: +# None +# Arguments: +# - source file (unencrypted) +# - target file (encrypted) +# Outputs: +# age encrypted file +# Returns: +# None +####################################### +adenc() { + if [ -z "${1}" ] || [ -z "${2}" ]; then + echo "Usage: adencrypt " + return 1 + fi + age -a -R {{@@ ageidentity_pub @@}} -o "${2}" "${1}" +} + +####################################### +# Age decryption for my dotfiles. +# Globals: +# None +# Arguments: +# - source file (encrypted) +# - target file (unencrypted) +# Outputs: +# age decrypted file +# Returns: +# None +####################################### +addec() { + if [ -z "${1}" ] || [ -z "${2}" ]; then + echo "Usage: addecrypt " + return 1 + fi + age -d -i {{@@ ageidentity @@}} -o "${2}" "${1}" +} + {%@@ if distro == 'macos' @@%} ####################################### # Shows a netstat -tulpn styled output on mac. @@ -360,21 +415,6 @@ confv6() { return 5 } -####################################### -# Runs dotdrop installed by uv with the cfg option set to my dotdrop config file in my .files repo -# Globals: -# None -# Arguments: -# n arguments for using / configuring dotdrop -# Outputs: -# None -# Returns: -# None -####################################### -dotdrop() { - {{@@ env['HOME'] @@}}/.local/bin/dotdrop --cfg={{@@ env['HOME'] @@}}/.files/config.yaml ${@} -} - {%@@ endif @@%}{%@@ if vw == true @@%} setProxyEnv() { local HIGHLIGHT='\033[36;1m'