From 507d06d9d5f1df6f0db90d81c167177981b08e96 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Fri, 5 Nov 2021 22:20:47 +0100 Subject: better way to do pinentry --- .gnupg/gpg-agent.conf | 1 + .gnupg/pinentry-dmenu.conf | 2 ++ .zshrc | 2 -- arch/mainline | 2 +- build | 86 +++++++++++++++++++++++++--------------------- dwm/config.h | 2 -- scripts/pinentry-auto | 8 +++++ 7 files changed, 59 insertions(+), 44 deletions(-) create mode 100644 .gnupg/gpg-agent.conf create mode 100644 .gnupg/pinentry-dmenu.conf create mode 100755 scripts/pinentry-auto diff --git a/.gnupg/gpg-agent.conf b/.gnupg/gpg-agent.conf new file mode 100644 index 0000000..5ad6f0c --- /dev/null +++ b/.gnupg/gpg-agent.conf @@ -0,0 +1 @@ +pinentry-program /home/tom/bin/pinentry-auto diff --git a/.gnupg/pinentry-dmenu.conf b/.gnupg/pinentry-dmenu.conf new file mode 100644 index 0000000..b9272a7 --- /dev/null +++ b/.gnupg/pinentry-dmenu.conf @@ -0,0 +1,2 @@ +font = "Hermit-Regular:size=11"; +min_password_length = "24"; diff --git a/.zshrc b/.zshrc index ce58bdd..e0b9c6e 100644 --- a/.zshrc +++ b/.zshrc @@ -78,7 +78,5 @@ autoload -Uz vcs_info precmd() { vcs_info } zstyle ':vcs_info:git:*' formats '|%F{3}%b%f' -gpg-connect-agent updatestartuptty /bye > /dev/null - setopt PROMPT_SUBST PROMPT='<%F{2}%n%f@%F{6}%m%f|%F{5}%~%f${vcs_info_msg_0_}%f> ' diff --git a/arch/mainline b/arch/mainline index c3b7148..454d952 100644 --- a/arch/mainline +++ b/arch/mainline @@ -5,7 +5,6 @@ automake base bc cmake -connman dmenu dosfstools efibootmgr @@ -19,6 +18,7 @@ gparted grub htop ledger +libconfig linux linux-firmware make diff --git a/build b/build index a273659..a8e38e9 100755 --- a/build +++ b/build @@ -1,91 +1,99 @@ #!/usr/bin/env bash # var setup -RC_DIR=$HOME'/src/rc' +RC_DIR="$HOME/src/rc" # bin directory -mkdir $HOME/bin +mkdir "$HOME/bin" # dwm setup -DWM_DIR=$HOME'/src/dwm' -git clone https://git.tombarrett.xyz/tom/dwm $DWM_DIR +DWM_DIR="$HOME/src/dwm" +git clone https://git.tombarrett.xyz/tom/dwm "$DWM_DIR" -patch $DWM_DIR'/dwm.c' $RC_DIR'/dwm/custom.diff' +patch "$DWM_DIR/dwm.c" "$RC_DIR/dwm/custom.diff" -ln -s $RC_DIR'/dwm/config.h' $DWM_DIR +ln -s "$RC_DIR/dwm/config.h" "$DWM_DIR" -make -C $DWM_DIR +make -C "$DWM_DIR" -ln -s $DWM_DIR/dwm $HOME/bin +ln -s "$DWM_DIR/dwm" "$HOME/bin" # dwmstatus setup -DWMSTS_DIR=$HOME'/src/dwmstatus' -git clone https://git.tombarrett.xyz/tom/dwmstatus $DWMSTS_DIR +DWMSTS_DIR="$HOME/src/dwmstatus" +git clone https://git.tombarrett.xyz/tom/dwmstatus "$DWMSTS_DIR" -patch $DWMSTS_DIR'/dwmstatus.c' $RC_DIR'/dwmstatus/custom.diff' +patch "$DWMSTS_DIR/dwmstatus.c" "$RC_DIR/dwmstatus/custom.diff" -make -C $DWMSTS_DIR +make -C "$DWMSTS_DIR" -ln -s $DWMSTS_DIR/dwmstatus $HOME/bin +ln -s "$DWMSTS_DIR/dwmstatus" "$HOME/bin" # st setup -ST_DIR=$HOME'/src/st' -git clone https://git.tombarrett.xyz/tom/st $ST_DIR +ST_DIR="$HOME/src/st" +git clone https://git.tombarrett.xyz/tom/st "$ST_DIR" -ln -s $RC_DIR'/st/config.h' $ST_DIR +ln -s "$RC_DIR/st/config.h" "$ST_DIR" -make -C $ST_DIR +make -C "$ST_DIR" -ln -s $ST_DIR/st $HOME/bin +ln -s "$ST_DIR/st" "$HOME/bin" -# connmenu setup -CM_DIR=$HOME'/src/connmenu' -git clone https://git.tombarrett.xyz/tom/connmenu $CM_DIR +# pinentry-dmenu setup +PE_DIR="$HOME/src/pinentry-dmenu" +git clone https://git.tombarrett.xyz/tom/st "$PE_DIR" -ln -s $CM_DIR/connmenu $HOME/bin +make -C "$PE_DIR" + +ln -s "$PE_DIR/pinentry-dmenu" "$HOME/bin" # wallpapers setup -mkdir -p $HOME'/personal' -git clone https://git.tombarrett.xyz/tom/wallpapers $HOME'/personal/wallpapers' +mkdir -p "$HOME/personal" +git clone https://git.tombarrett.xyz/tom/wallpapers "$HOME/personal/wallpapers" -mkdir -p $HOME'/.config/' +mkdir -p "$HOME/.config/" # zsh setup -ln -s $RC_DIR'/.zshrc' $HOME +ln -s "$RC_DIR/.zshrc" "$HOME" # freedesktop setup -ln -s $RC_DIR'/.config/user-dirs.dirs' $HOME'/.config/' +ln -s "$RC_DIR/.config/user-dirs.dirs" "$HOME/.config/" # ranger setup -ln -s $RC_DIR'/.config/ranger' $HOME'/.config/' +ln -s "$RC_DIR/.config/ranger" "$HOME/.config/" # stig setup -ln -s $RC_DIR'/.config/stig' $HOME'/.config/' +ln -s "$RC_DIR/.config/stig" "$HOME/.config/" # ncmpcpp setup -ln -s $RC_DIR'/.config/ncmpcpp' $HOME'/.config/' +ln -s "$RC_DIR/.config/ncmpcpp" "$HOME/.config/" # xorg setup -ln -s $RC_DIR'/.xinitrc' $HOME +ln -s "$RC_DIR/.xinitrc" "$HOME" # autostart script -ln -s $RC_DIR'/.autostart' $HOME +ln -s "$RC_DIR/.autostart" "$HOME" # git setup -ln -s $RC_DIR'/.gitconfig' $HOME +ln -s "$RC_DIR/.gitconfig" "$HOME" # neomutt setup -ln -s $RC_DIR'/.muttrc' $HOME -ln -s $RC_DIR'/.mailcap' $HOME +ln -s "$RC_DIR/.muttrc" "$HOME" +ln -s "$RC_DIR/.mailcap" "$HOME" # taskwarrior setup -ln -s $RC_DIR'/.taskrc' $HOME -ln -s $RC_DIR'/.task' $HOME +ln -s "$RC_DIR/.taskrc" "$HOME" +ln -s "$RC_DIR/.task" "$HOME" # xscreensaver setup -ln -s $RC_DIR'/.xscreensaver' $HOME +ln -s "$RC_DIR/.xscreensaver" "$HOME" # pam setup -ln -s $RC_DIR'/.pam_environment' $HOME +ln -s "$RC_DIR/.pam_environment" "$HOME" + +# gpg setup +mkdir -p "$HOME/.gnupg" +ln -s "$RC_DIR/.gnupg/gpg-agent.conf" "$HOME/.gnupg/" +ln -s "$RC_DIR/.gnupg/pinentry-dmenu.conf" "$HOME/.gnupg/" +ln -s "$RC_DIR/scripts/pinentry-auto" "$HOME/bin" echo "use gpg --list-secret-keys --with-keygrip, write the [A] keygrip to .gnupg/sshcontrol" diff --git a/dwm/config.h b/dwm/config.h index f715cd8..de2fe8d 100644 --- a/dwm/config.h +++ b/dwm/config.h @@ -58,7 +58,6 @@ static const Layout layouts[] = { static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col, "-sf", col_gray4, NULL }; static const char *passmenucmd[] = { "passmenu", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col, "-sf", col_gray4, NULL }; -static const char *connmenucmd[] = { "connmenu", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col, "-sf", col_gray4, NULL }; static const char *volumeupcmd[] = { "amixer", "sset", "Master", "5%+", NULL }; static const char *volumedowncmd[] = { "amixer", "sset", "Master", "5%-", NULL }; static const char *termcmd[] = { "st", NULL }; @@ -68,7 +67,6 @@ static Key keys[] = { { MODKEY, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_d, spawn, {.v = dmenucmd } }, { MODKEY, XK_c, spawn, {.v = passmenucmd } }, - { MODKEY, XK_w, spawn, {.v = connmenucmd } }, { MODKEY, XK_equal, spawn, {.v = volumeupcmd } }, { MODKEY, XK_minus, spawn, {.v = volumedowncmd } }, diff --git a/scripts/pinentry-auto b/scripts/pinentry-auto new file mode 100755 index 0000000..4b90cc1 --- /dev/null +++ b/scripts/pinentry-auto @@ -0,0 +1,8 @@ +#!/bin/sh +set -Ceu + +if ps -e | grep -q X; then + /home/"$USER"/bin/pinentry-dmenu "$@" +else + pinentry-curses "$@" +fi -- cgit v1.2.3