dotfiles/cli/tmux.sh

43 lines
1.3 KiB
Bash
Raw Normal View History

2020-11-02 04:08:18 +00:00
#!/bin/sh
2020-09-17 10:40:17 +00:00
2020-11-02 04:08:18 +00:00
set -e
2020-11-08 16:26:14 +00:00
DIR=$(dirname "$(readlink -f "$0")")
2020-11-02 04:08:18 +00:00
. "$DIR/../env.sh"
2020-09-17 10:40:17 +00:00
2020-11-21 18:07:26 +00:00
log 'Setting up tmux'
2020-09-17 10:40:17 +00:00
case "$PM" in
apt)
2021-06-06 09:49:11 +00:00
TMUX_VER=3.2
2020-11-21 18:07:26 +00:00
if ! has_cmd tmux || [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then
sudo apt install libevent-dev libncurses5-dev bison autoconf bc -y
TMUX_SRC_URL=https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz
2021-06-06 09:49:11 +00:00
#if in_china; then
#TMUX_SRC_URL="https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz"
#fi
if [ ! -f /tmp/tmux.tar.gz ]; then
curl -L "$TMUX_SRC_URL" -o /tmp/tmux.tar.gz
fi
rm -rf /tmp/tmux
mkdir -p /tmp/tmux
tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux --strip 1
2020-11-02 04:08:18 +00:00
cd /tmp/tmux
if [ -f autogen.sh ]; then
sh autogen.sh
fi
./configure && make
sudo make install
2020-11-02 04:08:18 +00:00
cd -
2021-01-11 09:14:34 +00:00
rm -rf /tmp/tmux
2020-09-17 10:40:17 +00:00
fi
;;
pacman)
2020-11-21 18:07:26 +00:00
sudo pacman -S --noconfirm --needed tmux bc
2020-09-17 10:40:17 +00:00
;;
esac
# symlink configuration
2020-11-21 18:07:26 +00:00
lnsf "$DIR/tmux/tmux.conf" "$HOME/.tmux.conf"
lnsf "$DIR/tmux/tmux2.8.conf" "$XDG_CONFIG_HOME/tmux/tmux2.8.conf"
lnsf "$DIR/tmux/tmux2.9.conf" "$XDG_CONFIG_HOME/tmux/tmux2.9.conf"