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/bin/setup-dotfiles

147 lines
4.8 KiB
Text
Raw Normal View History

2017-02-07 16:16:45 -06:00
#!/usr/bin/env bash
2020-01-17 03:02:53 -06:00
# TODO: quiet/auto-agree mode for curl | bash automagic?
2020-11-06 00:31:43 -06:00
dfp=$(cd "$(dirname "${BASH_SOURCE[0]}" )/.." && pwd)
source "${dfp}/env/common/setup_helpers.bash"
2017-02-07 16:16:45 -06:00
2019-03-29 13:30:15 -05:00
INTERACTIVE=1
while test $# -gt 0; do
case "$1" in
-x|--non-interactive)
INTERACTIVE=0
shift
;;
esac
done
2017-02-07 16:16:45 -06:00
links=(
# desktop environment files
2020-03-24 12:05:08 -05:00
"apps/de/bspwm/rc" "$XDG_CONFIG_HOME/bspwm/bspwmrc"
"apps/de/bspwm/wallpapers" "$HOME/.fehbg"
"apps/de/sway/config" "$XDG_CONFIG_HOME/sway/config"
"apps/de/sway/lock" "$XDG_CONFIG_HOME/swaylock/config"
"apps/de/sxhkd/rc" "$XDG_CONFIG_HOME/sxhkd/sxhkdrc"
"apps/de/x/resources" "$HOME/.Xresources"
"apps/de/x/init" "$HOME/.xinitrc"
"apps/de/x/init" "$HOME/.vnc/xstartup"
"apps/de/x/profile" "$HOME/.xprofile"
"apps/de/x/modmap" "$HOME/.xmodmap"
"apps/de/compton/compton.conf" "$XDG_CONFIG_HOME/compton.conf"
"apps/de/dunst/rc" "$XDG_CONFIG_HOME/dunst/dunstrc"
"apps/de/mako/" "$XDG_CONFIG_HOME/mako"
2020-11-06 00:31:43 -06:00
"env/common/colors/xresources" "$HOME/.Xresources.colors"
2017-02-07 16:16:45 -06:00
# shell files
2020-03-24 12:05:08 -05:00
"apps/shell/bash/rc" "$HOME/.bashrc"
"apps/shell/bash/profile" "$HOME/.bash_profile"
"apps/shell/tmux/conf" "$HOME/.tmux.conf"
"apps/shell/tmux/layouts" "$HOME/.tmux/layouts"
"apps/shell/fish/" "$XDG_CONFIG_HOME/fish"
# text editor files
2020-03-24 12:05:08 -05:00
"apps/neovim/" "$XDG_CONFIG_HOME/nvim"
"apps/neovim/" "$HOME/.vim"
"apps/neovim/init.vim" "$HOME/.vimrc"
2020-11-06 00:31:43 -06:00
"env/common/colors/vim" "$XDG_CONFIG_HOME/nvim/colors/base16-donokai.vim"
2020-03-27 17:23:10 -05:00
"apps/emacs/" "$HOME/.emacs.lytedev"
2017-02-08 14:22:10 -06:00
2017-04-03 15:45:21 -05:00
# gtk configuration files
2020-03-24 12:05:08 -05:00
"apps/de/gtk/2rc" "$HOME/.gtkrc-2.0"
"apps/de/gtk/2rc" "$HOME/.gtkrc"
"apps/de/gtk/3settings.ini" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini"
2017-04-03 15:45:21 -05:00
2020-01-07 19:38:43 -06:00
# bar files
2020-03-24 12:05:08 -05:00
"apps/de/polybar/config" "$XDG_CONFIG_HOME/polybar/config"
"apps/de/waybar/" "$XDG_CONFIG_HOME/waybar"
2020-01-07 19:38:43 -06:00
# irc files
2020-03-24 12:05:08 -05:00
"apps/irssi/" "$HOME/.irssi"
"apps/weechat/" "$HOME/.weechat"
2017-05-05 01:47:33 -05:00
# qutebrowser config files
2020-03-24 12:05:08 -05:00
"apps/qutebrowser/qutebrowser.conf" "$XDG_CONFIG_HOME/qutebrowser/qutebrowser.conf"
"apps/qutebrowser/keys.conf" "$XDG_CONFIG_HOME/qutebrowser/keys.conf"
2017-04-03 14:38:53 -05:00
2019-02-27 23:29:49 -06:00
# sc-im config files and scripts
2020-03-24 12:05:08 -05:00
"apps/scim/rc" "$HOME/.scimrc"
"apps/scim/lua" "$HOME/.scim/lua"
2019-02-27 23:29:49 -06:00
2019-06-09 09:49:32 -05:00
# libinput configuration
2020-03-24 12:05:08 -05:00
"apps/de/libinput/gestures.conf" "$XDG_CONFIG_HOME/libinput-gestures.conf"
2019-06-09 09:49:32 -05:00
2020-06-17 17:11:24 -05:00
# kakoune editor configuration
"apps/kak/" "$XDG_CONFIG_HOME/kak"
2020-01-28 11:35:32 -06:00
# gpg config
2020-03-24 12:05:08 -05:00
"apps/gpg/agent.conf" "$HOME/.gnupg/gpg-agent.conf"
2020-01-28 11:35:32 -06:00
2018-08-09 09:40:14 -05:00
# document viewer
2020-03-24 12:05:08 -05:00
"apps/zathura/" "$XDG_CONFIG_HOME/zathura"
2018-08-09 09:40:14 -05:00
2019-10-31 10:46:50 -05:00
# htop
2020-03-24 12:05:08 -05:00
"apps/htop/rc" "$XDG_CONFIG_HOME/htop/htoprc"
2019-10-31 10:46:50 -05:00
# terminal emulator
2020-03-24 12:05:08 -05:00
"apps/alacritty/" "$XDG_CONFIG_HOME/alacritty"
2019-03-06 12:20:34 -06:00
# kitty config
2020-03-24 12:05:08 -05:00
"apps/kitty/" "$XDG_CONFIG_HOME/kitty"
2019-03-06 12:20:34 -06:00
# rofi config
2020-03-24 12:05:08 -05:00
"apps/rofi/config" "$XDG_CONFIG_HOME/rofi/config"
# ranger config
2020-03-24 12:05:08 -05:00
"apps/ranger/" "$XDG_CONFIG_HOME/ranger"
2017-12-21 12:18:17 -06:00
# mutt config
2020-03-24 12:05:08 -05:00
"apps/mutt/rc" "$XDG_CONFIG_HOME/.muttrc"
"apps/mutt/rc" "$HOME/.muttrc"
2017-07-27 13:00:48 -05:00
# neofetch config
2020-03-24 12:05:08 -05:00
"apps/neofetch/config" "$XDG_CONFIG_HOME/neofetch/config"
# git config
2020-03-24 12:05:08 -05:00
"apps/git/config" "$HOME/.gitconfig"
# fontconfig
2020-03-24 12:05:08 -05:00
"apps/de/fontconfig/" "$XDG_CONFIG_HOME/fontconfig"
2020-01-20 11:40:26 -06:00
# fontconfig
2020-03-24 12:05:08 -05:00
"apps/elixir/iex.exs" "$HOME/.iex.exs"
2020-01-20 11:40:26 -06:00
# XDG user directories
2020-03-24 12:05:08 -05:00
"apps/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs"
2020-10-23 11:01:31 -05:00
# Music Player Daemon
"apps/mpd" "$XDG_CONFIG_HOME/mpd"
# MPD client
"apps/ncmpcpp" "$HOME/.ncmpcpp"
2020-10-16 15:00:11 -05:00
# XDG user directories
"env/nix/pkgs" "$XDG_CONFIG_HOME/nixpkgs"
# Kanshi configuration
"apps/kanshi" "$XDG_CONFIG_HOME/kanshi"
2017-02-07 16:16:45 -06:00
)
2019-03-29 13:30:15 -05:00
# TODO: pass interactive?
2018-11-08 09:34:17 -06:00
_dotfiles_setup_run_setup "$dfp/.agreed-to-erasing-files.lock" "${links[@]}"
2019-03-29 13:30:15 -05:00
if [[ "$INTERACTIVE" = 1 ]]; then
2020-11-06 00:31:43 -06:00
echo -n -e "Do you want to run the env/common/sudo_setup script for changes to /etc"
2019-03-29 13:30:15 -05:00
echo -n -e "\nand other root directories?"
read -r -p " [y/N] " response
response=${response,,} # to lower case
if [[ $response =~ ^(yes|y)$ ]]; then
2020-11-06 00:31:43 -06:00
"$dfp/env/common/sudo_setup"
2019-03-29 13:30:15 -05:00
fi
2020-01-20 09:12:52 -06:00
# execute the user's shell
ush="$(getent passwd $LOGNAME | cut -d: -f7)"
2020-01-31 11:24:15 -06:00
echo -e "Dotfiles Installed! Running 'exec $ush'...\n"
2020-01-20 09:12:52 -06:00
exec "$ush"
2018-11-08 09:34:17 -06:00
fi