diff --git a/base/.config/profile/env.d/base.env b/base/.config/profile/env.d/base.env index dfce454..7b6c505 100644 --- a/base/.config/profile/env.d/base.env +++ b/base/.config/profile/env.d/base.env @@ -1,7 +1,8 @@ #shellcheck disable=SC2034 -EDITOR=vim BROWSER=firefox -PATH="${XDG_BIN_HOME}:${PATH}" +EDITOR=vim HISTCONTROL=ignoredups:erasedups:ignorespace HISTFILESIZE= HISTSIZE= +MAN_DIR=${XDG_DATA_HOME}/man/man1 +PATH="${XDG_BIN_HOME}:${PATH}" diff --git a/base/.profile b/base/.profile index d99fb93..8fe283d 100644 --- a/base/.profile +++ b/base/.profile @@ -7,11 +7,12 @@ export LC_COLLATE="en_US.UTF-8" export XDG_BIN_HOME=${XDG_BIN_HOME:="$HOME/.local/bin"} export XDG_CACHE_HOME=${XDG_CACHE_HOME:="$HOME/.cache"} +export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:="/etc/xdg"}" export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"} +export XDG_DATA_DIRS="${XDG_DATA_DIRS:="/usr/local/share:/usr/share"}" export XDG_DATA_HOME=${XDG_DATA_HOME:="$HOME/.local/share"} +export XDG_INCLUDE_HOME=${XDG_INCLUDE_HOME:="$HOME/.local/include"} export XDG_STATE_HOME=${XDG_STATE_HOME:="$HOME/.local/state"} -export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:="/etc/xdg"}" -export XDG_DATA_DIRS="${XDG_DATA_DIRS:="/usr/local/share:/usr/share"}" if [ "${XDG_RUNTIME_DIR}" = "" ]; then __TMPDIR__= diff --git a/node/.local/bin/install-node-home b/node/.local/bin/install-node-home index 982ea98..fad571d 100755 --- a/node/.local/bin/install-node-home +++ b/node/.local/bin/install-node-home @@ -18,21 +18,31 @@ get_arch () { esac } -APPS="node npm npx" VERSION=${VERSION:-v14.17.3} DEST="${XDG_DATA_HOME}/apps/releases/node" +CURRENT="${DEST}/current" URL=https://nodejs.org/dist/${VERSION}/node-${VERSION}-$(get_os)-$(get_arch).tar.xz extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1" set_current_link "${DEST}" "${VERSION}" -pushd "${XDG_BIN_HOME}" >/dev/null -for app in ${APPS}; do - if [[ -L "${XDG_BIN_HOME}/${app}" ]]; then - unlink "${XDG_BIN_HOME}/${app}" - fi +set_symlink () { + local src="$1" + local dest="$2" + dest_dir=$(dirname "${dest}") - REL_LINK="$(relative_path "${XDG_BIN_HOME}" "${DEST}/current/bin/${app}")" - ln --symbolic "${REL_LINK}" "${app}" + mkdir_if_missing "${dest_dir}" + pushd "${dest_dir}" > /dev/null || exit 1 + unlink_if_set "${dest}" + ln -s "$(relative_path "${dest_dir}" "${src}")" "$(basename "${dest}")" + popd > /dev/null || exit 1 +} + +for app in "${CURRENT}"/bin/*; do + set_symlink "${CURRENT}/bin/${app}" "${XDG_BIN_HOME}/${app}" done -popd >/dev/null + +set_symlink "${CURRENT}/include/node" "${XDG_INCLUDE_HOME}/node" +set_symlink "${CURRENT}/share/doc/node" "${XDG_DATA_HOME}/doc/node" +set_symlink "${CURRENT}/share/man/man1/node.1" "${MAN_DIR}/node.1" +set_symlink "${CURRENT}/share/systemtap/tapset/node.stp" "${XDG_DATA_HOME}/systemtap/tapset/node.stp"