This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/common/bin/dotfiles-setup

65 lines
1.8 KiB
Text
Raw Normal View History

2021-03-03 01:05:58 -06:00
#!/usr/bin/env fish
2021-03-25 09:04:51 -05:00
# This script's purpose is to setup the dotfiles configuration for an existing
# and provisioned machine. For provisioning, see `./dotfiles-init`.
2021-03-03 01:05:58 -06:00
set dfp (realpath (dirname (status -f))/../..)
set lock_file $HOME/.using-lytedev-dotfiles.lock
2021-03-06 22:07:30 -06:00
if not test -f $lock_file
echo This will delete existing files. Make sure you know what you\'re doing.
2021-05-10 13:29:39 -05:00
printf 'Are you sure you want to continue? [y/N] '
read response
2021-03-06 22:07:30 -06:00
set response (string lower $response)
if string match $response y
echo "agreed" > "$lock_file"
else
exit 1
end
end
2021-03-03 01:05:58 -06:00
set -q XDG_CONFIG_HOME || set XDG_CONFIG_HOME $HOME/.config
2021-03-06 22:07:30 -06:00
set h $HOME; set c $XDG_CONFIG_HOME
if test -d $c/lytedev-env
echo "Warning: no environment-specific configuration detected!"
2021-03-03 01:05:58 -06:00
end
2021-03-06 22:07:30 -06:00
function l -a dot -a target -d "Symlink a dotfile configuration file or directory"
if test -L $target || test -f $target || test -d $target
rm -rf "$target"
end
# check if the directory that will contain the link exists
set -l d (dirname $target)
test -d $d || mkdir -p $d
ln -s (pwd)/$dot $target
echo Linked $dot to $target
end
2021-03-03 01:05:58 -06:00
2021-03-06 22:07:30 -06:00
pushd $dfp
2021-03-03 01:05:58 -06:00
l common/tmux/conf $h/.tmux.conf
l common/fish $c/fish
l common/neovim $c/nvim
l common/colors/vim $c/nvim/colors/base16-donokai.vim
l common/weechat $h/.weechat
l common/scim/rc $h/.scimrc
l common/scim/lua $h/.scim/lua
l common/nnn $c/nnn
l common/kak $c/kak
l common/gpg/agent.conf $h/.gnupg/gpg-agent.conf
l common/htop/rc $c/htop/htoprc
l common/kitty $c/kitty
2021-05-10 13:29:39 -05:00
l common/mutt/rc $h/.muttrc
2021-03-03 01:05:58 -06:00
l common/git/config $h/.gitconfig
l common/elixir/iex.exs $h/.iex.exs
l common/data/user-dirs $c/user-dirs.dirs
2021-03-06 22:07:30 -06:00
popd
2021-03-03 01:05:58 -06:00
2021-03-06 22:07:30 -06:00
for s in $c/lytedev-env/*/dotfiles-setup.d.fish
source $s $dfp $h $c
end
2021-03-03 01:05:58 -06:00
# execute the user's shell
set ush (getent passwd $LOGNAME | cut -d: -f7)
2021-03-25 09:04:51 -05:00
echo "Dotfiles Installed! Don't forget to setup environments!"
2021-03-03 01:05:58 -06:00
exec $ush