Created
March 16, 2017 02:49
-
-
Save bharat-p/3a933514f4bd08c42c65d0ce982fb33a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OLDWD=`pwd` | |
finish() { | |
cd $OLDWD | |
} | |
set -e | |
trap finish exit | |
setup() { | |
local OWN_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |
local config_dir="$HOME/user-config" | |
mkdir "${config_dir}" 2> /dev/null | |
cd "${config_dir}" | |
if [[ ! -d "${HOME}/bin" ]]; then | |
echo "${HOME}/bin doesn't exist" | |
mkdir "${HOME}/bin" || echo "Failed to create bin directory." && exit 1 | |
fi | |
# ~/bin/already exist, so just create symlink for tmx into existing bin | |
if [ ! -f "${HOME}/bin/tmx" ]; then | |
echo "Creating symlink: ${HOME}/bin/tmx -> ${config_dir}/bin/tmx" | |
ln -s "${config_dir}/bin/tmx" "${HOME}/bin/tmx" | |
else | |
echo "${HOME}/bin/tmx already exist." | |
fi | |
wget -O .bash_profile https://gist.github.com/hungrykoder/739edf831fe260033ccb0684afa0f13c/raw/1455a8b45571c6c061da71c36a58024f439c4e5f/.bash_profile | |
wget -O .tmux.conf https://gist.githubusercontent.com/hungrykoder/a895dd98340a66054aed157e8fb87e63/raw/5d52986aa6f39fb1400ac867fb16e1a2fcee4c79/tmux.conf | |
wget -O tmx https://gist.githubusercontent.com/hungrykoder/2f6fd7742dacf54f304a4492b8f67351/raw/f53d49653ff8e67afa17b6e0da02524e6b5c7ca3/tmx | |
local files_to_link=(".bash_profile" ".tmux.conf" ".vimrc") | |
for file_name in "${files_to_link[@]}" | |
do | |
if [ -f "${config_dir}/${file_name}" ]; then | |
if [ ! -f "${HOME}/${file_name}" ]; then | |
echo "Creating symlink: ${HOME}/${file_name} -> ${config_dir}/${file_name}" | |
ln -s "${config_dir}/${file_name}" "${config_dir}/${file_name}" | |
else | |
echo "${HOME}/${file_name} already exist." | |
fi | |
fi | |
done | |
} | |
setup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment