mirror of
https://github.com/samoshkin/tmux-config.git
synced 2026-01-04 00:38:01 +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 -e
|
||||||
set -u
|
set -u
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
is_app_installed() {
|
is_app_installed() {
|
||||||
type "$1" &>/dev/null
|
type "$1" &>/dev/null
|
||||||
@@ -11,13 +12,13 @@ REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
|
|||||||
cd "$REPODIR";
|
cd "$REPODIR";
|
||||||
|
|
||||||
if ! is_app_installed tmux; then
|
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"
|
Install it first\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then
|
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"
|
at default location: \$HOME/.tmux/plugins/tpm.\n"
|
||||||
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
|
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
|
||||||
fi
|
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"
|
printf "Found existing .tmux.conf in your \$HOME directory. Will create a backup at $HOME/.tmux.conf.bak\n"
|
||||||
fi
|
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
|
# 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
|
# 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 new -d -s __noop >/dev/null 2>&1 || true
|
||||||
tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins"
|
tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins"
|
||||||
"$HOME"/.tmux/plugins/tpm/bin/install_plugins || true
|
"$HOME"/.tmux/plugins/tpm/bin/install_plugins || true
|
||||||
tmux kill-session -t __noop >/dev/null 2>&1 || 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