├── assets ├── turboot.png └── turboot_preview.png ├── testpm.sh ├── apt.sh ├── LICENSE ├── README.md └── turboot.sh /assets/turboot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DarthBenro008/turboot/HEAD/assets/turboot.png -------------------------------------------------------------------------------- /assets/turboot_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DarthBenro008/turboot/HEAD/assets/turboot_preview.png -------------------------------------------------------------------------------- /testpm.sh: -------------------------------------------------------------------------------- 1 | # This is an test package manager to test and debug turboot. 2 | 3 | install_zsh() { 4 | echo "zsh" 5 | } 6 | 7 | install_tmux() { 8 | echo "tmux" 9 | } 10 | 11 | install_oh_my_zsh() { 12 | echo "ohmyzsh" 13 | } 14 | 15 | install_p10k() { 16 | echo "p10k" 17 | } 18 | 19 | install_node() { 20 | echo "node" 21 | } 22 | 23 | install_yarn() { 24 | echo "yarn" 25 | } 26 | 27 | install_nvim() { 28 | echo "nvim" 29 | } 30 | 31 | install_vim_plug() { 32 | echo "vim_plug" 33 | } 34 | 35 | install_python() { 36 | echo "python" 37 | } 38 | -------------------------------------------------------------------------------- /apt.sh: -------------------------------------------------------------------------------- 1 | # Package Manager template for apt 2 | 3 | install_zsh() { 4 | sudo apt-get install zsh 5 | } 6 | 7 | install_tmux() { 8 | sudo apt install tmux 9 | } 10 | 11 | install_oh_my_zsh() { 12 | sh -c "curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh" 13 | } 14 | 15 | install_p10k() { 16 | git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k 17 | } 18 | 19 | install_node() { 20 | curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - 21 | sudo apt-get install -y nodejs 22 | } 23 | 24 | install_yarn() { 25 | sudo npm install --global yarn 26 | } 27 | 28 | install_nvim() { 29 | sudo apt install neovim 30 | } 31 | 32 | install_vim_plug() { 33 | sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ 34 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' 35 | } 36 | 37 | install_fzf() { 38 | sudo apt-get install fzf 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Hemanth Krishna 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![turboot Banner](assets/turboot.png) 2 | 3 | ![Language](https://img.shields.io/badge/language-bash-green) 4 | [![GitHub License](https://img.shields.io/github/license/darthbenro008/turboot)](https://github.com/darthbenro008/turboot/blob/master/LICENSE) 5 | [![Twitter URL](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2FDarthBenro008%2Fturboot)](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2FDarthBenro008%2Fturboot) 6 | 7 | # Turboot 8 | 9 | > A highly extensible and configurable dotfiles manager 10 | 11 | ## 🤔 What is turboot? 12 | 13 | If you relate to the following questions, turboot is for you! 14 | 15 | - Do you distro hop frequently and spend a lot of time re-configuring your essential setup? 16 | - Do you work a lot on VM instances and wish you could configure your dotfiles with a single commnd regardless of the distro? 17 | - Do you want an easy way to unpack your dotfiles in new machine? 18 | 19 | Well, as the name suggests, turboot is and one-click highly extensible dot-files manager that allows you set-up your dotfiles for any linux distro! (Arch/Debian/Fedora) 20 | 21 | Place turboot in your dotfiles and you are good to go and rock! 22 | 23 | ![Turboot Preview](assets/turboot_preview.png) 24 | 25 | ## ⬇ Usage 26 | 27 | - Clone the repository using `git clone https://github.com/DarthBenro008/turboot` 28 | - Make sure to add your dotfiles, something similar to this:. 29 | 30 | ```bash 31 | . 32 | +-- .alacritty.yml 33 | +-- nvim 34 | | +-- init.vim 35 | +-- .p10.zsh 36 | +-- .zshrc 37 | +-- .turboot.sh 38 | ``` 39 | 40 | - Open up turboot using `vim tuboot.sh` or `nano tuboot.sh` 41 | - Add the modules you would like to create in the `DEFAULT_MODS` array 42 | - Now run `chmod +x turboot.sh && ./turboo.sh -g ` 43 | - A file would with the name of `.sh` would have been generated 44 | - Open the file and complete the comments 45 | - Run turboot using `./turboot.sh` 46 | - Complete the prompt to install and configure your dotfiles! 47 | - You can also add custom and default modules for your liking! 48 | - Check the features of Turboot to learn more! 49 | 50 | ## 🎿 Features 51 | 52 | ### 🧱 Modularity 53 | 54 | The way turboot works is concept of modules. Each package manager has its own file. For eg, apt has its own file named `apt.sh` , `dnf` has its own file named `dnf.sh` and these file contain Installtion instructions for the module you have defined in turboot. 55 | 56 | You can tinker with the configs to your liking: 57 | 58 | ```bash 59 | # Global Mods, this is where you define modules for turboot to detect 60 | MODS=("zsh" "tmux" "oh_my_zsh" "node" "yarn" "nvim" "vim_plug" "python" "fzf") 61 | # Default mods are those mods that get installed by default when turboot runs 62 | DEFAULT_MODS=("zsh" "tmux" "oh_my_zsh" "node" "yarn" "nvim" "vim_plug") 63 | # Location to save your config file 64 | CONF_FILE="$HOME/.turbootrc" 65 | ``` 66 | 67 | ### ✍ Writting a Module/Generating Package Manager Template 68 | 69 | As turboot works with modularity, if you want a module add it in the `MODS` section and then run `./turboot -g `, your package manager shorthand could be apt, dnf, pacman, yay or literally anything. 70 | 71 | Turboot will generate a file `.sh`, and you can populate the modules installation script. 72 | 73 | This is how it looks for `apt.sh` for the above given modules. 74 | 75 | ```bash 76 | # Package Manager template for apt 77 | 78 | install_zsh() { 79 | sudo apt-get install zsh 80 | } 81 | 82 | install_tmux() { 83 | sudo apt install tmux 84 | } 85 | 86 | install_oh_my_zsh() { 87 | sh -c "curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh" 88 | } 89 | 90 | install_p10k() { 91 | git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k 92 | } 93 | 94 | install_node() { 95 | curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - 96 | sudo apt-get install -y nodejs 97 | } 98 | 99 | install_yarn() { 100 | sudo npm install --global yarn 101 | } 102 | 103 | install_nvim() { 104 | sudo apt install neovim 105 | } 106 | 107 | install_vim_plug() { 108 | sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ 109 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' 110 | } 111 | 112 | install_fzf() { 113 | sudo apt-get install fzf 114 | } 115 | 116 | ``` 117 | 118 | Then you can create a new function name `install_(){}` and write the function for your module. 119 | 120 | > NOTE: the module name should not contain spaces and should follow snake case system. 121 | 122 | ### 💪 Ability to automatically detect your distro and install your configs 123 | 124 | - when you run turboot for the first time, it automatically detects your distro and stores it in `.turbootrc` file. You can change the OS and package manager settings either in the configs or turboot will ask if the configs are correct, you can simply press "n" and turboot will ask you for the right details. 125 | 126 | ### 🔗 Symlink Support 127 | 128 | Modify the following to add your own symlink to your dotfiles! 129 | 130 | ```bash 131 | create_symlinks() { 132 | # Creating Symlinks 133 | ln -sf $CWD/.alacritty.yml ~/.alacritty.yml 134 | ln -sf $CWD/nvim ~/.config/nvim 135 | ln -sf $CWD/.zshrc ~/.zshrc 136 | ln -sf $CWD/.p10k.zsh ~/.p10k 137 | e_success "Created symlinks to configs" 138 | } 139 | ``` 140 | 141 | 142 | ## 🤝 Contributions 143 | 144 | - Feel Free to Open a PR/Issue for any feature or bug(s). 145 | - Make sure you follow the [community guidelines](https://docs.github.com/en/github/site-policy/github-community-guidelines)! 146 | - Feel free to open an issue to ask a question/discuss anything related to turboot. 147 | - Have a feature request? Open an Issue! 148 | 149 | ## ⭐ Show your support 150 | 151 | Give a ⭐ if this tool made your life easier! 152 | 153 | Spread the word to your geek fellows to save thier time! 154 | 155 | ## ⚖ License 156 | 157 | Copyright 2021 Hemanth Krishna 158 | 159 | Licensed under MIT License : https://opensource.org/licenses/MIT 160 | 161 |

