diff --git a/files.sh b/files.sh new file mode 100644 index 0000000..2d9ee1f --- /dev/null +++ b/files.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +FILES=( + ".bash_logout" + ".bashrc" + ".config" + ".gitconfig" + ".gitignore" + ".gitignore_global" + ".hgignore_global" + ".profile" + ".rc.d" + ".yarnrc" + ".zprofile" + ".zshenv" + ".zsh_functions" + ".zshrc" +) diff --git a/import.sh b/import.sh new file mode 100755 index 0000000..b6b03c4 --- /dev/null +++ b/import.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/files.sh" + +cd "$SCRIPT_DIR" || exit 1 + +for file in "${FILES[@]}"; do + if [ -e "../$file" ] || [ -L "../$file" ]; then + cp -r "../$file" ./ + fi +done + diff --git a/install.sh b/install.sh index 2e68d47..44f4adc 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,13 @@ -#! /usr/bin/env sh -cp .gitconfig .gitignore .gitignore_global ../ -cp .hgignore_global ../ -cp .profile ../ -cp .bash_logout .bashrc ../ -cp -r .zsh_functions .zprofile .zshenv .zshrc ../ -cp -r .rc.d ../ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/files.sh" + +cd "$SCRIPT_DIR" || exit 1 + +for file in "${FILES[@]}"; do + if [ -e "./$file" ] || [ -L "./$file" ]; then + cp -r "./$file" ../ + fi +done +