about summary refs log tree commit diff stats
path: root/profile
diff options
context:
space:
mode:
Diffstat (limited to 'profile')
-rw-r--r--profile/00_functions.sh69
-rw-r--r--profile/01_path.sh19
-rw-r--r--profile/bc.sh2
-rw-r--r--profile/chicken.sh.disabled2
-rw-r--r--profile/gauche.sh2
-rw-r--r--profile/go.sh2
-rw-r--r--profile/less.sh2
-rw-r--r--profile/luarocks.sh6
-rw-r--r--profile/manpath.sh5
-rw-r--r--profile/nodejs.sh3
-rw-r--r--profile/npm.sh4
-rw-r--r--profile/python.sh5
-rw-r--r--profile/rust.sh9
-rw-r--r--profile/ssh-agent.sh7
-rw-r--r--profile/xdg.sh84
-rw-r--r--profile/xfce.sh4
-rw-r--r--profile/xorg.sh10
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
5path_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.
30path_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
67reprofile() {
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
3LOCAL_PREFIX="$HOME/usr"
4export LOCAL_PREFIX
5
6# Pkg-config
7path_add_unsafe PKG_CONFIG_PATH "$LOCAL_PREFIX/lib/pkgconfig"
8export PKG_CONFIG_PATH
9
10# LD_LIBRARY_PATH
11path_add_unsafe LD_LIBRARY_PATH "$LOCAL_PREFIX/lib"
12export LD_LIBRARY_PATH
13
14# see 00_functions.sh for `path_add'
15path_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
3execp bc || return
4
3BC_ENV_ARGS="-l -q" 5BC_ENV_ARGS="-l -q"
4 6
5BC_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/bc/init" 7BC_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
4execp 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
4execp 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
3execp go || return
4
3export GOPATH="$HOME/src/go" 5export 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
3execp less || return
4
3export LESS="--mouse --RAW-CONTROL-CHARS" 5export 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
3if command -v luarocks >/dev/null 2>&1; then 3execp luarocks || return
4 eval "$(luarocks path)" 4
5fi 5eval "$(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
3execp npm || return
4
3export npm_config_prefix="$LOCAL_PREFIX" 5export npm_config_prefix="$LOCAL_PREFIX"
6path_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
3command -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
5if ! ( execp python || execp python3 )
6then
7 return
8fi
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 @@
1execp cargo || return
2
1export RUSTUP_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/rustup" 3export RUSTUP_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/rustup"
2export CARGO_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/cargo" 4export CARGO_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/cargo"
3. "$CARGO_HOME/env" # takes care of $PATH for us 5
6path_add_to_PATH "$CARGO_HOME/bin"
7
8if test -f "$CARGO_HOME/env"; then
9 . "$CARGO_HOME/env" # takes care of $PATH for us
10fi
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
4if type keychain >/dev/null 2>&1; then 4if execp keychain
5then
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)
8else 9else
9 eval $(ssh-agent -s) 10 eval $(ssh-agent -s)
10fi 11fi
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
11export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
12export RLWRAP_HOME="$XDG_DATA_HOME/rlwrap"
13
14# Less
15export LESSKEY="$XDG_CONFIG_HOME/less/lesskey"
16export LESSHISTFILE="$XDG_CACHE_HOME/less/history"
17mkdir -p "$XDG_CACHE_HOME/less"
18
19# Vim
20export VIMINIT="source ${XDG_CONFIG_HOME:=$HOME/.config}/vim/vimrc"
21
22# Weechat
23export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat"
24
25# Lynx
26export LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg"
27
28# Xorg
29export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$HOME}"
30export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
31export XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc"
32export USERXSESSION="$XDG_CACHE_HOME/X11/xsession"
33export ALTUSERXSESSION="$XDG_CACHE_HOME/X11/Xsession"
34export ERRFILE="$XDG_CACHE_HOME/X11/xsession-errors"
35
36
37
38# Notmuch -- https://notmuchmail.org/pipermail/notmuch/2011/007007.html
39export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:=$HOME/.config}/notmuch/default/config"
40
41# GNUPG
42export GNUPGHOME="$XDG_DATA_HOME/gnupg"
43
44# ICEauthority
45export ICEAUTHORITY="$XDG_CACHE_HOME/ICEauthority"
46
47# mbsync (requires alias)
48export MBSYNC_CONFIG_HOME="$XDG_CONFIG_HOME/isync/mbsyncrc"
49alias mbsync='command mbsync -c "$MBSYNC_CONFIG_HOME"'
50
51# npm
52export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
53
54# bash-complete
55export BASH_COMPLETION_USER_FILE="$XDG_CONFIG_HOME/bash/completion"
56
57# aspell
58ASPELL_CONF="per-conf $XDG_CONFIG_HOME/aspell/aspell.conf"
59ASPELL_CONF="$ASPELL_CONF; personal $XDG_CONFIG_HOME/aspell/en.pws"
60ASPELL_CONF="$ASPELL_CONF; repl $XDG_CONFIG_HOME/aspell/en.prepl"
61mkdir -p "$XDG_CONFIG_HOME/aspell"
62export ASPELL_CONF
63
64# Xcompose
65export XCOMPOSEFILE="$XDG_CONFIG_HOME/xorg/xcompose"
66export XCOMPOSECACHE="$XDG_CACHE_HOME/xorg/xcompose"
67
68# sqlite
69export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
70alias sqlite3='sqlite3 -init "$XDG_CONFIG_HOME/sqlite3/sqliterc"'
71
72# python
73export PYTHONSTARTUPFILE="$XDG_CONFIG_HOME/python/startup"
74export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python"
75export PYTHON_EGG_CACHE="$XDG_CACHE_HOME/python/eggs"
76export PYTHONUSERBASE="$XDG_DATA_HOME/python"
77
78# wget
79export WGETRC="$XDG_CONFIG_HOME/wget/config"
80mkdir -p "$XDG_CONFIG_HOME/wget"
81alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
82
83# dvdcss
84export 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
4export 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
5export ERRFILE="$XDG_CACHE_HOME/X11/xsession-errors"
6# Xsession RC
7export 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).
10export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"