X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=filesystem%2Fetc%2Fprofile.d%2Fenvironment.sh;h=42513fa5753968109e65e8406da2ce9d1ee24509;hb=f46ee5570766081a5a73ce0d2132c8a06ee966fb;hp=9e4feef6a732f8c93227d01794737e7f3f3a86a6;hpb=602a1874cc11a7d371890cdae4c0dc982267ea89;p=distro-setup diff --git a/filesystem/etc/profile.d/environment.sh b/filesystem/etc/profile.d/environment.sh index 9e4feef..42513fa 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 @@ -90,24 +91,26 @@ export GPG_AGENT_INFO=$XDG_RUNTIME_DIR/gnupg/S.gpg-agent:0:1 # but not override existing things because theres stuff like PWD. This # doesn't set SSH_AGENT_PID, but apparently its not needed anymore. # Note: what a huge pita to write this in posix shell. -if test "$EUID" && [ "$EUID" != 0 ]; then - _sysenv=$(mktemp) - _sysenvnames=$(mktemp) - _unsetnames=$(mktemp) - 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 - while read -r unsetname; do - while read -r sysenv; do - case "$sysenv" in - "$unsetname"*) eval export "$sysenv" ;; - esac - done < $_sysenv - done < $_unsetnames - rm -f $_tmpf - fi -fi +# update: disabled this hackery since I'm not using it in t11 +# if test "$EUID" && [ "$EUID" != 0 ]; then +# _sysenv=$(mktemp) +# _sysenvnames=$(mktemp) +# _unsetnames=$(mktemp) +# 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 +# while read -r unsetname; do +# while read -r sysenv; do +# case "$sysenv" in +# "$unsetname"*) eval export "$sysenv" ;; +# esac +# done < $_sysenv +# done < $_unsetnames +# rm -f $_tmpf +# 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 @@ -121,10 +124,10 @@ done # 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 + if [ "$EUID" = 0 ]; then export SSH_AUTH_SOCK=/run/openssh_agent - else - export SSH_AUTH_SOCK=/run/user/1000/openssh_agent + elif [ "$EUID" = 1000 ]; then + export SSH_AUTH_SOCK=$HOME/openssh_agent fi fi