From c4b1af44b9045a42cc779ed32f8b737893f337ea Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Thu, 3 Sep 2026 13:19:17 -0700 Subject: [PATCH] Adds import script and uses a shared list of the files to copy. --- files.sh | 18 ++++++++++++++++++ import.sh | 13 +++++++++++++ install.sh | 20 +++++++++++++------- 3 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 files.sh create mode 100755 import.sh 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 +