minor: add missing utility
[distro-setup] / etc / profile.d / environment.sh
1 if [ -f $HOME/path_add-function ]; then
2 . $HOME/path_add-function
3 path_add /usr/sbin /usr/local/sbin /sbin /a/exe /a/opt/bin
4 path_add --end $HOME/.cabal/bin
5
6 if [ -r /etc/alternatives/java_sdk ]; then
7 export JAVA_HOME=/etc/alternatives/java_sdk
8 path_add /etc/alternatives/java_sdk
9 fi
10 fi
11
12 export EDITOR="emacsclient"
13 # this makes emacsclient file/-c start a server instance if none is running,
14 # instead of some alternate editor logic
15 export ALTERNATE_EDITOR=""
16
17 export PITHOSFLY_SAVE_DIR=/a/pandora_rips4
18
19 # makes subsequent syscalls to localtime use cached timezone,
20 # so basically restart the comp if you change time zones,
21 # and avoid a few syscalls, which makes a tiny tiny perf difference.
22 # I also set this in
23 # /a/c/filesystem/etc/systemd/system.conf.d/tz.conf
24 # https://blog.packagecloud.io/eng/2017/02/21/set-environment-variable-save-thousands-of-system-calls/
25 export TZ=:/etc/localtime
26
27 # ubuntu starts gpg agent automatically with /etc/X11/Xsession.d/90gpg-agent.
28 # fedora doesn't, which left me to figure this out, and google was no help.
29 # fedora documentation is often quite bad :(
30 # This is mostly copied from that file.
31 # Main difference is that we eval the result of starting gpg-agent,
32 # while that file executes it through xsession specific var.
33 # Also make sourcing the pidfile make more sense.
34 # End result should be the same afaik.
35 # for gpg-agent to work when calling gpg from the command line,
36 # we need an environment variable that is setup via the eval.
37 # which is why we do this upon login, so it can propogate
38 # It is also written to the file $HOME/.gnupg/gpg-agent-info-$(hostname)
39 # I'm not aware if that is ever used, but just fyi.
40 # I also added the bit about xmessaging the stderr,
41 # because I'd like to know if the command fails
42 if [ -f /etc/fedora-release ]; then
43 : ${GNUPGHOME=$HOME/.gnupg}
44
45 GPGAGENT=/usr/bin/gpg-agent
46 PID_FILE="$GNUPGHOME/gpg-agent-info-$(hostname)"
47
48 if ! $GPGAGENT 2>/dev/null; then
49 temp="$(mktemp)"
50 eval "$($GPGAGENT --homedir /p/do-not-delete --daemon --sh --write-env-file=$PID_FILE 2>$temp)"
51 temperr="$(<"$temp")"
52 [ -n "$temperr" ] && xmessage "gpg-agent stderr: $temperr"
53 elif [ -r "$PID_FILE" ]; then
54 . "$PID_FILE"
55 export GPG_AGENT_INFO
56 fi
57 fi
58
59 # background:
60 # ubuntu has 002 for non-system users, debian has 022. 002 makes groups
61 # be rw instead of r.
62 #
63 # ubuntu is more user friendly when using multiple users. However,
64 # it also makes it so if you create a file as a regular user then move
65 # it to become a system file, it's got slightly wrong permissions, and
66 # sometimes thing break. Also, copying files between ubuntu and debian
67 # makes things inconsistent. So stick with 022 umask always.
68 #
69 # One security concern is where some unixes put every user in a same
70 # group, so if you copy files there with exact perms, that is probably
71 # not what you want. I don't use a system like that, so I don't
72 # care.
73 umask 022
74 # this is how we could test for non-system user
75
76 #if test "$(id -u)" -ge 1000; then : fi