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

133 lines
4.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# TODO: quiet/auto-agree mode for curl | bash automagic?
dfp=$(cd "$(dirname "${BASH_SOURCE[0]}" )/.." && pwd)
source "${dfp}/env/common/setup_helpers.bash"
export DOTFILES_PATH="${DOTFILES_PATH:-$dfp}"
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
test ! -d "$HOME/.env" && "$dfp/bin/choose-common-env"
INTERACTIVE=1
while test $# -gt 0; do
case "$1" in
-x|--non-interactive)
INTERACTIVE=0
shift
;;
esac
done
links=(
# desktop environment files
"apps/de/sway/config" "$XDG_CONFIG_HOME/sway/config"
"apps/de/sway/lock" "$XDG_CONFIG_HOME/swaylock/config"
"apps/de/mako/" "$XDG_CONFIG_HOME/mako"
"apps/de/sway/mimeapps.list" "$XDG_CONFIG_HOME/mimeapps.list"
"apps/de/sway/mimeapps.list" "$XDG_CONFIG_HOME/sway-mimeapps.list"
"apps/de/sway/mimeapps.list" "$HOME/.local/share/applications/mimeapps.list"
# shell files
"apps/shell/tmux/conf" "$HOME/.tmux.conf"
"apps/shell/tmux/layouts" "$HOME/.tmux/layouts"
"apps/shell/fish/" "$XDG_CONFIG_HOME/fish"
# text editor files
"apps/neovim/" "$XDG_CONFIG_HOME/nvim"
"env/common/colors/vim" "$XDG_CONFIG_HOME/nvim/colors/base16-donokai.vim"
"apps/emacs/" "$HOME/.emacs.lytedev"
# gtk configuration files
"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"
# bar files
"apps/de/waybar/" "$XDG_CONFIG_HOME/waybar"
# irc files
"apps/weechat/" "$HOME/.weechat"
# qutebrowser config files
"apps/qutebrowser/qutebrowser.conf" "$XDG_CONFIG_HOME/qutebrowser/qutebrowser.conf"
"apps/qutebrowser/keys.conf" "$XDG_CONFIG_HOME/qutebrowser/keys.conf"
# sc-im config files and scripts
"apps/scim/rc" "$HOME/.scimrc"
"apps/scim/lua" "$HOME/.scim/lua"
# libinput configuration
"apps/de/libinput/gestures.conf" "$XDG_CONFIG_HOME/libinput-gestures.conf"
# nnn configuration
"apps/nnn/" "$XDG_CONFIG_HOME/nnn"
# kakoune editor configuration
"apps/kak/" "$XDG_CONFIG_HOME/kak"
# gpg config
"apps/gpg/agent.conf" "$HOME/.gnupg/gpg-agent.conf"
# document viewer
"apps/zathura/" "$XDG_CONFIG_HOME/zathura"
# htop
"apps/htop/rc" "$XDG_CONFIG_HOME/htop/htoprc"
# terminal emulator
"apps/alacritty/" "$XDG_CONFIG_HOME/alacritty"
# kitty config
"apps/kitty/" "$XDG_CONFIG_HOME/kitty"
# ranger config
"apps/ranger/" "$XDG_CONFIG_HOME/ranger"
# mutt config
"apps/mutt/rc" "$XDG_CONFIG_HOME/.muttrc"
"apps/mutt/rc" "$HOME/.muttrc"
# git config
"apps/git/config" "$HOME/.gitconfig"
# fontconfig
"apps/de/fontconfig/" "$XDG_CONFIG_HOME/fontconfig"
# fontconfig
"apps/elixir/iex.exs" "$HOME/.iex.exs"
# XDG user directories
"apps/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs"
# Music Player Daemon
"apps/mpd" "$XDG_CONFIG_HOME/mpd"
# MPD client
"apps/ncmpcpp" "$HOME/.ncmpcpp"
# XDG user directories
"env/nix/pkgs" "$XDG_CONFIG_HOME/nixpkgs"
# Kanshi configuration
"apps/de/kanshi" "$XDG_CONFIG_HOME/kanshi"
)
# TODO: pass interactive?
_dotfiles_setup_run_setup "$HOME/.using-lytedev-dotfiles.lock" "${links[@]}"
if [[ "$INTERACTIVE" = 1 ]]; then
echo -n -e "Do you want to run the env/common/sudo_setup script for changes to /etc"
echo -n -e "\nand other root directories?"
read -r -p " [y/N] " response
response=${response,,} # to lower case
if [[ $response =~ ^(yes|y)$ ]]; then
"$dfp/env/common/sudo_setup"
fi
# execute the user's shell
ush="$(getent passwd $LOGNAME | cut -d: -f7)"
echo -e "Dotfiles Installed! Running 'exec $ush'...\n"
exec "$ush"
fi