From 832af38380ba5b6a020b034059b4bc5ff7443ded Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 13 May 2023 23:50:35 -0500 Subject: uhhh --- profile/00_functions.sh | 69 ------------------------------------- profile/01_path.sh | 19 ---------- profile/bc.sh | 2 ++ profile/chicken.sh.disabled | 2 ++ profile/gauche.sh | 2 ++ profile/go.sh | 2 ++ profile/less.sh | 2 ++ profile/luarocks.sh | 6 ++-- profile/manpath.sh | 5 ++- profile/nodejs.sh | 3 ++ profile/npm.sh | 4 --- profile/python.sh | 5 +++ profile/rust.sh | 9 ++++- profile/ssh-agent.sh | 7 ++-- profile/xdg.sh | 84 --------------------------------------------- profile/xfce.sh | 4 --- profile/xorg.sh | 10 ------ 17 files changed, 37 insertions(+), 198 deletions(-) delete mode 100644 profile/00_functions.sh delete mode 100644 profile/01_path.sh delete mode 100644 profile/npm.sh delete mode 100644 profile/xdg.sh delete mode 100644 profile/xfce.sh delete mode 100644 profile/xorg.sh (limited to 'profile') 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 @@ -# utility functions for all shells -# these should be POSIX-compatible. - -# add a path to PATH, but only if it's not already there -path_add_to_PATH() { # path_add_to_PATH [-a] PATH... - # -a appends (default is prepend) - APPEND=false - if [ "x$1" = "x-a" ]; then - APPEND=true - shift - fi - - for p; do - case ":$PATH:" in - *:"$p":*) ;; - *) - if $APPEND; then - PATH="$PATH:$p" - else - PATH="$p:$PATH" - fi - ;; - esac - done - - unset APPEND -} - -# Generalization of `path_add_to_PATH' for any variable. -path_add_unsafe() { #path_add_unsafe [-a] [-d DELIM] VAR PATH... - ## Add PATH... to VAR, delimiting with DELIM (default :). - # By default, the VAR will be prepended to; passing -a will append the - # variable. -d DELIM defines the delimiter. - # - # This function has the _unsafe suffix because it uses `eval' to set - # variables. - APPEND=false - DELIM=: - while getopts ad: opt; do - case "$opt" in - a) APPEND=true ;; - d) DELIM="$OPTARG" ;; - *) return 1 ;; - esac - done - shift $(expr $OPTIND - 1) - - var="$1" - shift - - for path; do - case ":$(eval "echo \$$var"):" in - *:"$path":*) ;; - *) - if $APPEND; then - eval "$var=\$$var${var:+$DELIM}$path" - else - eval "$var=$path${var:+$DELIM}\$$var" - fi - ;; - esac - done - unset -v APPEND DELIM var -} - -# Re-source ~/.profile -reprofile() { - . $HOME/.profile -} 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 @@ -# PATH and variables for $HOME-local installations - -LOCAL_PREFIX="$HOME/usr" -export LOCAL_PREFIX - -# Pkg-config -path_add_unsafe PKG_CONFIG_PATH "$LOCAL_PREFIX/lib/pkgconfig" -export PKG_CONFIG_PATH - -# LD_LIBRARY_PATH -path_add_unsafe LD_LIBRARY_PATH "$LOCAL_PREFIX/lib" -export LD_LIBRARY_PATH - -# see 00_functions.sh for `path_add' -path_add_to_PATH \ - "$HOME/bin" \ - "$LOCAL_PREFIX/bin" \ - "$LOCAL_PREFIX/scripts" \ - "$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 @@ # GNU bc +execp bc || return + BC_ENV_ARGS="-l -q" 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 @@ ## chicken scheme -*- sh -*- # Enable local installation (i.e., without root) +execp chicken || return + ## XXX: Disabled because I simply install chicken from source in $LOCAL_PREFIX, ## which automagically makes everything correct. 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 @@ # gauche scheme environment variables # see also ~/.gaucherc +execp gauche || return + # Warn if ‘#’ is used in the test expression of branch. In boolean # context, ‘#’ counts true. It is also often the case that a procedure # returns ‘#’ 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 @@ # Go +execp go || return + export GOPATH="$HOME/src/go" # 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 @@ # less settings +execp less || return + 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 @@ # add luarocks stuff to $PATH -if command -v luarocks >/dev/null 2>&1; then - eval "$(luarocks path)" -fi +execp luarocks || return + +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 \ "${XDG_DATA_HOME:-$LOCAL_PREFIX/share}/man" \ "$LOCAL_PREFIX/local/man" \ "$LOCAL_PREFIX/local/man" \ - "$LOCAL_PREFIX/man" + "$LOCAL_PREFIX/man" \ + /usr/share/man \ + /usr/X11R6/man \ + /usr/local/man # $MANPATH ends with `:' so that manpath(1) will prepend it to its # 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 @@ # node.js environment +execp npm || return + export npm_config_prefix="$LOCAL_PREFIX" +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 @@ -# Add npm path to $PATH - -command -v npm >/dev/null 2>&1 && - 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 @@ # I try not to use python, because the tooling is just terrible. However, # sometimes it's unavoidable. +if ! ( execp python || execp python3 ) +then + return +fi + # from grym on #emacs --- TODO: research what this actually does, lol # it's annoying ... (2023-02-08) #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 @@ +execp cargo || return + export RUSTUP_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/rustup" export CARGO_HOME="${XDG_DATA_HOME:=$LOCAL_PREFIX/share}/cargo" -. "$CARGO_HOME/env" # takes care of $PATH for us + +path_add_to_PATH "$CARGO_HOME/bin" + +if test -f "$CARGO_HOME/env"; then + . "$CARGO_HOME/env" # takes care of $PATH for us +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 @@ # start the ssh-agent # use keychain(1), if available -if type keychain >/dev/null 2>&1; then +if execp keychain +then # Save directory name in a variable (for ease of maintenance) - export KEYCHAIN_HOME="$XDG_RUNTIME_DIR/keychain" - eval $(keychain --eval --dir "$KEYCHAIN_HOME" --agents ssh 2>/dev/null) + export KEYCHAIN_HOME="$XDG_RUNTIME_DIR/" + eval $(keychain --quiet --eval --dir "$KEYCHAIN_HOME" --agents ssh) else eval $(ssh-agent -s) 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 @@ -# XDG compliance (miscellaneous) - -# If an XDG-complaint variable makes more sense somewhere else, it'll be -# moved there (e.g., HISTFILE is in history.bash). So variables might -# move /out/ of this directory, but they probably won't move /in/. - -# See also https://github.com/b3nj5m1n/xdg-ninja, -# https://wiki.archlinux.org/title/XDG_Base_Directory#Support - -# Readline -export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" -export RLWRAP_HOME="$XDG_DATA_HOME/rlwrap" - -# Less -export LESSKEY="$XDG_CONFIG_HOME/less/lesskey" -export LESSHISTFILE="$XDG_CACHE_HOME/less/history" -mkdir -p "$XDG_CACHE_HOME/less" - -# Vim -export VIMINIT="source ${XDG_CONFIG_HOME:=$HOME/.config}/vim/vimrc" - -# Weechat -export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat" - -# Lynx -export LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg" - -# Xorg -export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$HOME}" -export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" -export XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc" -export USERXSESSION="$XDG_CACHE_HOME/X11/xsession" -export ALTUSERXSESSION="$XDG_CACHE_HOME/X11/Xsession" -export ERRFILE="$XDG_CACHE_HOME/X11/xsession-errors" - - - -# Notmuch -- https://notmuchmail.org/pipermail/notmuch/2011/007007.html -export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:=$HOME/.config}/notmuch/default/config" - -# GNUPG -export GNUPGHOME="$XDG_DATA_HOME/gnupg" - -# ICEauthority -export ICEAUTHORITY="$XDG_CACHE_HOME/ICEauthority" - -# mbsync (requires alias) -export MBSYNC_CONFIG_HOME="$XDG_CONFIG_HOME/isync/mbsyncrc" -alias mbsync='command mbsync -c "$MBSYNC_CONFIG_HOME"' - -# npm -export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" - -# bash-complete -export BASH_COMPLETION_USER_FILE="$XDG_CONFIG_HOME/bash/completion" - -# aspell -ASPELL_CONF="per-conf $XDG_CONFIG_HOME/aspell/aspell.conf" -ASPELL_CONF="$ASPELL_CONF; personal $XDG_CONFIG_HOME/aspell/en.pws" -ASPELL_CONF="$ASPELL_CONF; repl $XDG_CONFIG_HOME/aspell/en.prepl" -mkdir -p "$XDG_CONFIG_HOME/aspell" -export ASPELL_CONF - -# Xcompose -export XCOMPOSEFILE="$XDG_CONFIG_HOME/xorg/xcompose" -export XCOMPOSECACHE="$XDG_CACHE_HOME/xorg/xcompose" - -# sqlite -export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" -alias sqlite3='sqlite3 -init "$XDG_CONFIG_HOME/sqlite3/sqliterc"' - -# python -export PYTHONSTARTUPFILE="$XDG_CONFIG_HOME/python/startup" -export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python" -export PYTHON_EGG_CACHE="$XDG_CACHE_HOME/python/eggs" -export PYTHONUSERBASE="$XDG_DATA_HOME/python" - -# wget -export WGETRC="$XDG_CONFIG_HOME/wget/config" -mkdir -p "$XDG_CONFIG_HOME/wget" -alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' - -# dvdcss -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 @@ -# enable global menus -# NOTE: Firefox and Thunderbird require this variable to be 0! - -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 @@ -# X.org environment variables -# ~/.profile is sourced by LightDM - -# Xsession errors -export ERRFILE="$XDG_CACHE_HOME/X11/xsession-errors" -# Xsession RC -export USERXSESSIONRC="$XDG_CONFIG_HOME/xorg/xsessionrc" -# Xauthority --- though this doesn't work with LightDM (see -# https://askubuntu.com/a/961459 for a workaround). -export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" -- cgit 1.4.1-21-gabe81