diff options
author | Case Duckworth | 2023-05-13 23:50:35 -0500 |
---|---|---|
committer | Case Duckworth | 2023-05-13 23:50:35 -0500 |
commit | 832af38380ba5b6a020b034059b4bc5ff7443ded (patch) | |
tree | fce4708280ff964d80a9808ed6826a1f3799e804 /profile | |
parent | uhhhh (diff) | |
download | etc-832af38380ba5b6a020b034059b4bc5ff7443ded.tar.gz etc-832af38380ba5b6a020b034059b4bc5ff7443ded.zip |
uhhh
Diffstat (limited to 'profile')
-rw-r--r-- | profile/00_functions.sh | 69 | ||||
-rw-r--r-- | profile/01_path.sh | 19 | ||||
-rw-r--r-- | profile/bc.sh | 2 | ||||
-rw-r--r-- | profile/chicken.sh.disabled | 2 | ||||
-rw-r--r-- | profile/gauche.sh | 2 | ||||
-rw-r--r-- | profile/go.sh | 2 | ||||
-rw-r--r-- | profile/less.sh | 2 | ||||
-rw-r--r-- | profile/luarocks.sh | 6 | ||||
-rw-r--r-- | profile/manpath.sh | 5 | ||||
-rw-r--r-- | profile/nodejs.sh | 3 | ||||
-rw-r--r-- | profile/npm.sh | 4 | ||||
-rw-r--r-- | profile/python.sh | 5 | ||||
-rw-r--r-- | profile/rust.sh | 9 | ||||
-rw-r--r-- | profile/ssh-agent.sh | 7 | ||||
-rw-r--r-- | profile/xdg.sh | 84 | ||||
-rw-r--r-- | profile/xfce.sh | 4 | ||||
-rw-r--r-- | profile/xorg.sh | 10 |
17 files changed, 37 insertions, 198 deletions
diff --git a/profile/00_functions.sh b/profile/00_functions.sh deleted file mode 100644 index 4bf0c78..0000000 --- a/profile/00_functions.sh +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | # utility functions for all shells | ||
2 | # these should be POSIX-compatible. | ||
3 | |||
4 | # add a path to PATH, but only if it's not already there | ||
5 | path_add_to_PATH() { # path_add_to_PATH [-a] PATH... | ||
6 | # -a appends (default is prepend) | ||
7 | APPEND=false | ||
8 | if [ "x$1" = "x-a" ]; then | ||
9 | APPEND=true | ||
10 | shift | ||
11 | fi | ||
12 | |||
13 | for p; do | ||
14 | case ":$PATH:" in | ||
15 | *:"$p":*) ;; | ||
16 | *) | ||
17 | if $APPEND; then | ||
18 | PATH="$PATH:$p" | ||
19 | else | ||
20 | PATH="$p:$PATH" | ||
21 | fi | ||
22 | ;; | ||
23 | esac | ||
24 | done | ||
25 | |||
26 | unset APPEND | ||
27 | } | ||
28 | |||
29 | # Generalization of `path_add_to_PATH' for any variable. | ||
30 | path_add_unsafe() { #path_add_unsafe [-a] [-d DELIM] VAR PATH... | ||
31 | ## Add PATH... to VAR, delimiting with DELIM (default :). | ||
32 | # By default, the VAR will be prepended to; passing -a will append the | ||
33 | # variable. -d DELIM defines the delimiter. | ||
34 | # | ||
35 | # This function has the _unsafe suffix because it uses `eval' to set | ||
36 | # variables. | ||
37 | APPEND=false | ||
38 | DELIM=: | ||
39 | while getopts ad: opt; do | ||
40 | case "$opt" in | ||
41 | a) APPEND=true ;; | ||
42 | d) DELIM="$OPTARG" ;; | ||
43 | *) return 1 ;; | ||
44 | esac | ||
45 | done | ||
46 | shift $(expr $OPTIND - 1) | ||
47 | |||
48 | var="$1" | ||
49 | shift | ||
50 | |||
51 | for path; do | ||
52 | case ":$(eval "echo \$$var"):" in | ||
53 | *:"$path":*) ;; | ||
54 | *) | ||
55 | if $APPEND; then | ||
56 | eval "$var=\$$var${var:+$DELIM}$path" | ||
57 | else | ||
58 | eval "$var=$path${var:+$DELIM}\$$var" | ||
59 | fi | ||
60 | ;; | ||
61 | esac | ||
62 | done | ||
63 | unset -v APPEND DELIM var | ||
64 | } | ||
65 | |||
66 | # Re-source ~/.profile | ||
67 | reprofile() { | ||
68 | . $HOME/.profile | ||
69 | } | ||
diff --git a/profile/01_path.sh b/profile/01_path.sh deleted file mode 100644 index 8b18f5e..0000000 --- a/profile/01_path.sh +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | # PATH and variables for $HOME-local installations | ||
2 | |||
3 | LOCAL_PREFIX="$HOME/usr" | ||
4 | export LOCAL_PREFIX | ||
5 | |||
6 | # Pkg-config | ||
7 | path_add_unsafe PKG_CONFIG_PATH "$LOCAL_PREFIX/lib/pkgconfig" | ||
8 | export PKG_CONFIG_PATH | ||
9 | |||
10 | # LD_LIBRARY_PATH | ||
11 | path_add_unsafe LD_LIBRARY_PATH "$LOCAL_PREFIX/lib" | ||
12 | export LD_LIBRARY_PATH | ||
13 | |||
14 | # see 00_functions.sh for `path_add' | ||
15 | path_add_to_PATH \ | ||
16 | "$HOME/bin" \ | ||
17 | "$LOCAL_PREFIX/bin" \ | ||
18 | "$LOCAL_PREFIX/scripts" \ | ||
19 | "$LOCAL_PREFIX/games/" | ||
diff --git a/profile/bc.sh b/profile/bc.sh index f3b0f5e..c17f560 100644 --- a/profile/bc.sh +++ b/profile/bc.sh | |||
@@ -1,5 +1,7 @@ | |||
1 | # GNU bc | 1 | # GNU bc |
2 | 2 | ||
3 | execp bc || return | ||
4 | |||
3 | BC_ENV_ARGS="-l -q" | 5 | BC_ENV_ARGS="-l -q" |
4 | 6 | ||
5 | BC_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/bc/init" | 7 | BC_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/bc/init" |
diff --git a/profile/chicken.sh.disabled b/profile/chicken.sh.disabled index 975c830..8bfa21f 100644 --- a/profile/chicken.sh.disabled +++ b/profile/chicken.sh.disabled | |||
@@ -1,6 +1,8 @@ | |||
1 | ## chicken scheme -*- sh -*- | 1 | ## chicken scheme -*- sh -*- |
2 | # Enable local installation (i.e., without root) | 2 | # Enable local installation (i.e., without root) |
3 | 3 | ||
4 | execp chicken || return | ||
5 | |||
4 | ## XXX: Disabled because I simply install chicken from source in $LOCAL_PREFIX, | 6 | ## XXX: Disabled because I simply install chicken from source in $LOCAL_PREFIX, |
5 | ## which automagically makes everything correct. | 7 | ## which automagically makes everything correct. |
6 | 8 | ||
diff --git a/profile/gauche.sh b/profile/gauche.sh index ca5d35b..758d59f 100644 --- a/profile/gauche.sh +++ b/profile/gauche.sh | |||
@@ -1,6 +1,8 @@ | |||
1 | # gauche scheme environment variables | 1 | # gauche scheme environment variables |
2 | # see also ~/.gaucherc | 2 | # see also ~/.gaucherc |
3 | 3 | ||
4 | execp gauche || return | ||
5 | |||
4 | # Warn if ‘#<undef>’ is used in the test expression of branch. In boolean | 6 | # Warn if ‘#<undef>’ is used in the test expression of branch. In boolean |
5 | # context, ‘#<undef>’ counts true. It is also often the case that a procedure | 7 | # context, ‘#<undef>’ counts true. It is also often the case that a procedure |
6 | # returns ‘#<undef>’ when the return value doesn’t matter, and you shouldn’t | 8 | # returns ‘#<undef>’ when the return value doesn’t matter, and you shouldn’t |
diff --git a/profile/go.sh b/profile/go.sh index baa4187..34df159 100644 --- a/profile/go.sh +++ b/profile/go.sh | |||
@@ -1,5 +1,7 @@ | |||
1 | # Go | 1 | # Go |
2 | 2 | ||
3 | execp go || return | ||
4 | |||
3 | export GOPATH="$HOME/src/go" | 5 | export GOPATH="$HOME/src/go" |
4 | 6 | ||
5 | # https://drewdevault.com/2022/05/25/Google-has-been-DDoSing-sourcehut.html | 7 | # https://drewdevault.com/2022/05/25/Google-has-been-DDoSing-sourcehut.html |
diff --git a/profile/less.sh b/profile/less.sh index 19a73ce..e9e26a4 100644 --- a/profile/less.sh +++ b/profile/less.sh | |||
@@ -1,3 +1,5 @@ | |||
1 | # less settings | 1 | # less settings |
2 | 2 | ||
3 | execp less || return | ||
4 | |||
3 | export LESS="--mouse --RAW-CONTROL-CHARS" | 5 | export LESS="--mouse --RAW-CONTROL-CHARS" |
diff --git a/profile/luarocks.sh b/profile/luarocks.sh index e6e1d24..e084c1f 100644 --- a/profile/luarocks.sh +++ b/profile/luarocks.sh | |||
@@ -1,5 +1,5 @@ | |||
1 | # add luarocks stuff to $PATH | 1 | # add luarocks stuff to $PATH |
2 | 2 | ||
3 | if command -v luarocks >/dev/null 2>&1; then | 3 | execp luarocks || return |
4 | eval "$(luarocks path)" | 4 | |
5 | fi | 5 | eval "$(luarocks path)" |
diff --git a/profile/manpath.sh b/profile/manpath.sh index bda4fd2..7f17ea3 100644 --- a/profile/manpath.sh +++ b/profile/manpath.sh | |||
@@ -4,7 +4,10 @@ path_add_unsafe MANPATH \ | |||
4 | "${XDG_DATA_HOME:-$LOCAL_PREFIX/share}/man" \ | 4 | "${XDG_DATA_HOME:-$LOCAL_PREFIX/share}/man" \ |
5 | "$LOCAL_PREFIX/local/man" \ | 5 | "$LOCAL_PREFIX/local/man" \ |
6 | "$LOCAL_PREFIX/local/man" \ | 6 | "$LOCAL_PREFIX/local/man" \ |
7 | "$LOCAL_PREFIX/man" | 7 | "$LOCAL_PREFIX/man" \ |
8 | /usr/share/man \ | ||
9 | /usr/X11R6/man \ | ||
10 | /usr/local/man | ||
8 | 11 | ||
9 | # $MANPATH ends with `:' so that manpath(1) will prepend it to its | 12 | # $MANPATH ends with `:' so that manpath(1) will prepend it to its |
10 | # special thing. | 13 | # special thing. |
diff --git a/profile/nodejs.sh b/profile/nodejs.sh index 224dbbe..3168930 100644 --- a/profile/nodejs.sh +++ b/profile/nodejs.sh | |||
@@ -1,3 +1,6 @@ | |||
1 | # node.js environment | 1 | # node.js environment |
2 | 2 | ||
3 | execp npm || return | ||
4 | |||
3 | export npm_config_prefix="$LOCAL_PREFIX" | 5 | export npm_config_prefix="$LOCAL_PREFIX" |
6 | path_add_to_PATH "$(npm config get prefix)/bin" | ||
diff --git a/profile/npm.sh b/profile/npm.sh deleted file mode 100644 index 108a869..0000000 --- a/profile/npm.sh +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | # Add npm path to $PATH | ||
2 | |||
3 | command -v npm >/dev/null 2>&1 && | ||
4 | path_add_to_PATH "$(npm config get prefix)/bin" | ||
diff --git a/profile/python.sh b/profile/python.sh index 9353cfe..c5c11aa 100644 --- a/profile/python.sh +++ b/profile/python.sh | |||
@@ -2,6 +2,11 @@ | |||
2 | # I try not to use python, because the tooling is just terrible. However, | 2 | # I try not to use python, because the tooling is just terrible. However, |
3 | # sometimes it's unavoidable. | 3 | # sometimes it's unavoidable. |
4 | 4 | ||
5 | if ! ( execp python || execp python3 ) | ||
6 | then | ||
7 | return | ||
8 | fi | ||
9 | |||
5 | # from grym on #emacs --- TODO: research what this actually does, lol | 10 | # from grym on #emacs --- TODO: research what this actually does, lol |
6 | # it's annoying ... (2023-02-08) | 11 | # it's annoying ... (2023-02-08) |
7 | #export PIP_REQUIRE_VIRTUALENV=1 | 12 | #export PIP_REQUIRE_VIRTUALENV=1 |
diff --git a/profile/rust.sh b/profile/rust.sh index dd85a65..fa23ae9 100644 --- a/profile/rust.sh +++ b/profile/rust.sh | |||
@@ -1,3 +1,10 @@ | |||
1 | execp cargo || return | ||
2 | |||
1 | export RUSTUP_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/rustup" | 3 | export RUSTUP_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/rustup" |
2 | export CARGO_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/cargo" | 4 | export CARGO_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/cargo" |
3 | . "$CARGO_HOME/env" # takes care of $PATH for us | 5 | |
6 | path_add_to_PATH "$CARGO_HOME/bin" | ||
7 | |||
8 | if test -f "$CARGO_HOME/env"; then | ||
9 | . "$CARGO_HOME/env" # takes care of $PATH for us | ||
10 | fi | ||
diff --git a/profile/ssh-agent.sh b/profile/ssh-agent.sh index 95669d5..f940099 100644 --- a/profile/ssh-agent.sh +++ b/profile/ssh-agent.sh | |||
@@ -1,10 +1,11 @@ | |||
1 | # start the ssh-agent | 1 | # start the ssh-agent |
2 | 2 | ||
3 | # use keychain(1), if available | 3 | # use keychain(1), if available |
4 | if type keychain >/dev/null 2>&1; then | 4 | if execp keychain |
5 | then | ||
5 | # Save directory name in a variable (for ease of maintenance) | 6 | # Save directory name in a variable (for ease of maintenance) |
6 | export KEYCHAIN_HOME="$XDG_RUNTIME_DIR/keychain" | 7 | export KEYCHAIN_HOME="$XDG_RUNTIME_DIR/" |
7 | eval $(keychain --eval --dir "$KEYCHAIN_HOME" --agents ssh 2>/dev/null) | 8 | eval $(keychain --quiet --eval --dir "$KEYCHAIN_HOME" --agents ssh) |
8 | else | 9 | else |
9 | eval $(ssh-agent -s) | 10 | eval $(ssh-agent -s) |
10 | fi | 11 | fi |
diff --git a/profile/xdg.sh b/profile/xdg.sh deleted file mode 100644 index a4e395f..0000000 --- a/profile/xdg.sh +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | # XDG compliance (miscellaneous) | ||
2 | |||
3 | # If an XDG-complaint variable makes more sense somewhere else, it'll be | ||
4 | # moved there (e.g., HISTFILE is in history.bash). So variables might | ||
5 | # move /out/ of this directory, but they probably won't move /in/. | ||
6 | |||
7 | # See also https://github.com/b3nj5m1n/xdg-ninja, | ||
8 | # https://wiki.archlinux.org/title/XDG_Base_Directory#Support | ||
9 | |||
10 | # Readline | ||
11 | export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" | ||
12 | export RLWRAP_HOME="$XDG_DATA_HOME/rlwrap" | ||
13 | |||
14 | # Less | ||
15 | export LESSKEY="$XDG_CONFIG_HOME/less/lesskey" | ||
16 | export LESSHISTFILE="$XDG_CACHE_HOME/less/history" | ||
17 | mkdir -p "$XDG_CACHE_HOME/less" | ||
18 | |||
19 | # Vim | ||
20 | export VIMINIT="source ${XDG_CONFIG_HOME:=$HOME/.config}/vim/vimrc" | ||
21 | |||
22 | # Weechat | ||
23 | export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat" | ||
24 | |||
25 | # Lynx | ||
26 | export LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg" | ||
27 | |||
28 | # Xorg | ||
29 | export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$HOME}" | ||
30 | export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" | ||
31 | export XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc" | ||
32 | export USERXSESSION="$XDG_CACHE_HOME/X11/xsession" | ||
33 | export ALTUSERXSESSION="$XDG_CACHE_HOME/X11/Xsession" | ||
34 | export ERRFILE="$XDG_CACHE_HOME/X11/xsession-errors" | ||
35 | |||
36 | |||
37 | |||
38 | # Notmuch -- https://notmuchmail.org/pipermail/notmuch/2011/007007.html | ||
39 | export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:=$HOME/.config}/notmuch/default/config" | ||
40 | |||
41 | # GNUPG | ||
42 | export GNUPGHOME="$XDG_DATA_HOME/gnupg" | ||
43 | |||
44 | # ICEauthority | ||
45 | export ICEAUTHORITY="$XDG_CACHE_HOME/ICEauthority" | ||
46 | |||
47 | # mbsync (requires alias) | ||
48 | export MBSYNC_CONFIG_HOME="$XDG_CONFIG_HOME/isync/mbsyncrc" | ||
49 | alias mbsync='command mbsync -c "$MBSYNC_CONFIG_HOME"' | ||
50 | |||
51 | # npm | ||
52 | export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" | ||
53 | |||
54 | # bash-complete | ||
55 | export BASH_COMPLETION_USER_FILE="$XDG_CONFIG_HOME/bash/completion" | ||
56 | |||
57 | # aspell | ||
58 | ASPELL_CONF="per-conf $XDG_CONFIG_HOME/aspell/aspell.conf" | ||
59 | ASPELL_CONF="$ASPELL_CONF; personal $XDG_CONFIG_HOME/aspell/en.pws" | ||
60 | ASPELL_CONF="$ASPELL_CONF; repl $XDG_CONFIG_HOME/aspell/en.prepl" | ||
61 | mkdir -p "$XDG_CONFIG_HOME/aspell" | ||
62 | export ASPELL_CONF | ||
63 | |||
64 | # Xcompose | ||
65 | export XCOMPOSEFILE="$XDG_CONFIG_HOME/xorg/xcompose" | ||
66 | export XCOMPOSECACHE="$XDG_CACHE_HOME/xorg/xcompose" | ||
67 | |||
68 | # sqlite | ||
69 | export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" | ||
70 | alias sqlite3='sqlite3 -init "$XDG_CONFIG_HOME/sqlite3/sqliterc"' | ||
71 | |||
72 | # python | ||
73 | export PYTHONSTARTUPFILE="$XDG_CONFIG_HOME/python/startup" | ||
74 | export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python" | ||
75 | export PYTHON_EGG_CACHE="$XDG_CACHE_HOME/python/eggs" | ||
76 | export PYTHONUSERBASE="$XDG_DATA_HOME/python" | ||
77 | |||
78 | # wget | ||
79 | export WGETRC="$XDG_CONFIG_HOME/wget/config" | ||
80 | mkdir -p "$XDG_CONFIG_HOME/wget" | ||
81 | alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' | ||
82 | |||
83 | # dvdcss | ||
84 | export DVDCSS_HOME="$XDG_CACHE_HOME/dvdcss" | ||
diff --git a/profile/xfce.sh b/profile/xfce.sh deleted file mode 100644 index 85e90ce..0000000 --- a/profile/xfce.sh +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | # enable global menus | ||
2 | # NOTE: Firefox and Thunderbird require this variable to be 0! | ||
3 | |||
4 | export UBUNTU_MENUPROXY=1 | ||
diff --git a/profile/xorg.sh b/profile/xorg.sh deleted file mode 100644 index 89a26ec..0000000 --- a/profile/xorg.sh +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # X.org environment variables | ||
2 | # ~/.profile is sourced by LightDM | ||
3 | |||
4 | # Xsession errors | ||
5 | export ERRFILE="$XDG_CACHE_HOME/X11/xsession-errors" | ||
6 | # Xsession RC | ||
7 | export USERXSESSIONRC="$XDG_CONFIG_HOME/xorg/xsessionrc" | ||
8 | # Xauthority --- though this doesn't work with LightDM (see | ||
9 | # https://askubuntu.com/a/961459 for a workaround). | ||
10 | export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" | ||