From 05d73a54ed05447a7eb5332c2b92d47a1b7a20bc Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sun, 12 Dec 2021 11:15:19 +0100 Subject: [PATCH] made tpm integration and patching more robust, fixes #540 --- .tmux.conf | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index cc8ecd0..a9b1be8 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1371,26 +1371,31 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # 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) +# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git fetch -q -p && git checkout -q master && git reset -q --hard origin/master) # fi # if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then -# perl -0777 -p -i -e 's/git clone/git clone --depth 1/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"& -# perl -p -i -e 's,\$tmux_file\s+>/dev/null\s+2>\&1,$& || { tmux display "Plugin \$(basename \${plugin_path}) failed" && false; },' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/source_plugins.sh"& -# wait +# perl -0777 -p -i -e 's/git clone(?!\s+--depth\s+1)/git clone --depth 1/g +# ;s/(install_plugin(.(?!&))*)\n(\s+)done/\1&\n\3done\n\3wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh" +# perl -p -i -e 's/git submodule update --init --recursive(?!\s+--depth\s+1)/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh" +# perl -p -i -e 's,\$tmux_file\s+>/dev/null\s+2>\&1,$& || { tmux display "Plugin \$(basename \${plugin_path}) failed" && false; },' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/source_plugins.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/install_plugins" > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ +# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \ +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ +# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \ # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ +# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \ # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ # tmux display 'Done updating tpm and plugins...' # } || tmux display 'Failed updating tpm and plugins...' # elif [ x"$install_tpm" = x"true" ]; then -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 -# tmux display 'Done installing tpm and plugins...' +# { +# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \ +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 +# tmux display 'Done installing tpm and plugins...' +# } || tmux display 'Failed installing tpm and plugins...' # fi # else # tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..."