change backup method of install script
This commit is contained in:
parent
1e968aa3bd
commit
0d17ef3efc
17
install.bsh
17
install.bsh
|
@ -1,4 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# https://github.com/gpakosz/.tmux
|
||||||
|
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
|
||||||
|
# without any warranty.
|
||||||
|
# Copyright 2012— Gregory Pakosz (@gpakosz).
|
||||||
|
#
|
||||||
|
# @author kidlike
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
WD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
WD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
INST_DIR="$HOME/.oh-my-tmux"
|
INST_DIR="$HOME/.oh-my-tmux"
|
||||||
|
@ -7,15 +15,12 @@ TMUX_CONF="$HOME/.tmux.conf"
|
||||||
# backup pre-existing
|
# backup pre-existing
|
||||||
if [ -z "$SKIP_BACKUP" ]; then
|
if [ -z "$SKIP_BACKUP" ]; then
|
||||||
if [ -r $TMUX_CONF ]; then
|
if [ -r $TMUX_CONF ]; then
|
||||||
if [ -L $TMUX_CONF ]; then
|
BACKUP_NAME="${TMUX_CONF}.bak.$(ls -l ${TMUX_CONF}.bak* 2>/dev/null | wc -l)"
|
||||||
ln -sf $TMUX_CONF "${TMUX_CONF}.bak.$(ls -l ${TMUX_CONF}.bak* 2>/dev/null | wc -l)"
|
cat $TMUX_CONF > $BACKUP_NAME
|
||||||
else
|
|
||||||
cp $TMUX_CONF "${TMUX_CONF}.bak.$(ls -l ${TMUX_CONF}.bak* 2>/dev/null | wc -l)"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# skip if already at INST_DIR
|
# skip step if already at INST_DIR
|
||||||
if [ "$(realpath $WD)" != "$(realpath $INST_DIR)" ]; then
|
if [ "$(realpath $WD)" != "$(realpath $INST_DIR)" ]; then
|
||||||
rm -rf "$INST_DIR"
|
rm -rf "$INST_DIR"
|
||||||
ln -sf "$WD" "$INST_DIR"
|
ln -sf "$WD" "$INST_DIR"
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
# without any warranty.
|
# without any warranty.
|
||||||
# Copyright 2012— Gregory Pakosz (@gpakosz).
|
# Copyright 2012— Gregory Pakosz (@gpakosz).
|
||||||
#
|
#
|
||||||
|
# @author gpakosz
|
||||||
|
# @author kidlike
|
||||||
|
#
|
||||||
# /!\ do not edit this file
|
# /!\ do not edit this file
|
||||||
# instead, override settings in the following files:
|
# instead, override settings in the following files:
|
||||||
# - oh-my-tmux.local.conf
|
# - oh-my-tmux.local.conf
|
||||||
|
|
Loading…
Reference in a new issue