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