Various small changes from the last week or so
This commit is contained in:
@@ -7,7 +7,7 @@ copy_file() {
|
||||
local to=$2
|
||||
local filename=$(basename $from)
|
||||
[[ -e $to/$filename ]] && rm $to/$filename
|
||||
echo_and_execute cp -p $from $to/$filename
|
||||
echo_and_execute cp -RPp $from $to/$filename
|
||||
}
|
||||
|
||||
copy_dir() {
|
||||
@@ -17,7 +17,7 @@ copy_dir() {
|
||||
local directories=(`find . -mindepth 1 -maxdepth 1 -type d`)
|
||||
for dir in $directories; do
|
||||
[[ -d $to/$dir ]] && rm -rf $to/$dir
|
||||
echo_and_execute cp -rp $dir $to/$dir
|
||||
echo_and_execute cp -RPp $dir $to/$dir
|
||||
done
|
||||
local files=(`find . -mindepth 1 -maxdepth 1 -type f`)
|
||||
for file in $files; do
|
||||
@@ -26,30 +26,34 @@ copy_dir() {
|
||||
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_and_execute ln -s $src_dir $link_dir
|
||||
sym_link() {
|
||||
[[ ! -e "$1" ]] && echo "skipping link, target does not exist: $1" && return
|
||||
[[ -h "$2" ]] && rm $2
|
||||
[[ -f "$2" || -d "$2" ]] && rm -rf $2
|
||||
echo_and_execute ln -s $1 $2
|
||||
}
|
||||
|
||||
echo "---- copying dotfiles ------------------------------------------------"
|
||||
|
||||
copy_file src_files/.config/zsh/.zshenv $HOME # duplicate, copy anyway, ensures $ZDOTDIR
|
||||
echo "---- copying dotfiles ------------------"
|
||||
source src_files/.config/zsh/.zshenv
|
||||
copy_file src_files/.config/zsh/.zshenv $HOME # copy first, ensure $ZDOTDIR set
|
||||
|
||||
# configs/executables/scripts from .config and .local
|
||||
copy_dir src_files/.config $XDG_CONFIG_HOME
|
||||
copy_dir src_files/.local/bin $DIR_BIN
|
||||
[[ "$OSTYPE" = *"darwin"* ]] && copy_dir src_files/bin_overrides_macos $DIR_BIN
|
||||
copy_dir src_files/.local/scripts $DIR_SCRIPTS
|
||||
|
||||
# macOS overrides as needed
|
||||
[[ "$OSTYPE" = *"darwin"* ]] && copy_dir src_files/bin_overrides_macos $DIR_BIN
|
||||
|
||||
# obsidian uses a per-vault config model, so copy to all target vaults/dirs
|
||||
for obs_dir in "${OBSIDIAN_WORKSPACES_TO_CONFIGURE[@]}"; do
|
||||
[[ ! -d "$obs_dir/.obsidian" ]] && mkdir "$obs_dir/.obsidian"
|
||||
copy_dir $XDG_CONFIG_HOME/obsidian "$obs_dir/.obsidian"
|
||||
done
|
||||
|
||||
# TODO: get reaper config set up
|
||||
# [[ $1 = "studio-music" ]] {
|
||||
# [[ "$OSTYPE" = *"darwin"* ]] &&
|
||||
# link_dir "$XDG_CONFIG_HOME/REAPER" "$HOME/Library/Application Support/REAPER" # TODO: get reaper config set up
|
||||
# sym_link "$XDG_CONFIG_HOME/REAPER" "$HOME/Library/Application Support/REAPER"
|
||||
# }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user