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