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