install.fairie/dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_onchange_after_60-cleanup

32 lines
915 B
Text
Raw Normal View History

{{ if or (eq .chezmoi.os "linux") (eq .chezmoi.os "darwin") }}
#!/bin/sh
source "$HOME/.config/shell/exports"
echo 'Cleaning up unnecessary artifacts'
rm -rf ~/AppData
{{ if or (eq .chezmoi.os "linux") }}
rm -rf ~/Library
{{ end }}
logg 'Ensuring Taskfiles are linked properly'
if [ -d "$HOME/.local/shared-common" ]; then
cp ~/.local/shared-common/Taskfile.yml ~/.local/Taskfile.yml
sed -i 's/\.\/\.config\/taskfiles/taskfiles/g' ~/.local/Taskfile.yml
ln -s ~/.local/taskfiles ~/.local/shared-common/common/.config/taskfiles
fi
{{ if (eq .chezmoi.os "darwin") }}
if command -v gsed > /dev/null; then
gsed -i 's/\.\/\.config\/taskfiles/taskfiles/g' ~/.local/Taskfile.yml
else
logg 'Unable to fix `~/.local/Taskfile.yml` because gsed GNU compatibility tool is not installed.'
fi
{{ end }}
{{ else if chezmoi.os "windows" }}
Remove-Item -LiteralPath "$env:HOMEPATH\Library" -Force -Recurse
{{ end }}