mirror of
1
0
Fork 0

check connectivity to github.com before installing and/or updating tpm and plugins, fixes #513

This commit is contained in:
Gregory Pakosz 2021-08-29 11:02:08 +02:00
parent 4ef0626b6d
commit a63dc5c6a9
2 changed files with 29 additions and 22 deletions

View File

@ -1341,29 +1341,35 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_update_plugins_on_reload="$3"
#
# TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins}
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
# install_tpm=true
# tmux display 'Installing tpm and plugins...'
# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm"
# elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then
# update_tpm=true
# tmux display 'Updating tpm and plugins...'
# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master)
#
# if curl -Ikfs -o /dev/null --connect-timeout 2 --max-time 2 https://github.com; then
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
# install_tpm=true
# tmux display 'Installing tpm and plugins...'
# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm"
# elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then
# update_tpm=true
# tmux display 'Updating tpm and plugins...'
# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master)
# fi
# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then
# perl -0777 -p -i -e 's/git clone --recursive/git clone --recursive --depth 1 --shallow-submodules/g
# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"
# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
# fi
# if [ x"$update_tpm" = x"true" ]; then
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1
# tmux display 'Done updating tpm and plugins...'
# elif [ x"$install_tpm" = x"true" ]; then
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1
# tmux display 'Done installing tpm and plugins...'
# fi
# else
# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..."
# fi
# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then
# perl -0777 -p -i -e 's/git clone --recursive/git clone --recursive --depth 1 --shallow-submodules/g
# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"
# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
# fi
# if [ x"$update_tpm" = x"true" ]; then
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1
# tmux display 'Done updating tpm and plugins...'
# elif [ x"$install_tpm" = x"true" ]; then
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1
# tmux display 'Done installing tpm and plugins...'
# fi
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm"
#
# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm"
# if [ -z "$window_active" ] && [ $_tmux_version -lt 240 ]; then
# tmux run -b "sleep $(expr $(tmux display -p '#{display-time}') / 500) && tmux set display-time 3000 \; display 'This configuration will soon require tmux 2.4+' \; set -u display-time"
# fi

View File

@ -347,6 +347,7 @@ tmux_conf_copy_to_os_clipboard=false
# move status line to top
#set -g status-position top
# -- tpm -----------------------------------------------------------------------
# while I don't use tpm myself, many people requested official support so here