#!/bin/bash # Folder definitions BASE=$(pwd) export CONFIG_IN=$(pwd)/config_in export MB_ENV_BASE=$(pwd)/.mbenv export INSTALL_TMP_DIR=$(pwd)/tmp_install export XDG_CONFIG_HOME=${MB_ENV_BASE}/config export XDG_DATA_HOME=${MB_ENV_BASE}/local/share # Reset Color_Off='\033[0m' # Text Reset # Regular Colors Black='\033[0;30m' # Black Red='\033[0;31m' # Red Green='\033[0;32m' # Green Yellow='\033[0;33m' # Yellow Blue='\033[0;34m' # Blue Purple='\033[0;35m' # Purple Cyan='\033[0;36m' # Cyan White='\033[0;37m' # White # Bold BBlack='\033[1;30m' # Black BRed='\033[1;31m' # Red BGreen='\033[1;32m' # Green BYellow='\033[1;33m' # Yellow BBlue='\033[1;34m' # Blue BPurple='\033[1;35m' # Purple BCyan='\033[1;36m' # Cyan BWhite='\033[1;37m' # White export PATH=${MB_ENV_BASE}/bin:$PATH # create folders mkdir $MB_ENV_BASE mkdir $INSTALL_TMP_DIR mkdir $XDG_CONFIG_HOME mkdir -p $XDG_DATA_HOME printf "${BBlue}Downloading and installing packages${Color_Off}\n" # ------------------------------------------- fish shell ----------------------------------------------------------- # portable fish: https://github.com/xxh/fish-portable printf "${Blue}--> fish shell${Color_Off}\n" cd $MB_ENV_BASE printf "${White} Downloading...${Color_Off}\n" PORTABLE_FISH=https://github.com/xxh/fish-portable/releases/download/3.4.1/fish-portable-musl-alpine-Linux-x86_64.tar.gz curl -sL $PORTABLE_FISH | tar xz printf "${White} Configuring...${Color_Off}\n" cp -r ${CONFIG_IN}/fish ${XDG_CONFIG_HOME} curl -sfLo "${XDG_CONFIG_HOME}"/fish/completions/tmux.fish \ https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/tmux.fish # ------------------------------------------- oh my fish ----------------------------------------------------------- export OMF_CHANNEL=stable export OMF_PATH=$XDG_DATA_HOME/omf export OMF_CONFIG=$XDG_CONFIG_HOME/omf FISH_EXE=${MB_ENV_BASE}/bin/fish cp -r ${CONFIG_IN}/omf ${XDG_CONFIG_HOME} cd $INSTALL_TMP_DIR printf "${White} Installing Oh-My-Fish...${Color_Off}\n" curl -sL https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install_omf ${FISH_EXE} install_omf --noninteractive &> /dev/null ${FISH_EXE} -c "omf install" &> /dev/null # ------------------------------------------- bat ----------------------------------------------------------- printf "${Blue}--> bat${Color_Off}\n" cd ${INSTALL_TMP_DIR} curl -sL https://github.com/sharkdp/bat/releases/download/v0.21.0/bat-v0.21.0-x86_64-unknown-linux-musl.tar.gz | tar xz cd bat* cp bat ${MB_ENV_BASE}/bin mkdir $XDG_CONFIG_HOME/fish/completions cp autocomplete/bat.fish $XDG_CONFIG_HOME/fish/completions/bat.fish # -------------------------------------------- neovim ------------------------------------------------------------ printf "${Blue}--> neovim${Color_Off}\n" cd ${INSTALL_TMP_DIR} printf "${White} Downloading...${Color_Off}\n" curl -sL https://github.com/neovim/neovim/releases/download/v0.7.0/nvim-linux64.tar.gz | tar xz cd nvim-linux64* cp ./bin/* ${MB_ENV_BASE}/bin/ mkdir ${MB_ENV_BASE}/lib cp -r ./lib/* ${MB_ENV_BASE}/lib/ cp -r ./share/nvim ${MB_ENV_BASE}/share/ cp -r ${CONFIG_IN}/nvim ${XDG_CONFIG_HOME} printf "${White} Downloading and installing vim-plug${Color_Off}\n" curl -sfLo "${XDG_DATA_HOME}"/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim cd ${MB_ENV_BASE}/bin ln -s nvim vi ln -s nvim vim ${MB_ENV_BASE}/bin/nvim +PlugInstall +qall # -------------------------------------------- tmux ------------------------------------------------------------ printf "${Blue}--> tmux${Color_Off}\n" cd ${INSTALL_TMP_DIR} rm -rf ${INSTALL_TMP_DIR}/* curl -sL https://github.com/nelsonenzo/tmux-appimage/releases/download/3.2a/tmux.appimage > tmux.appimage chmod u+x tmux.appimage printf "${White} Extracting AppImage...${Color_Off}\n" ./tmux.appimage --appimage-extract &> /dev/null cd squashfs-root/usr cp ./bin/* ${MB_ENV_BASE}/bin/ cp -r ./lib/* ${MB_ENV_BASE}/lib/ cp -r ./share/terminfo ${MB_ENV_BASE}/share/ cp -r ${CONFIG_IN}/tmux ${XDG_CONFIG_HOME} export TERMINFO=${MB_ENV_BASE}/share/terminfo printf "${White} Installing tmux plugins...${Color_Off}\n" cd $XDG_CONFIG_HOME mkdir -p tmux/plugins git clone https://github.com/dracula/tmux.git tmux/plugins/dracula-tmux &> /dev/null # -------------------------------------------- tmux ------------------------------------------------------------ printf "${Blue}--> fzf${Color_Off}\n" cd ${MB_ENV_BASE}/bin curl -sL https://github.com/junegunn/fzf/releases/download/0.30.0/fzf-0.30.0-linux_amd64.tar.gz | tar xz curl -sL https://raw.githubusercontent.com/junegunn/fzf/master/bin/fzf-tmux > fzf-tmux curl -sL https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.fish > ${XDG_CONFIG_HOME}/fish/functions/fzf_key_bindings.fish chmod u+x fzf-tmux # -------------------------------------------- fd ------------------------------------------------------------ printf "${Blue}--> fd${Color_Off}\n" cd ${INSTALL_TMP_DIR} curl -sL https://github.com/sharkdp/fd/releases/download/v8.4.0/fd-v8.4.0-x86_64-unknown-linux-musl.tar.gz | tar xz cd fd-* cp autocomplete/fd.fish $XDG_CONFIG_HOME/fish/completions/fd.fish cp fd* ${MB_ENV_BASE}/bin # -------------------------------------------- broot ------------------------------------------------------------ printf "${Blue}--> broot${Color_Off}\n" cd ${INSTALL_TMP_DIR} mkdir broot && cd broot curl -sL https://github.com/Canop/broot/releases/download/v1.13.1/broot_1.13.1.zip > broot.zip unzip -q broot.zip cp ./x86_64-unknown-linux-musl/broot ${MB_ENV_BASE}/bin/ cp completion/broot.fish $XDG_CONFIG_HOME/fish/completions/broot.fish ${MB_ENV_BASE}/bin/broot --print-shell-function fish > $XDG_CONFIG_HOME/fish/functions/br.fish cp -r ${CONFIG_IN}/broot $XDG_CONFIG_HOME # -------------------------------------------- ripgrep ------------------------------------------------------------ printf "${Blue}--> ripgrep${Color_Off}\n" cd ${INSTALL_TMP_DIR} mkdir ripgrep && cd ripgrep curl -sL https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz | tar xz cd ripgrep-* cp rg ${MB_ENV_BASE}/bin cp complete/rg.fish $XDG_CONFIG_HOME/fish/completions/fd.fish # -------------------------------------------- lsd ------------------------------------------------------------ printf "${Blue}--> lsd${Color_Off}\n" cd ${INSTALL_TMP_DIR} mkdir lsd && cd lsd curl -sL https://github.com/Peltoche/lsd/releases/download/0.22.0/lsd-0.22.0-x86_64-unknown-linux-musl.tar.gz | tar xz cd lsd* cp lsd ${MB_ENV_BASE}/bin cp autocomplete/lsd.fish $XDG_CONFIG_HOME/fish/completions/fd.fish # -------------------------------------------- cheat ------------------------------------------------------------ printf "${Blue}--> cheat${Color_Off}\n" cd ${MB_ENV_BASE}/bin curl -sL https://github.com/cheat/cheat/releases/download/4.2.3/cheat-linux-amd64.gz | gunzip > cheat chmod u+x cheat #cp -r ${CONFIG_IN}/cheat ${XDG_CONFIG_HOME} # ------------------------------------------- configs ----------------------------------------------------------- cp ${CONFIG_IN}/activate.sh $MB_ENV_BASE # activation script # ------------------------------------------- pack and cleanup ---------------------------------------------------- printf "${Blue}Packing archive${Color_Off}\n" cd $BASE tar -cJf mbenv.tar.xz .mbenv #rm -rf ${MB_ENV_BASE} rm -rf ${INSTALL_TMP_DIR} printf "${Green}Done${Color_Off}\n"