mirror of
1
0
Fork 0

change backup method of install script

This commit is contained in:
Stefanos Kalantzis 2018-05-23 10:32:20 +02:00
parent 1e968aa3bd
commit 0d17ef3efc
2 changed files with 14 additions and 6 deletions

View File

@ -1,4 +1,12 @@
#!/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 )"
INST_DIR="$HOME/.oh-my-tmux"
@ -7,15 +15,12 @@ TMUX_CONF="$HOME/.tmux.conf"
# backup pre-existing
if [ -z "$SKIP_BACKUP" ]; then
if [ -r $TMUX_CONF ]; then
if [ -L $TMUX_CONF ]; then
ln -sf $TMUX_CONF "${TMUX_CONF}.bak.$(ls -l ${TMUX_CONF}.bak* 2>/dev/null | wc -l)"
else
cp $TMUX_CONF "${TMUX_CONF}.bak.$(ls -l ${TMUX_CONF}.bak* 2>/dev/null | wc -l)"
fi
BACKUP_NAME="${TMUX_CONF}.bak.$(ls -l ${TMUX_CONF}.bak* 2>/dev/null | wc -l)"
cat $TMUX_CONF > $BACKUP_NAME
fi
fi
# skip if already at INST_DIR
# skip step if already at INST_DIR
if [ "$(realpath $WD)" != "$(realpath $INST_DIR)" ]; then
rm -rf "$INST_DIR"
ln -sf "$WD" "$INST_DIR"

View File

@ -3,6 +3,9 @@
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
#
# @author gpakosz
# @author kidlike
#
# /!\ do not edit this file
# instead, override settings in the following files:
# - oh-my-tmux.local.conf