Skip to content

Commit 67bfffc

Browse files
committed
Make install script runnable on Alpine Linux bash. Do not use rsync,tput, etc
1 parent 867f377 commit 67bfffc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

install.sh

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
set -e
44
set -u
5+
set -o pipefail
56

67
is_app_installed() {
78
type "$1" &>/dev/null
@@ -11,13 +12,13 @@ REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
1112
cd "$REPODIR";
1213

1314
if ! is_app_installed tmux; then
14-
printf "$(tput setaf 1)WARNING:$(tput sgr0) \"tmux\" command is not found. \
15+
printf "WARNING: \"tmux\" command is not found. \
1516
Install it first\n"
1617
exit 1
1718
fi
1819

1920
if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then
20-
printf "$(tput setaf 1)WARNING:$(tput sgr0) Cannot found TPM (Tmux Plugin Manager) \
21+
printf "WARNING: Cannot found TPM (Tmux Plugin Manager) \
2122
at default location: \$HOME/.tmux/plugins/tpm.\n"
2223
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
2324
fi
@@ -26,16 +27,17 @@ if [ -e "$HOME/.tmux.conf" ]; then
2627
printf "Found existing .tmux.conf in your \$HOME directory. Will create a backup at $HOME/.tmux.conf.bak\n"
2728
fi
2829

29-
rsync -aq ./tmux/ "$HOME"/.tmux
30+
cp -f "$HOME/.tmux.conf" "$HOME/.tmux.conf.bak" 2>/dev/null || true
31+
cp -a ./tmux/. "$HOME"/.tmux/
32+
ln -sf .tmux/tmux.conf "$HOME"/.tmux.conf;
3033

31-
ln -sf --backup --suffix=.bak .tmux/tmux.conf "$HOME"/.tmux.conf;
32-
33-
# Install TPM plugins.
34+
# Install TPM plugins.
3435
# TPM requires running tmux server, as soon as `tmux start-server` does not work
3536
# create dump __noop session in detached mode, and kill it when plugins are installed
37+
printf "Install TPM plugins\n"
3638
tmux new -d -s __noop >/dev/null 2>&1 || true
3739
tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins"
3840
"$HOME"/.tmux/plugins/tpm/bin/install_plugins || true
3941
tmux kill-session -t __noop >/dev/null 2>&1 || true
4042

41-
printf "$(tput setaf 2)OK:$(tput sgr0) Completed\n"
43+
printf "OK: Completed\n"

0 commit comments

Comments
 (0)