Made with ❤ and single cup of coffee

-------------------------------------------------------------------------------- /turboot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Setting User Global configs 4 | MODS=("zsh" "tmux" "oh_my_zsh" "node" "yarn" "nvim" "vim_plug" "python" "fzf") # Global Mod, add your mod here 5 | DEFAULT_MODS=("zsh" "tmux" "oh_my_zsh" "node" "yarn" "nvim" "vim_plug") # Set of default mods, subset of MODS 6 | CONF_FILE="$HOME/.turbootrc" # Location to find your config file 7 | PACKAGE_MANAGER="apt" # Default Fallback Package Manager 8 | 9 | create_symlinks() { 10 | # Creating Symlinks 11 | ln -sf $CWD/.alacritty.yml ~/.alacritty.yml 12 | ln -sf $CWD/nvim ~/.config/nvim 13 | ln -sf $CWD/.zshrc ~/.zshrc 14 | ln -sf $CWD/.p10k.zsh ~/.p10k 15 | e_success "Created symlinks to configs" 16 | } 17 | 18 | # Setting Turboot configs 19 | DATE=$(date --iso-8601=seconds) 20 | IS_CONFIG_PRESENT=0 21 | CWD=$(pwd) 22 | ADDITIONAL_MODS=() 23 | FORCE=0 24 | TEMPGEN="" 25 | 26 | # Setting term colors 27 | bold=$(tput bold) 28 | underline=$(tput sgr 0 1) 29 | reset=$(tput sgr0) 30 | purple=$(tput setaf 171) 31 | red=$(tput setaf 1) 32 | green=$(tput setaf 76) 33 | tan=$(tput setaf 3) 34 | blue=$(tput setaf 38) 35 | 36 | # Setting up loggers 37 | e_header() { 38 | printf "\n${bold}${tan}========== %s ==========${reset}\n\n" "$@" 39 | } 40 | e_shameless_plug() { 41 | printf "➜ $@\n${reset}" 42 | } 43 | e_arrow() { 44 | printf " ➜ $@\n" 45 | } 46 | e_success() { 47 | printf "${green}✔ %s${reset}\n" "$@" 48 | } 49 | e_error() { 50 | printf "${red}✖ %s${reset}\n" "$@" 51 | } 52 | e_warning() { 53 | printf "${tan}➜ %s${reset}\n" "$@" 54 | } 55 | e_underline() { 56 | printf "${underline}${bold}%s${reset}\n" "$@" 57 | } 58 | e_heading() { 59 | printf "${underline}${bold}${blue}${reset}${blue}%s${reset}\n" "$@" 60 | } 61 | 62 | # Utility Functions 63 | prompt_user() { 64 | e_warning "$@ (y/n)? " 65 | old_stty_cfg=$(stty -g) 66 | stty raw -echo 67 | answer=$(while ! head -c 1 | grep -i '[ny]'; do true; done) 68 | stty $old_stty_cfg 69 | if echo "$answer" | grep -iq "^y"; then 70 | return 1 71 | else 72 | return 0 73 | fi 74 | } 75 | 76 | contains_element() { 77 | local e match="$1" 78 | shift 79 | for e; do [[ "$e" == "$match" ]] && return 1; done 80 | return 0 81 | } 82 | 83 | print_array() { 84 | for elements in $@; do 85 | printf "${tan} - $elements${reset}\n" 86 | done 87 | printf "\n" 88 | } 89 | 90 | detect_config() { 91 | if [ -f "$CONF_FILE" ]; then 92 | IS_CONFIG_PRESENT=1 93 | else 94 | IS_CONFIG_PRESENT=0 95 | fi 96 | } 97 | 98 | write_config() { 99 | printf "OS=%s\nPACKAGE_MANAGER=%s\nCREATED_AT=%s" "$OS" "$PACKAGE_MANAGER" "$DATE" >$CONF_FILE 100 | } 101 | 102 | find_package_manager() { 103 | if echo $@ | grep -iqF ubuntu; then 104 | PACKAGE_MANAGER="apt" 105 | elif echo $@ | grep -iqF ubuntu; then 106 | PACKAGE_MANAGER="dnf" 107 | elif echo $@ | grep -iqF ubuntu; then 108 | PACKAGE_MANAGER="pacman" 109 | else 110 | e_error "Cannot find your package manager, please enter name: " 111 | fi 112 | } 113 | 114 | find_os() { 115 | if [ -f /etc/os-release ]; then 116 | . /etc/os-release 117 | OS=$NAME 118 | fi 119 | } 120 | 121 | add_custom_modules() { 122 | e_arrow "Enter all the modules you want to install seperated by spaces" 123 | read custom_mods 124 | for cmod in $custom_mods; do 125 | contains_element "$cmod" "${MODS[@]}" 126 | if [ $? -eq 1 ]; then 127 | ADDITIONAL_MODS+=("$cmod") 128 | fi 129 | done 130 | 131 | } 132 | 133 | print_all_mods() { 134 | if [ ${#ADDITIONAL_MODS[@]} -eq 0 ]; then 135 | e_arrow "No valid custom modules detected" 136 | else 137 | printf "${underline}${bold}${blue}Additional modules detected:${reset} \n" 138 | print_array "${ADDITIONAL_MODS[@]}" 139 | fi 140 | } 141 | 142 | print_config_for_confirmation() { 143 | e_heading "OS Detection" 144 | e_arrow "$OS" 145 | e_heading "Package Manager Detection" 146 | e_arrow "$PACKAGE_MANAGER" 147 | e_heading "The following modules are set for default installation" 148 | print_array "${DEFAULT_MODS[@]}" 149 | 150 | } 151 | 152 | get_setup() { 153 | e_arrow "Which OS are you running on?: " 154 | read os 155 | OS=$os 156 | e_arrow "what is the shorthand of your package manager? (eg: apt, dnf, pacman, yay, etc)" 157 | read pm 158 | PACKAGE_MANAGER=$pm 159 | } 160 | 161 | source_installation_file() { 162 | source "$PACKAGE_MANAGER".sh 2>/dev/null 163 | if [ $? -eq 1 ]; then 164 | e_error "Cannot find installation files for $PACKAGE_MANAGER, generate one using -> ./turboot -g $PACKAGE_MANAGER" 165 | exit 1 166 | fi 167 | } 168 | 169 | package_manager_template_generator() { 170 | printf "# Package Manager template for $@\n\n" >>"$@.sh" 171 | for mods in "${MODS[@]}"; do 172 | printf "install_$mods() {\n #Add your command to install $mods here\n echo TODO:"$mods"\n}\n" >>"$@.sh" 173 | done 174 | } 175 | 176 | echo " _ _ _ 177 | | |_ _ _ _ __| |__ ___ ___ | |_ 178 | | __| | | | '__| '_ \ / _ \ / _ \| __| 179 | | |_| |_| | | | |_) | (_) | (_) | |_ 180 | \__|\__,_|_| |_.__/ \___/ \___/ \__|" 181 | 182 | e_header "Highly extensible and configurable dotfiles setup manager" 183 | e_shameless_plug "Authored by: Hemanth Krishna (https://github.com/DarthBenro008)" 184 | while getopts g:f flag; do 185 | case "${flag}" in 186 | f) FORCE=1 ;; 187 | g) TEMPGEN=${OPTARG} ;; 188 | esac 189 | done 190 | if [[ $TEMPGEN != "" ]]; then 191 | e_warning "Generating package manager template for $TEMPGEN" 192 | package_manager_template_generator $TEMPGEN 193 | e_success "Generated template for $TEMPGEN at $TEMPGEN.sh" 194 | detect_config 195 | PACKAGE_MANAGER=$TEMPGEN 196 | write_config 197 | e_arrow "$TEMPGEN has been set as package manager, run ./turboot" 198 | exit 0 199 | fi 200 | detect_config 201 | if [ $IS_CONFIG_PRESENT -eq 1 ] && [ $FORCE -eq 0 ]; then 202 | . $CONF_FILE 203 | e_warning "Turboot config found which was created on: $CREATED_AT" 204 | printf "\n" 205 | print_config_for_confirmation 206 | else 207 | find_os 208 | find_package_manager $OS 209 | printf "\n" 210 | print_config_for_confirmation 211 | prompt_user "Are these configs correct?" 212 | if [ $? -eq 1 ]; then 213 | echo yes 214 | write_config 215 | else 216 | get_setup 217 | print_config_for_confirmation 218 | write_config 219 | fi 220 | prompt_user "Do you want to symlink configs of this root folder?" 221 | if [ $? -eq 1 ]; then 222 | create_symlinks 223 | else 224 | e_error "Symlinks not setup" 225 | fi 226 | fi 227 | 228 | # Source installation scripts 229 | source_installation_file 230 | 231 | # Installation for custom modules 232 | prompt_user "Do you want to add some custom modules?" 233 | if [ $? -eq 1 ]; then 234 | add_custom_modules 235 | fi 236 | 237 | # Final confirmation of modules and installation 238 | print_all_mods 239 | prompt_user "Do you want to proceed with installation with the above modules?" 240 | if [ $? -eq 1 ]; then 241 | e_heading "Installing Modules" 242 | for modules in "${DEFAULT_MODS[@]}"; do 243 | eval "install_$modules" 244 | done 245 | for modules in "${ADDITIONAL_MODS[@]}"; do 246 | eval "install_$modules" 247 | done 248 | else 249 | e_error "Aye, not installing, you better read the script first!" 250 | fi 251 | --------------------------------------------------------------------------------