51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 KiB
Bash
Executable File
#!/bin/zsh
|
|
|
|
execute() { echo "executing: $@" && "$@" }
|
|
|
|
copy_file() {
|
|
local from=$1
|
|
local to=$2
|
|
local filename=$(basename $from)
|
|
[[ -e $to/$filename ]] && execute rm $to/$filename
|
|
execute cp -p $from $to/$filename
|
|
}
|
|
|
|
copy_dir() {
|
|
local from=$1
|
|
local to=$2
|
|
pushd $from > /dev/null
|
|
local directories=(`find . -mindepth 1 -maxdepth 1 -type d`)
|
|
for dir in $directories; do
|
|
[[ -d $to/$dir ]] && execute rm -rf $to/$dir
|
|
execute cp -rp $dir $to/$dir
|
|
done
|
|
local files=(`find . -mindepth 1 -maxdepth 1 -type f`)
|
|
for file in $files; do
|
|
copy_file $file $to
|
|
done
|
|
popd > /dev/null
|
|
}
|
|
|
|
link_dir() {
|
|
local src_dir=$1
|
|
local link_dir=$2
|
|
[[ -h "$link_dir" ]] && rm $link_dir
|
|
[[ -d "$link_dir" ]] && rm -rf $link_dir
|
|
echo "sym-linking $link_dir -> $src_dir"
|
|
ln -s $src_dir $link_dir
|
|
}
|
|
|
|
echo "---- copying dotfiles -------------------------"
|
|
|
|
copy_file src_files/.config/zsh/.zshenv $HOME # duplicate, copy anyway, ensures $ZDOTDIR
|
|
|
|
copy_dir src_files/.config $XDG_CONFIG_HOME
|
|
copy_dir src_files/.local/bin $DIR_BIN
|
|
copy_dir src_files/.local/scripts $DIR_SCRIPTS
|
|
|
|
[[ "$BOX_SETUP_OS" = "macos" ]] &&
|
|
# link_dir "$XDG_CONFIG_HOME/REAPER" "$HOME/Library/Application Support/REAPER" && # TODO: get reaper config set up
|
|
copy_dir src_files/executable_wrappers_macos $DIR_BIN
|
|
link_dir "$XDG_CONFIG_HOME/GIMP" "$HOME/Library/Application Support/GIMP"
|
|
|