This commit is contained in:
Ivan Bushchik 2023-07-05 11:59:24 +03:00
parent b08af1f8ac
commit df213a3480
No known key found for this signature in database
GPG key ID: 9F6DDABE11A2674D
2 changed files with 100 additions and 68 deletions

View file

@ -1,96 +1,129 @@
#!/bin/sh
#!/bin/bash
set -e
NC='\033[0m'
Green='\033[1;32m'
ARROW="${Green}=>${NC}"
INPUT="${Green}::${NC}"
INSTALL_BIN_TOOLS="0"
HW_TARGET=$(uname)/$(uname -m)
case $HW_TARGET in
Darwin/arm64)
INSTALL_BIN_TOOLS="1";;
echo Platform checked.;;
Darwin/x86_64)
INSTALL_BIN_TOOLS="1";;
echo Platform checked.;;
Linux/arm64|Linux/aarch64)
INSTALL_BIN_TOOLS="1";;
echo Platform checked.;;
Linux/x86_64)
INSTALL_BIN_TOOLS="1";;
echo Platform checked.;;
*)
INSTALL_BIN_TOOLS="0"
echo Yo, dude. This script is for Linux/Darwin x64/arm64. Get this system and try one more time
exit 255
esac
echo "${ARROW} This script will create environment"
echo " with dotfiles from ivabus/dotfiles"
echo "${INPUT} Press enter to continue"
read
if command -v gum >/dev/null; then
TEA_GUM=gum
else
curl https://tea.xyz -o /tmp/tea
TEA_GUM=$(sh /tmp/tea --silent +charm.sh/gum which gum)
fi
$TEA_GUM format -- <<EoMD
# hi, let's setup env.
> dotfiles picked from github.com:ivabus/dotfiles
## What will be installed by default
* tea
* neovim
* htop
* git
* zsh
## What could be additionally installed
### Compilers/Interpretators
* LLVM
* Rust and Cargo
* Python
### Tools
* GitHub CLI
* make
* automake
* cmake
* meson
* ninja
EoMD
if ! $TEA_GUM confirm "Do you want to continue"; then
exit 1
fi
rm -rf $HOME/.env &> /dev/null
if [ $INSTALL_BIN_TOOLS = "1" ]
then
echo "${ARROW} Installing env to $HOME/.env"
$TEA_GUM format "Installing env to \`$HOME/.env\`"
mkdir $HOME/.env $HOME/.env/bin > /dev/null 2>&1
TEA_PREFIX=$HOME/.env/tea
TEA=$HOME/.env/tea/tea.xyz/v0/bin/tea
PATH=$PATH
echo "${ARROW} Installing static zsh"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/romkatv/zsh-bin/master/install)" -q -d $HOME/.env -e no
$TEA_GUM format "Installing \`tea\` to \`$TEA_PREFIX\`"
bash -c "sh <(curl https://tea.xyz) --yes --prefix $TEA_PREFIX"
$TEA_GUM format "Installing \`zsh\`"
$TEA +zsh.sourceforge.io sh -c "exit"
PATH="$HOME/.env/bin:$PATH"
echo "${ARROW} Installing tea"
zsh -c "sh <(curl https://tea.xyz) -y --prefix $TEA_PREFIX"
echo "${ARROW} Installing neovim"
$TEA +neovim.io zsh -c "exit"
echo "${ARROW} Installing htop"
$TEA +htop.dev zsh -c "exit"
echo "${ARROW} Installing git"
$TEA +git-scm.org zsh -c "exit"
printf "${INPUT}"
read -p " Would you like to install compilers/interpretators (LLVM, Rust, Python)? (y/N): " INSTALL_COMPILERS
if [[ $INSTALL_COMPILERS == "y" || $INSTALL_COMPILERS == "Y" ]]; then
echo "${ARROW} Installing rust"
$TEA +rust-lang.org zsh -c "exit"
echo "${ARROW} Installing llvm"
$TEA +llvm.org zsh -c "exit"
echo "${ARROW} Installing python"
$TEA +python.org zsh -c "exit"
$TEA_GUM format "Installing \`neovim\`"
$TEA +neovim.io sh -c "exit"
$TEA_GUM format "Installing \`htop\`"
$TEA +htop.dev sh -c "exit"
$TEA_GUM format "Installing \`git\`"
$TEA +git-scm.org sh -c "exit"
if $TEA_GUM confirm "Would you like to install compilers/interpretators (LLVM, Rust, Python)?"; then
$TEA_GUM format "Installing \`rust\` and \`cargo\`"
$TEA +rust-lang.org sh -c "exit"
$TEA +rust-lang.org/cargo sh -c "exit"
$TEA_GUM format "Installing \`llvm\`"
$TEA +llvm.org sh -c "exit"
$TEA_GUM format "Installing \`python\`"
$TEA +python.org sh -c "exit"
fi
printf "${INPUT}"
read -p " Would you like to install development tools (GitHub CLI, make/cmake/meson/ninja)? (y/N): " INSTALL_TOOLS
if [[ $INSTALL_TOOLS == "y" || $INSTALL_TOOLS == "Y" ]]; then
echo "${ARROW} Installing GitHub CLI"
$TEA +cli.github.com zsh -c "exit"
echo "${ARROW} Installing make & automake & cmake & meson & ninja"
$TEA +gnu.org/make zsh -c "exit"
$TEA +gnu.org/automake zsh -c "exit"
$TEA +cmake.org zsh -c "exit"
$TEA +mesonbuild.com zsh -c "exit"
$TEA +ninja-build.org zsh -c "exit"
if $TEA_GUM confirm "Would you like to install development tools (GitHub CLI, make/cmake/meson/ninja)?"; then
$TEA_GUM format "Installing \`gh\`"
$TEA +cli.github.com sh -c "exit"
$TEA_GUM format "Installing \`make\` & \`automake\` & \`cmake\` & \`meson\` & \`ninja\`"
$TEA +gnu.org/make sh -c "exit"
$TEA +gnu.org/automake sh -c "exit"
$TEA +cmake.org sh -c "exit"
$TEA +mesonbuild.com sh -c "exit"
$TEA +ninja-build.org sh -c "exit"
fi
echo "${ARROW} Configuring \$PATH"
$TEA_GUM format "Configuring \$PATH with installed progs"
for i in "tea" "nvim" "clang" "clang++" "lldb" "rustc" "cargo" "htop" "make" "cmake" "automake" "meson" "ninja" "git" "gh"
do
ln -s $TEA $HOME/.env/bin/$i
done
fi
echo "${ARROW} Installing dotfiles"
$TEA_GUM format "Installing dotfiles"
$TEA git clone https://github.com/ivabus/dotfiles $HOME/.env/dotfiles
mkdir -p $HOME/.env/dotfiles/zsh/plugins $HOME/.env/dotfiles/zsh/themes
curl -fsSL https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/ivabus.zsh-theme -o $HOME/.env/dotfiles/zsh/themes/ivabus.zsh-theme > /dev/null 2>&1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.env/dotfiles/zsh/plugins/zsh-syntax-highlighting > /dev/null 2>&1
sh $HOME/.env/dotfiles/tools/link_env.sh
echo "${ARROW} Environment installed to $HOME/.env"
if [ $INSTALL_BIN_TOOLS = "1" ]
then
echo " To start environment just type:"
echo " PATH=\"\$HOME/.env/bin:\$PATH\" zsh"
fi
$TEA_GUM format -- <<EoMD
Environment installed to \`$HOME/.env\`
To start environment just type:
\`PATH=\"\$HOME/.env/bin:\$PATH\" zsh\`
EoMD

View file

@ -1,16 +1,15 @@
#!/bin/sh
set -e
NC='\033[0m'
Green='\033[1;32m'
ARROW="${Green}=>${NC}"
TEA_GUM="$HOME/.env/tea/charm.sh/gum/v0.9.0/bin/gum"
echo "$ARROW Linking zshrc"
if [ -f ~/.zshrc ]; then
echo "=> Moving old zshrc to ~/.zshrc.old"
mv ~/.zshrc ~/.zshrc.old
$TEA_GUM format "Linking \`.zshrc\`"
if [ -f $HOME/.zshrc ]; then
$TEA_GUM format "Moved old \`.zshrc\` to \`$HOME/.zshrc.old\`"
mv $HOME/.zshrc $HOME/.zshrc.old
fi
ln -s ~/.env/dotfiles/env/.zshrc ~/.zshrc
echo "$ARROW Linking neovim files"
rm -rf ${XDG_CONFIG_HOME:-$HOME/.config}/nvim
ln -s ~/.env/dotfiles/nvim ${XDG_CONFIG_HOME:-$HOME/.config}/nvim
ln -s $HOME/.env/dotfiles/env/.zshrc $HOME/.zshrc
$TEA_GUM "Linking neovim files"
rm -rf $HOME/.config/nvim
mkdir -p $HOME/.config/nvim
ln -s $HOME/.env/dotfiles/nvim $HOME/.config/nvim