43 lines
829 B
Bash
Executable File
43 lines
829 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Adapted from Junegunn Choi (junegunn.c@gmail.com)
|
|
# https://github.com/junegunn/dotfiles/blob/master/install
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
|
|
|
BASE=$(pwd)
|
|
IS_MAC=0
|
|
IS_LINUX=0
|
|
IS_FREEBSD=0
|
|
case $(uname -s) in
|
|
Darwin) IS_MAC=1 ;;
|
|
Linux) IS_LINUX=1 ;;
|
|
FreeBSD) IS_FREEBSD=1 ;;
|
|
*) echo "Unknown OS" ;;
|
|
esac
|
|
|
|
# RC files
|
|
|
|
mkdir -pv bak
|
|
for rc in *rc *profile tmux.conf bashrc.d mutt ; do
|
|
if [ ! -r $rc ] ; then
|
|
continue
|
|
fi
|
|
[ "$(realpath ~/."$rc")" == "$BASE/$rc" ]
|
|
if [ $? -ne 0 ] ; then
|
|
[ -e ~/."$rc" ] && mv -v ~/."$rc" bak/."$rc"
|
|
ln -sfv "$BASE/$rc" ~/."$rc"
|
|
fi
|
|
done
|
|
|
|
# scripts
|
|
mkdir -p ~/bin
|
|
for bin in $BASE/bin/*; do
|
|
BIN_NAME=$(basename $bin)
|
|
[ "$(realpath ~/bin/$BIN_NAME)" == "$bin" ]
|
|
if [ $? -ne 0 ] ; then
|
|
ln -svf "$bin" ~/bin
|
|
fi
|
|
done
|
|
|