[feature] skip installation if already installed

This commit is contained in:
Klesh Wong 2020-10-29 14:38:10 +08:00
parent 060f02c9ef
commit 3d4c28abc6

View File

@ -8,21 +8,23 @@ TMUX_VER=3.1b
# install ranger # install ranger
case "$PM" in case "$PM" in
apt) apt)
sudo apt install libevent-dev libncurses5-dev bison autoconf bc -y if which tmux &>/dev/null && [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then
TMUX_SRC_URL=https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz sudo apt install libevent-dev libncurses5-dev bison autoconf bc -y
if in-china; then TMUX_SRC_URL=https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz
TMUX_SRC_URL=https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz if in-china; then
TMUX_SRC_URL=https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz
fi
[ ! -f /tmp/tmux.tar.gz ] && curl -L $TMUX_SRC_URL -o /tmp/tmux.tar.gz
rm -rf /tmp/tmux
mkdir -p /tmp/tmux
tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux --strip 1
pushd /tmp/tmux
[ -f autogen.sh ] && sh autogen.sh
./configure && make
sudo make install
popd
rm -rf /tmp/tmux*
fi fi
[ ! -f /tmp/tmux.tar.gz ] && curl -L $TMUX_SRC_URL -o /tmp/tmux.tar.gz
rm -rf /tmp/tmux
mkdir -p /tmp/tmux
tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux --strip 1
pushd /tmp/tmux
[ -f autogen.sh ] && sh autogen.sh
./configure && make
sudo make install
popd
rm -rf /tmp/tmux*
;; ;;
pacman) pacman)
sudo pacman -S --needed tmux bc sudo pacman -S --needed tmux bc
@ -31,4 +33,5 @@ esac
# symlink configuration # symlink configuration
lnsf $DIR/tmux.conf ~/.tmux.conf lnsf $DIR/tmux.conf ~/.tmux.conf
lnsf $DIR/config $XDG_CONFIG_HOME/tmux lnsf $DIR/config/tmux2.8.conf $XDG_CONFIG_HOME/tmux/tmux2.8.conf
lnsf $DIR/config/tmux2.9.conf $XDG_CONFIG_HOME/tmux/tmux2.9.conf