Only make path setup permanent from login.sh
This commit is contained in:
parent
eaa9386505
commit
2404216ccd
5
dotfiles/lib/login.sh
Normal file
5
dotfiles/lib/login.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
source "$HOME/.lib/shellpath.sh"
|
||||||
|
|
||||||
|
setup_unless_environment_variable_exists ENV_PATH_SETUP_DONE || _setup_path
|
||||||
|
|
||||||
|
source_directory_files "$HOME/.lib/login"
|
@ -27,6 +27,16 @@ function _set_python_command {
|
|||||||
echo "Warning: setting python command to shim"
|
echo "Warning: setting python command to shim"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function environment_variable_exists {
|
||||||
|
eval "value=\"\${$1+x}\""
|
||||||
|
[ ! -z $value ]
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup_unless_environment_variable_exists {
|
||||||
|
environment_variable_exists "$1" || $2
|
||||||
|
export "$1=$(date)"
|
||||||
|
}
|
||||||
|
|
||||||
function add_to_path {
|
function add_to_path {
|
||||||
environment_variable_exists _python_command || _set_python_command
|
environment_variable_exists _python_command || _set_python_command
|
||||||
# We need to get a path to the ACTUAL python command because
|
# We need to get a path to the ACTUAL python command because
|
||||||
@ -75,11 +85,6 @@ function is_osx() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function environment_variable_exists {
|
|
||||||
eval "value=\"\${$1+x}\""
|
|
||||||
[ ! -z $value ]
|
|
||||||
}
|
|
||||||
|
|
||||||
function source_directory_files {
|
function source_directory_files {
|
||||||
for filename in "$1"/*; do
|
for filename in "$1"/*; do
|
||||||
environment_variable_exists SHELL_STARTUP_DEBUG && echo "Sourcing $filename"
|
environment_variable_exists SHELL_STARTUP_DEBUG && echo "Sourcing $filename"
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
source "$HOME/.lib/shellpath.sh"
|
|
||||||
|
|
||||||
environment_variable_exists ENVIRONMENT_SETUP_DONE || _setup_env
|
|
||||||
|
|
||||||
# TODO(imalison): These need to run every time because of how their
|
|
||||||
# version managers work. This could cause problems with the situation
|
|
||||||
# where we want to intentionally override the python/ruby/node
|
|
||||||
# versions in use in a given shell.
|
|
||||||
|
|
||||||
# TODO: Ruby and node are disabled to speed up shell startup...
|
|
||||||
# See https://github.com/creationix/nvm/issues/709 for nvm
|
|
||||||
# _node_setup
|
|
||||||
|
|
||||||
# XXX: these were moved to _setup_env
|
|
||||||
# _ruby_setup
|
|
||||||
_python_setup
|
|
||||||
|
|
||||||
source_directory_files "$HOME/.lib/shellenv"
|
|
||||||
|
|
||||||
test -r ~/.customenv.sh && source ~/.customenv.sh
|
|
||||||
source_if_exists ~/.this-machine-env.sh
|
|
@ -1,6 +1,6 @@
|
|||||||
source "$HOME/.lib/setup_functions.sh"
|
source "$HOME/.lib/setup_functions.sh"
|
||||||
|
|
||||||
function _setup_env {
|
function _setup_path {
|
||||||
_path_helper
|
_path_helper
|
||||||
|
|
||||||
# XXX/TODO:
|
# XXX/TODO:
|
||||||
@ -20,13 +20,11 @@ function _setup_env {
|
|||||||
_rust_setup
|
_rust_setup
|
||||||
_tex_setup
|
_tex_setup
|
||||||
|
|
||||||
# This makes systemd aware of change to $PATH
|
|
||||||
run_if_exists systemctl --user import-environment PATH DISPLAY XAUTHORITY HOME
|
|
||||||
|
|
||||||
# To ensure that things in ~/.lib/bin take precedence
|
# To ensure that things in ~/.lib/bin take precedence
|
||||||
add_to_path "$HOME/.lib/bin" --before
|
add_to_path "$HOME/.lib/bin" --before
|
||||||
|
|
||||||
export ENVIRONMENT_SETUP_DONE="$(date)"
|
# This makes systemd aware of change to $PATH
|
||||||
|
run_if_exists systemctl --user import-environment PATH DISPLAY XAUTHORITY HOME
|
||||||
}
|
}
|
||||||
|
|
||||||
function _linux_path_setup {
|
function _linux_path_setup {
|
||||||
|
@ -10,11 +10,22 @@ function j() {
|
|||||||
}
|
}
|
||||||
environment_variable_exists INSIDE_EMACS && inside_emacs_hook
|
environment_variable_exists INSIDE_EMACS && inside_emacs_hook
|
||||||
|
|
||||||
# XXX: This used to be in shellenv and should be moved back once these
|
# TODO(imalison): These need to run every time because of how their
|
||||||
# are faster.
|
# version managers work. This could cause problems with the situation
|
||||||
_node_setup
|
# where we want to intentionally override the python/ruby/node
|
||||||
_ruby_setup
|
# versions in use in a given shell.
|
||||||
|
|
||||||
|
# TODO: Ruby and node are disabled to speed up shell startup...
|
||||||
|
# See https://github.com/creationix/nvm/issues/709 for nvm
|
||||||
|
# _node_setup
|
||||||
|
|
||||||
|
# XXX: these were moved to _setup_env
|
||||||
|
# _ruby_setup
|
||||||
|
# _python_setup
|
||||||
|
# _node_setup
|
||||||
|
# _ruby_setup
|
||||||
|
|
||||||
# travis completion
|
# travis completion
|
||||||
# XXX: Disabled to reduce performance impact
|
# XXX: Disabled to reduce performance impact
|
||||||
# [ -f "$HOME/.travis/travis.sh" ] && source "$HOME/.travis/travis.sh"
|
# [ -f "$HOME/.travis/travis.sh" ] && source "$HOME/.travis/travis.sh"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: sh; -*-
|
# -*- mode: sh; -*-
|
||||||
|
|
||||||
# If there are issues with path, check /etc/profile for hard overrides of PATH.
|
# If there are issues with path, check /etc/profile for hard overrides of PATH.
|
||||||
source "$HOME/.lib/shellenv.sh"
|
source "$HOME/.lib/login.sh"
|
||||||
# XXX: prevents https://github.com/xmonad/xmonad/issues/86 from affecting startup
|
# XXX: prevents https://github.com/xmonad/xmonad/issues/86 from affecting startup
|
||||||
rm -f ~/.xmonad/xmonad.state
|
rm -f ~/.xmonad/xmonad.state
|
||||||
load_xkb_map.sh
|
load_xkb_map.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user