25 lines
644 B
Bash
Executable File
25 lines
644 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
source "$SCRIPT_DIR/install_files"
|
|
|
|
cd "$SCRIPT_DIR" || exit 1
|
|
|
|
# Copy files and directories
|
|
for file in "${INSTALL_FILES[@]}"; do
|
|
if [ -e "./$file" ] || [ -L "./$file" ]; then
|
|
cp -r "./$file" "$HOME/"
|
|
fi
|
|
done
|
|
|
|
# Ensure ~/.bashrc and ~/.zshrc exist and source ~/.init_profile
|
|
SOURCE_LINE='[ -f "$HOME/.init_profile" ] && . "$HOME/.init_profile"'
|
|
|
|
for rc in "$HOME/.bashrc" "$HOME/.zshrc"; do
|
|
touch "$rc"
|
|
if ! grep -qF "$SOURCE_LINE" "$rc"; then
|
|
printf "\n# Initialize profile environment\n%s\n" "$SOURCE_LINE" >> "$rc"
|
|
fi
|
|
done
|
|
|