X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=filesystem%2Fetc%2Fprofile.d%2Fenvironment.sh;h=6191cb7eaf3c1958c9d832668f6cbc60a583f530;hb=5cb8fc0c2a8a3f9ffa3cb4d376075c1217eb6d8c;hp=f44175267fa78a7175d97ec6780820165861cb81;hpb=103a2e153f844343c359882079936b2521c82f15;p=distro-setup diff --git a/filesystem/etc/profile.d/environment.sh b/filesystem/etc/profile.d/environment.sh index f441752..6191cb7 100644 --- a/filesystem/etc/profile.d/environment.sh +++ b/filesystem/etc/profile.d/environment.sh @@ -77,8 +77,9 @@ if [ -f /etc/fedora-release ]; then fi fi -# and broken again. see /usr/lib/systemd/user-environment-generators/90gpg-agent -export GPG_AGENT_INFO=$XDG_RUNTIME_DIR/gnupg/S.gpg-agent:0:1 +# 2020: and broken again. see /usr/lib/systemd/user-environment-generators/90gpg-agent. +# 2022: not sure exactly what this fixed, but gpg seems to work now without it. +#export GPG_AGENT_INFO=$XDG_RUNTIME_DIR/gnupg/S.gpg-agent:0:1 # and now trisquel9 + mate + i3 has broken ssh agent. I've had to fix # ssh or gpg agent like 10 times in different distros, and once again, i @@ -98,7 +99,7 @@ export GPG_AGENT_INFO=$XDG_RUNTIME_DIR/gnupg/S.gpg-agent:0:1 # if systemctl --user show-environment >$_sysenv 2>/dev/null; then # grep -o '^[^=]*' $_sysenv | sort > $_sysenvnames # env -0 | grep -zo '^[^=]*' | xargs -0 printf "%s\n" | sort | \ -# comm --nocheck-order -13 - $_sysenvnames >$_unsetnames + # comm --nocheck-order -13 - $_sysenvnames >$_unsetnames # while read -r unsetname; do # while read -r sysenv; do # case "$sysenv" in @@ -110,27 +111,33 @@ export GPG_AGENT_INFO=$XDG_RUNTIME_DIR/gnupg/S.gpg-agent:0:1 # fi # fi -# and it seems that if we log into mate, it screws up the systemd env var anyways. -for _file in $(pgrep -a '^ssh-agent$' | sed -r 's/.*-a *([^ ]+).*/\1/'); do - if test -O "$_file"; then - export SSH_AUTH_SOCK="$_file" - break - fi -done - -# in t11, user ssh-agent once again stopped working, it isn't started anymore -# by i3. So, enough is enough, I just made a service that will try to -# start it all the time for the user. If the var isn't set by the above, -# just set them to the values I know are in the service. -if ! test "$SSH_AUTH_SOCK"; then - if [ "$EUID" = 0 ]; then - export SSH_AUTH_SOCK=/run/openssh_agent - else - export SSH_AUTH_SOCK=/run/user/1000/openssh_agent + +# i use the x11 prompt for ssh key use which doesnt work +# within an ssh session (perhaps there is some way). +# Anyways, there is usually no need for an agent to +# do a 1-off ssh from a remote machine. +if ! test "$SSH_CLIENT"; then + # and it seems that if we log into mate, it screws up the systemd env var anyways. + for _file in $(pgrep -a '^ssh-agent$' | sed -r 's/.*-a *([^ ]+).*/\1/'); do + if test -O "$_file"; then + export SSH_AUTH_SOCK="$_file" + break + fi + done + + # in t11, user ssh-agent once again stopped working, it isn't started anymore + # by i3. So, enough is enough, I just made a service that will try to + # start it all the time for the user. If the var isn't set by the above, + # just set them to the values I know are in the service. + if ! test "$SSH_AUTH_SOCK"; then + if [ "$EUID" = 0 ]; then + export SSH_AUTH_SOCK=/run/openssh_agent + elif [ "$EUID" = 1000 ]; then + export SSH_AUTH_SOCK=$HOME/openssh_agent + fi fi fi - # background: # ubuntu has 002 for non-system users, debian has 022. 002 makes groups # be rw instead of r.