mirror of
https://github.com/samoshkin/tmux-config.git
synced 2026-01-03 08:18:02 +00:00
Make install script runnable on Alpine Linux bash. Do not use rsync,tput, etc
This commit is contained in:
16
install.sh
16
install.sh
@@ -2,6 +2,7 @@
|
||||
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
is_app_installed() {
|
||||
type "$1" &>/dev/null
|
||||
@@ -11,13 +12,13 @@ REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
|
||||
cd "$REPODIR";
|
||||
|
||||
if ! is_app_installed tmux; then
|
||||
printf "$(tput setaf 1)WARNING:$(tput sgr0) \"tmux\" command is not found. \
|
||||
printf "WARNING: \"tmux\" command is not found. \
|
||||
Install it first\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then
|
||||
printf "$(tput setaf 1)WARNING:$(tput sgr0) Cannot found TPM (Tmux Plugin Manager) \
|
||||
printf "WARNING: Cannot found TPM (Tmux Plugin Manager) \
|
||||
at default location: \$HOME/.tmux/plugins/tpm.\n"
|
||||
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
|
||||
fi
|
||||
@@ -26,16 +27,17 @@ if [ -e "$HOME/.tmux.conf" ]; then
|
||||
printf "Found existing .tmux.conf in your \$HOME directory. Will create a backup at $HOME/.tmux.conf.bak\n"
|
||||
fi
|
||||
|
||||
rsync -aq ./tmux/ "$HOME"/.tmux
|
||||
cp -f "$HOME/.tmux.conf" "$HOME/.tmux.conf.bak" 2>/dev/null || true
|
||||
cp -a ./tmux/. "$HOME"/.tmux/
|
||||
ln -sf .tmux/tmux.conf "$HOME"/.tmux.conf;
|
||||
|
||||
ln -sf --backup --suffix=.bak .tmux/tmux.conf "$HOME"/.tmux.conf;
|
||||
|
||||
# Install TPM plugins.
|
||||
# Install TPM plugins.
|
||||
# TPM requires running tmux server, as soon as `tmux start-server` does not work
|
||||
# create dump __noop session in detached mode, and kill it when plugins are installed
|
||||
printf "Install TPM plugins\n"
|
||||
tmux new -d -s __noop >/dev/null 2>&1 || true
|
||||
tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins"
|
||||
"$HOME"/.tmux/plugins/tpm/bin/install_plugins || true
|
||||
tmux kill-session -t __noop >/dev/null 2>&1 || true
|
||||
|
||||
printf "$(tput setaf 2)OK:$(tput sgr0) Completed\n"
|
||||
printf "OK: Completed\n"
|
||||
|
||||
Reference in New Issue
Block a user