chore: Update symlinks in update.sh and functions.sh
feat: symlinks in config.yaml fix: vscode tracking bullshit
This commit is contained in:
parent
7fa255179e
commit
f532a924fb
@ -54,26 +54,43 @@ groups() {
|
|||||||
ensure_user_groups
|
ensure_user_groups
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure_symlink() {
|
||||||
|
source=$(cat $HOME/dotfiles/config/config.yaml | shyaml get-values config.symlinks.$1.source) &>/dev/null
|
||||||
|
target=$(cat $HOME/dotfiles/config/config.yaml | shyaml get-value config.symlinks.$1.target) &>/dev/null
|
||||||
|
|
||||||
|
# Based on the OS_TYPE, get the correct source
|
||||||
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
source=$(cat $HOME/dotfiles/config/config.yaml | shyaml get-value config.symlinks.$1.sources.linux) &>/dev/null
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
source=$(cat $HOME/dotfiles/config/config.yaml | shyaml get-value config.symlinks.$1.sources.macos) &>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Try adding a default source if the OS_TYPE specific source is empty
|
||||||
|
if [ -z "$source" ]; then
|
||||||
|
source=$(cat $HOME/dotfiles/config/config.yaml | shyaml get-value config.symlinks.$1.source) &>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If this is still empty, we can't continue and should throw up an error
|
||||||
|
if [ -z "$source" ]; then
|
||||||
|
printfe "%s\n" "red" " - No valid source defined for $1"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_or_make_symlink $source $target
|
||||||
|
}
|
||||||
|
|
||||||
symlinks() {
|
symlinks() {
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
# Update symlinks
|
# Update symlinks
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
|
|
||||||
printfe "%s\n" "cyan" "Updating config symlinks..."
|
# Load symlinks from config file
|
||||||
check_or_make_symlink ~/.zshrc ~/dotfiles/.zshrc
|
symlinks=($(cat $HOME/dotfiles/config/config.yaml | shyaml keys config.symlinks))
|
||||||
check_or_make_symlink ~/.config/Code/User/settings.json ~/dotfiles/vscode/settings.json
|
printfe "%s\n" "cyan" "Updating symlinks..."
|
||||||
check_or_make_symlink ~/.config/starship.toml ~/dotfiles/config/starship.toml
|
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.macos
|
|
||||||
else
|
|
||||||
check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.linux
|
|
||||||
fi
|
|
||||||
|
|
||||||
check_or_make_symlink ~/.ssh/config ~/dotfiles/config/ssh/config
|
|
||||||
check_or_make_symlink ~/.ssh/config.d ~/dotfiles/config/ssh/config.d
|
|
||||||
check_or_make_symlink ~/.config/alacritty/alacritty.toml ~/dotfiles/config/alacritty.toml
|
|
||||||
|
|
||||||
|
for symlink in $symlinks; do
|
||||||
|
ensure_symlink $symlink
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
sys_packages() {
|
sys_packages() {
|
||||||
|
@ -164,7 +164,8 @@ check_or_make_symlink() {
|
|||||||
fi
|
fi
|
||||||
mkdir -p $(dirname $1)
|
mkdir -p $(dirname $1)
|
||||||
ln -s $2 $1
|
ln -s $2 $1
|
||||||
printfe "%s\n" "green" " - Created symlink $1 -> $2"
|
printfe "%s\n" "green" " - Created symlink $2 -> $1"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Confirm the symlink that already exists point to the correct location
|
# Confirm the symlink that already exists point to the correct location
|
||||||
@ -177,9 +178,20 @@ check_or_make_symlink() {
|
|||||||
rm $1
|
rm $1
|
||||||
mkdir -p $(dirname $1)
|
mkdir -p $(dirname $1)
|
||||||
ln -s $2 $1
|
ln -s $2 $1
|
||||||
printfe "%s\n" "green" " Created symlink $1 -> $2"
|
printfe "%s\n" "green" " Created symlink $2 -> $1"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -L $1 ]; then
|
||||||
|
printfe "%s\n" "red" " - Failed to create symlink $2 -> $1"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
printfe "%s" "green" " - OK: "
|
||||||
|
printfe "%-30s" "blue" "$1"
|
||||||
|
printfe "%s" "cyan" " -> "
|
||||||
|
printfe "%-30s\n" "blue" "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_line() {
|
clear_line() {
|
||||||
|
@ -29,6 +29,7 @@ render_timer = false
|
|||||||
|
|
||||||
[font]
|
[font]
|
||||||
size = 14.0
|
size = 14.0
|
||||||
|
family = "Hack Nerd Font"
|
||||||
|
|
||||||
[font.bold]
|
[font.bold]
|
||||||
family = "Hack Nerd Font"
|
family = "Hack Nerd Font"
|
||||||
|
@ -1,4 +1,46 @@
|
|||||||
config:
|
config:
|
||||||
|
# Symbolic links to create
|
||||||
|
symlinks:
|
||||||
|
# Gitconfig
|
||||||
|
gitconfig:
|
||||||
|
sources:
|
||||||
|
macos: ~/dotfiles/config/gitconfig.macos
|
||||||
|
linux: ~/dotfiles/config/gitconfig.linux
|
||||||
|
target: ~/.gitconfig
|
||||||
|
|
||||||
|
# SSH config
|
||||||
|
ssh:
|
||||||
|
source: ~/dotfiles/config/ssh/config
|
||||||
|
target: ~/.ssh/config
|
||||||
|
|
||||||
|
ssh_config_d:
|
||||||
|
source: ~/dotfiles/config/ssh/config.d
|
||||||
|
target: ~/.ssh/config.d
|
||||||
|
|
||||||
|
# Zshrc
|
||||||
|
zshrc:
|
||||||
|
source: ~/dotfiles/.zshrc
|
||||||
|
target: ~/.zshrc
|
||||||
|
|
||||||
|
# VSCode settings
|
||||||
|
vscode:
|
||||||
|
source: ~/dotfiles/vscode/settings.json
|
||||||
|
target: ~/.config/Code/User/settings.json
|
||||||
|
|
||||||
|
vscode-argv:
|
||||||
|
source: ~/dotfiles/vscode/argv.json
|
||||||
|
target: ~/.vscode/argv.json
|
||||||
|
|
||||||
|
# Starship config
|
||||||
|
starship:
|
||||||
|
source: ~/dotfiles/config/starship.toml
|
||||||
|
target: ~/.config/starship.toml
|
||||||
|
|
||||||
|
# Alacritty config
|
||||||
|
alacritty:
|
||||||
|
source: ~/dotfiles/config/alacritty.toml
|
||||||
|
target: ~/.config/alacritty/alacritty.toml
|
||||||
|
|
||||||
# What groups users should be added
|
# What groups users should be added
|
||||||
user_groups:
|
user_groups:
|
||||||
menno:
|
menno:
|
||||||
@ -109,7 +151,7 @@ config:
|
|||||||
- vim
|
- vim
|
||||||
- sl
|
- sl
|
||||||
- jq
|
- jq
|
||||||
- just
|
# - just
|
||||||
- libglvnd-dev
|
- libglvnd-dev
|
||||||
- libwayland-dev
|
- libwayland-dev
|
||||||
- libseat-dev
|
- libseat-dev
|
||||||
|
3
vscode/argv.json
Normal file
3
vscode/argv.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"enable-crash-reporter": false,
|
||||||
|
}
|
@ -17,5 +17,5 @@
|
|||||||
"[json]": {
|
"[json]": {
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
},
|
},
|
||||||
"git.openRepositoryInParentFolders": "never",
|
"git.openRepositoryInParentFolders": "always",
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user