d5c7e57f13f1fa5230270124bd1009cdf4de441a
2 if [ -f $HOME/path-add-function
]; then
3 .
$HOME/path-add-function
4 path-add
/usr
/sbin
/usr
/local
/sbin
/a
/exe
/a
/opt
/bin
5 # if usr merge, dont need it
6 if [[ ! -L /sbin
]]; then
9 path-add
--end $HOME/.cabal
/bin
10 path-add
--end /snap
/bin
13 for p
in $HOME/.gem
/ruby
/*/bin
; do
14 path-add
--ifexists --end $p
17 if [ -r /etc
/alternatives
/java_sdk
]; then
18 export JAVA_HOME
=/etc
/alternatives
/java_sdk
19 path-add
/etc
/alternatives
/java_sdk
22 export GUIX_PROFILE
=/root
/.config
/guix
/current
23 if [ -f $GUIX_PROFILE/etc
/profile
]; then
24 .
$GUIX_PROFILE/etc
/profile
26 path-add
$HOME/.guix-profile
/bin
27 export GUIX_LOCPATH
=$HOME/.guix-profile
/lib
/locale
32 export EDITOR
="emacsclient"
33 # this makes emacsclient file/-c start a server instance if none is running,
34 # instead of some alternate editor logic
35 export ALTERNATE_EDITOR
=""
37 export PITHOSFLY_SAVE_DIR
=/a
/pandora_rips4
39 # makes subsequent syscalls to localtime use cached timezone,
40 # so basically restart the comp if you change time zones,
41 # and avoid a few syscalls, which makes a tiny tiny perf difference.
43 # /a/c/filesystem/etc/systemd/system.conf.d/tz.conf
44 # https://blog.packagecloud.io/eng/2017/02/21/set-environment-variable-save-thousands-of-system-calls/
45 export TZ
=:/etc
/localtime
47 # ubuntu starts gpg agent automatically with /etc/X11/Xsession.d/90gpg-agent.
48 # fedora doesn't, which left me to figure this out, and google was no help.
49 # fedora documentation is often quite bad :(
50 # This is mostly copied from that file.
51 # Main difference is that we eval the result of starting gpg-agent,
52 # while that file executes it through xsession specific var.
53 # Also make sourcing the pidfile make more sense.
54 # End result should be the same afaik.
55 # for gpg-agent to work when calling gpg from the command line,
56 # we need an environment variable that is setup via the eval.
57 # which is why we do this upon login, so it can propogate
58 # It is also written to the file $HOME/.gnupg/gpg-agent-info-$(hostname)
59 # I'm not aware if that is ever used, but just fyi.
60 # I also added the bit about xmessaging the stderr,
61 # because I'd like to know if the command fails
62 if [ -f /etc
/fedora-release
]; then
63 : ${GNUPGHOME=$HOME/.gnupg}
65 GPGAGENT
=/usr
/bin
/gpg-agent
66 PID_FILE
="$GNUPGHOME/gpg-agent-info-$(hostname)"
68 if ! $GPGAGENT 2>/dev
/null
; then
70 eval "$($GPGAGENT --homedir /p/do-not-delete --daemon --sh --write-env-file=$PID_FILE 2>$temp)"
71 temperr
="$(cat "$temp")"
72 [ -n "$temperr" ] && xmessage
"gpg-agent stderr: $temperr"
73 elif [ -r "$PID_FILE" ]; then
79 # and broken again. see /usr/lib/systemd/user-environment-generators/90gpg-agent
80 export GPG_AGENT_INFO
=$XDG_RUNTIME_DIR/gnupg
/S.gpg-agent
:0:1
82 # and now trisquel9 + mate + i3 has broken ssh agent. I've had to fix
83 # ssh or gpg agent like 10 times in different distros, and once again, i
84 # randomly figured out this hack because there is no documentation. ssh
85 # agent is started by a systemd service, which runs a wrapper script,
86 # which adds env vars with some dbus thing. This is too much of a pita
87 # to make work in ash/posix. I could just export the agent relevant
88 # vars, but it seems like its better to just get whatever is missing,
89 # but not override existing things because theres stuff like PWD. This
90 # doesn't set SSH_AGENT_PID, but apparently its not needed anymore.
91 # Note: what a huge pita to write this in posix shell.
92 if test "$EUID" && [ "$EUID" != 0 ]; then
94 _sysenvnames
=$
(mktemp
)
96 if systemctl
--user show-environment
>$_sysenv 2>/dev
/null
; then
97 grep -o '^[^=]*' $_sysenv |
sort > $_sysenvnames
98 env
-0 |
grep -zo '^[^=]*' |
xargs -0 printf "%s\n" |
sort | \
99 comm --nocheck-order -13 - $_sysenvnames >$_unsetnames
100 while read -r unsetname
; do
101 while read -r sysenv
; do
103 "$unsetname"*) eval export "$sysenv" ;;
110 # and it seems that if we log into mate, it screws up the systemd env var anyways.
111 for _file
in $
(pgrep
-a '^ssh-agent$' |
sed -r 's/.*-a *([^ ]+).*/\1/'); do
112 if test -O "$_file"; then
113 export SSH_AUTH_SOCK
="$_file"
120 # ubuntu has 002 for non-system users, debian has 022. 002 makes groups
121 # be rw instead of r.
123 # I think the actual setting is somewhere in the pam settings, I haven't
124 # bothered to figure that out.
126 # ubuntu is more user friendly when using multiple users. However,
127 # it also makes it so if you create a file as a regular user then move
128 # it to become a system file, it's got slightly wrong permissions, and
129 # sometimes thing break. Also, copying files between ubuntu and debian
130 # makes things inconsistent. So stick with 022 umask always.
132 # One security concern is where some unixes put every user in a same
133 # group, so if you copy files there with exact perms, that is probably
134 # not what you want. I don't use a system like that, so I don't
137 # this is how we could test for non-system user
139 #if test "$(id -u)" -ge 1000; then : fi