From f2cec06b3a0ce9bbc5967ad1b30ba6cb17c5f926 Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Thu, 29 Jul 2021 11:30:09 -0400 Subject: [PATCH] Updated bootstrap with modular bootstrap approach for multiOS --- .config/yadm/bootstrap | 46 +++++++++--------------- .config/yadm/bootstrap.d/gnome | 1 + .config/yadm/bootstrap.d/gnome##os.Linux | 25 +++++++++++++ .config/yadm/bootstrap.d/shell | 23 ++++++++++++ .config/yadm/fedora.dconf | 0 5 files changed, 66 insertions(+), 29 deletions(-) create mode 120000 .config/yadm/bootstrap.d/gnome create mode 100755 .config/yadm/bootstrap.d/gnome##os.Linux create mode 100755 .config/yadm/bootstrap.d/shell create mode 100644 .config/yadm/fedora.dconf diff --git a/.config/yadm/bootstrap b/.config/yadm/bootstrap index 1a9ba7f..91b75f7 100755 --- a/.config/yadm/bootstrap +++ b/.config/yadm/bootstrap @@ -1,36 +1,24 @@ #!/bin/bash -# Because Git submodule commands cannot operate without a work tree, they must -# be run from within $HOME (assuming this is the root of your dotfiles) -cd "$HOME" +# Save this file as ~/.config/yadm/bootstrap and make it executable. It will +# execute all executable files (excluding templates and editor backups) in the +# ~/.config/yadm/bootstrap.d directory when run. -#echo "Init submodules" -#yadm submodule update --recursive --init +set -eu -echo "Install a few things:" -mkdir "$HOME/bin" -echo "+ ZIM" -rm -f ".zimrc" ".zlogin" ".zshenv" ".zshrc" -curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh -yadm checkout -- "$HOME/.zimrc" -yadm checkout -- "$HOME/.zlogin" -yadm checkout -- "$HOME/.zshrc" -zsh -i -c "zimfw install" -echo "+ TMux Plugin Manager" -mkdir -p "$HOME/.tmux/plugins" -git clone https://github.com/tmux-plugins/tpm "$HOME/.tmux/plugins/tpm" -echo "+ SpaceVim" -curl -sLf https://spacevim.org/install.sh | bash +# Directory to look for bootstrap executables in +BOOTSTRAP_D="${BASH_SOURCE[0]}.d" -if [[ -f /etc/os-release ]]; then - source /etc/os-release - - if [[ "$ID" == "linuxmint" ]]; then - gsettings set org.cinnamon.desktop.keybindings.wm activate-window-menu '[]' - gsettings set org.cinnamon.desktop.keybindings.wm switch-group '[]' - elif [[ "$ID" == "ubuntu" ]]; then - gsettings set org.gnome.desktop.wm.keybindings activate-window-menu '[]' - gsettings set org.gnome.desktop.wm.keybindings switch-group '[]' - fi +if [[ ! -d "$BOOTSTRAP_D" ]]; then + echo "Error: bootstrap directory '$BOOTSTRAP_D' not found" >&2 + exit 1 fi +find "$BOOTSTRAP_D" -type f | sort | while IFS= read -r bootstrap; do + if [[ -x "$bootstrap" && ! "$bootstrap" =~ "##" && ! "$bootstrap" =~ "~$" ]]; then + if ! "$bootstrap"; then + echo "Error: bootstrap '$bootstrap' failed" >&2 + exit 1 + fi + fi +done diff --git a/.config/yadm/bootstrap.d/gnome b/.config/yadm/bootstrap.d/gnome new file mode 120000 index 0000000..66d967b --- /dev/null +++ b/.config/yadm/bootstrap.d/gnome @@ -0,0 +1 @@ +gnome##os.Linux \ No newline at end of file diff --git a/.config/yadm/bootstrap.d/gnome##os.Linux b/.config/yadm/bootstrap.d/gnome##os.Linux new file mode 100755 index 0000000..9bb0471 --- /dev/null +++ b/.config/yadm/bootstrap.d/gnome##os.Linux @@ -0,0 +1,25 @@ +#!/bin/bash + +if [[ -f /etc/os-release ]]; then + source /etc/os-release + + if [[ "$ID" == "fedora" ]]; then + #gsettings set org.gnome.desktop.wm.keybindings activate-window-menu '[]' + #gsettings set org.gnome.desktop.wm.keybindings switch-group '[]' + #gsettings set org.gnome.desktop.wm.keybindings switch-group-backward '[]' + #gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up '[]' + #gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down '[]' + #gsettings set org.gnome.desktop.wm.keybindings maximize '[]' + #gsettings set org.gnome.desktop.wm.keybindings unmaximize '[BackSpace]' + #gsettings set org.gnome.desktop.wm.keybindings activate-window-menu '[]' + #gsettings set org.gnome.desktop.wm.keybindings cycle-panels '[]' + #gsettings set org.gnome.desktop.wm.keybindings cycle-panels-backward '[]' + dconf load / < "$HOME/.config/yadm/fedora.dconf" + elif [[ "$ID" == "linuxmint" ]]; then + gsettings set org.cinnamon.desktop.keybindings.wm activate-window-menu '[]' + gsettings set org.cinnamon.desktop.keybindings.wm switch-group '[]' + elif [[ "$ID" == "ubuntu" ]]; then + gsettings set org.gnome.desktop.wm.keybindings activate-window-menu '[]' + gsettings set org.gnome.desktop.wm.keybindings switch-group '[]' + fi +fi diff --git a/.config/yadm/bootstrap.d/shell b/.config/yadm/bootstrap.d/shell new file mode 100755 index 0000000..f5eb0a0 --- /dev/null +++ b/.config/yadm/bootstrap.d/shell @@ -0,0 +1,23 @@ +#!/bin/bash + +# Because Git submodule commands cannot operate without a work tree, they must +# be run from within $HOME (assuming this is the root of your dotfiles) +cd "$HOME" + +#echo "Init submodules" +#yadm submodule update --recursive --init + +echo "Install a few things:" +mkdir "$HOME/bin" +echo "+ ZIM" +rm -f ".zimrc" ".zlogin" ".zshenv" ".zshrc" +curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh +yadm checkout -- "$HOME/.zimrc" +yadm checkout -- "$HOME/.zlogin" +yadm checkout -- "$HOME/.zshrc" +zsh -i -c "zimfw install" +echo "+ TMux Plugin Manager" +mkdir -p "$HOME/.tmux/plugins" +git clone https://github.com/tmux-plugins/tpm "$HOME/.tmux/plugins/tpm" +echo "+ SpaceVim" +curl -sLf https://spacevim.org/install.sh | bash diff --git a/.config/yadm/fedora.dconf b/.config/yadm/fedora.dconf new file mode 100644 index 0000000..e69de29