3 # Exports here get inherited by X, that is the only reason to do things
4 # here. However, they do not get sent with sl().
6 if [ -f $HOME/path-add-function
]; then
7 .
$HOME/path-add-function
8 path-add
/usr
/sbin
/usr
/local
/sbin
/a
/exe
/a
/opt
/bin
9 # if usr merge, dont need it
10 if [[ ! -L /sbin
]]; then
13 path-add
--end $HOME/.cabal
/bin
14 path-add
--end /snap
/bin
17 # ~/.local is newer, eg ruby 3.0+
18 for p
in $HOME/.gem
/ruby
/*/bin
$HOME/.local
/share
/gem
/ruby
/*/bin
; do
19 path-add
--ifexists --end $p
22 if [ -r /etc
/alternatives
/java_sdk
]; then
23 export JAVA_HOME
=/etc
/alternatives
/java_sdk
24 path-add
/etc
/alternatives
/java_sdk
27 export GUIX_PROFILE
=/root
/.config
/guix
/current
28 if [ -f $GUIX_PROFILE/etc
/profile
]; then
29 .
$GUIX_PROFILE/etc
/profile
31 path-add
$HOME/.guix-profile
/bin
32 export GUIX_LOCPATH
=$HOME/.guix-profile
/lib
/locale
37 export EDITOR
="emacsclient"
38 # this makes emacsclient file/-c start a server instance if none is running,
39 # instead of some alternate editor logic
40 export ALTERNATE_EDITOR
=""
42 export PITHOSFLY_SAVE_DIR
=/a
/pandora_rips4
44 # makes subsequent syscalls to localtime use cached timezone,
45 # so basically restart the comp if you change time zones,
46 # and avoid a few syscalls, which makes a tiny tiny perf difference.
48 # /a/c/filesystem/etc/systemd/system.conf.d/tz.conf
49 # https://blog.packagecloud.io/eng/2017/02/21/set-environment-variable-save-thousands-of-system-calls/
50 export TZ
=:/etc
/localtime
52 # ubuntu starts gpg agent automatically with /etc/X11/Xsession.d/90gpg-agent.
53 # fedora doesn't, which left me to figure this out, and google was no help.
54 # fedora documentation is often quite bad :(
55 # This is mostly copied from that file.
56 # Main difference is that we eval the result of starting gpg-agent,
57 # while that file executes it through xsession specific var.
58 # Also make sourcing the pidfile make more sense.
59 # End result should be the same afaik.
60 # for gpg-agent to work when calling gpg from the command line,
61 # we need an environment variable that is setup via the eval.
62 # which is why we do this upon login, so it can propogate
63 # It is also written to the file $HOME/.gnupg/gpg-agent-info-$(hostname)
64 # I'm not aware if that is ever used, but just fyi.
65 # I also added the bit about xmessaging the stderr,
66 # because I'd like to know if the command fails
67 if [ -f /etc
/fedora-release
]; then
68 : ${GNUPGHOME=$HOME/.gnupg}
70 GPGAGENT
=/usr
/bin
/gpg-agent
71 PID_FILE
="$GNUPGHOME/gpg-agent-info-$(hostname)"
73 if ! $GPGAGENT 2>/dev
/null
; then
75 eval "$($GPGAGENT --homedir /p/do-not-delete --daemon --sh --write-env-file=$PID_FILE 2>$temp)"
76 temperr
="$(cat "$temp")"
77 [ -n "$temperr" ] && xmessage
"gpg-agent stderr: $temperr"
78 elif [ -r "$PID_FILE" ]; then
84 # 2020: and broken again. see /usr/lib/systemd/user-environment-generators/90gpg-agent.
85 # 2022: not sure exactly what this fixed, but gpg seems to work now without it.
86 #export GPG_AGENT_INFO=$XDG_RUNTIME_DIR/gnupg/S.gpg-agent:0:1
88 # and now trisquel9 + mate + i3 has broken ssh agent. I've had to fix
89 # ssh or gpg agent like 10 times in different distros, and once again, i
90 # randomly figured out this hack because there is no documentation. ssh
91 # agent is started by a systemd service, which runs a wrapper script,
92 # which adds env vars with some dbus thing. This is too much of a pita
93 # to make work in ash/posix. I could just export the agent relevant
94 # vars, but it seems like its better to just get whatever is missing,
95 # but not override existing things because theres stuff like PWD. This
96 # doesn't set SSH_AGENT_PID, but apparently its not needed anymore.
97 # Note: what a huge pita to write this in posix shell.
98 # update: disabled this hackery since I'm not using it in t11
99 # if test "$EUID" && [ "$EUID" != 0 ]; then
101 # _sysenvnames=$(mktemp)
102 # _unsetnames=$(mktemp)
103 # if systemctl --user show-environment >$_sysenv 2>/dev/null; then
104 # grep -o '^[^=]*' $_sysenv | sort > $_sysenvnames
105 # env -0 | grep -zo '^[^=]*' | xargs -0 printf "%s\n" | sort | \
106 # comm --nocheck-order -13 - $_sysenvnames >$_unsetnames
107 # while read -r unsetname; do
108 # while read -r sysenv; do
110 # "$unsetname"*) eval export "$sysenv" ;;
113 # done < $_unsetnames
119 # i use the x11 prompt for ssh key use which doesnt work
120 # within an ssh session (perhaps there is some way).
121 # Anyways, there is usually no need for an agent to
122 # do a 1-off ssh from a remote machine.
123 if ! test "$SSH_CLIENT"; then
124 # and it seems that if we log into mate, it screws up the systemd env var anyways.
125 for _file
in $
(pgrep
-a '^ssh-agent$' |
sed -r 's/.*-a *([^ ]+).*/\1/'); do
126 if test -O "$_file"; then
127 export SSH_AUTH_SOCK
="$_file"
132 # in t11, user ssh-agent once again stopped working, it isn't started anymore
133 # by i3. So, enough is enough, I just made a service that will try to
134 # start it all the time for the user. If the var isn't set by the above,
135 # just set them to the values I know are in the service.
136 if ! test "$SSH_AUTH_SOCK"; then
137 if [ "$EUID" = 0 ]; then
138 export SSH_AUTH_SOCK
=/run
/openssh_agent
139 elif [ "$EUID" = 1000 ]; then
140 export SSH_AUTH_SOCK
=$HOME/openssh_agent
146 # ubuntu has 002 for non-system users, debian has 022. 002 makes groups
147 # be rw instead of r.
149 # I think the actual setting is somewhere in the pam settings, I haven't
150 # bothered to figure that out.
152 # ubuntu is more user friendly when using multiple users. However,
153 # it also makes it so if you create a file as a regular user then move
154 # it to become a system file, it's got slightly wrong permissions, and
155 # sometimes thing break. Also, copying files between ubuntu and debian
156 # makes things inconsistent. So stick with 022 umask always.
158 # One security concern is where some unixes put every user in a same
159 # group, so if you copy files there with exact perms, that is probably
160 # not what you want. I don't use a system like that, so I don't
163 # Note: duplicated in .bashrc
165 # this is how we could test for non-system user
167 #if test "$(id -u)" -ge 1000; then : fi