2023-01-03 19:05:51 +03:00
|
|
|
#!/bin/sh
|
2023-02-05 12:53:53 +03:00
|
|
|
set -e
|
2023-01-03 23:38:35 +03:00
|
|
|
NC='\033[0m'
|
|
|
|
Green='\033[1;32m'
|
|
|
|
ARROW="${Green}=>${NC}"
|
|
|
|
INPUT="${Green}::${NC}"
|
2023-06-25 15:32:30 +03:00
|
|
|
INSTALL_BIN_TOOLS="0"
|
|
|
|
HW_TARGET=$(uname)/$(uname -m)
|
2023-01-03 23:38:35 +03:00
|
|
|
|
2023-06-25 15:32:30 +03:00
|
|
|
case $HW_TARGET in
|
|
|
|
Darwin/arm64)
|
|
|
|
INSTALL_BIN_TOOLS="1";;
|
|
|
|
Darwin/x86_64)
|
|
|
|
INSTALL_BIN_TOOLS="1";;
|
|
|
|
Linux/arm64|Linux/aarch64)
|
|
|
|
INSTALL_BIN_TOOLS="1";;
|
|
|
|
Linux/x86_64)
|
|
|
|
INSTALL_BIN_TOOLS="1";;
|
|
|
|
*)
|
|
|
|
INSTALL_BIN_TOOLS="0"
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo "${ARROW} This script will create environment"
|
|
|
|
echo " with dotfiles from ivabus/dotfiles"
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${INPUT} Press enter to continue"
|
2023-01-03 19:05:51 +03:00
|
|
|
read
|
|
|
|
|
2023-06-25 15:53:33 +03:00
|
|
|
rm -rf $HOME/.env &> /dev/null
|
|
|
|
|
2023-06-25 15:32:30 +03:00
|
|
|
if [ $INSTALL_BIN_TOOLS = "1" ]
|
|
|
|
then
|
2023-06-25 15:53:33 +03:00
|
|
|
echo "${ARROW} Installing env to $HOME/.env"
|
|
|
|
mkdir $HOME/.env $HOME/.env/bin > /dev/null 2>&1
|
2023-01-03 19:05:51 +03:00
|
|
|
|
2023-06-25 15:53:33 +03:00
|
|
|
TEA_PREFIX=$HOME/.env/tea
|
|
|
|
TEA=$HOME/.env/tea/tea.xyz/v0/bin/tea
|
2023-01-03 19:05:51 +03:00
|
|
|
PATH=$PATH
|
|
|
|
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing static zsh"
|
2023-06-25 15:53:33 +03:00
|
|
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/romkatv/zsh-bin/master/install)" -q -d $HOME/.env -e no
|
2023-01-03 19:05:51 +03:00
|
|
|
PATH="$HOME/.env/bin:$PATH"
|
|
|
|
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing tea"
|
2023-06-25 15:32:30 +03:00
|
|
|
zsh -c "sh <(curl https://tea.xyz) -y --prefix $TEA_PREFIX"
|
2023-01-03 23:38:35 +03:00
|
|
|
|
|
|
|
echo "${ARROW} Installing neovim"
|
2023-01-03 19:05:51 +03:00
|
|
|
$TEA +neovim.io zsh -c "exit"
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing htop"
|
2023-01-03 19:05:51 +03:00
|
|
|
$TEA +htop.dev zsh -c "exit"
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing git"
|
|
|
|
$TEA +git-scm.org zsh -c "exit"
|
2023-01-04 10:20:36 +03:00
|
|
|
printf "${INPUT}"
|
|
|
|
read -p " Would you like to install compilers/interpretators (LLVM, Rust, Python)? (y/N): " INSTALL_COMPILERS
|
2023-01-03 20:00:56 +03:00
|
|
|
if [[ $INSTALL_COMPILERS == "y" || $INSTALL_COMPILERS == "Y" ]]; then
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing rust"
|
2023-01-03 20:00:56 +03:00
|
|
|
$TEA +rust-lang.org zsh -c "exit"
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing llvm"
|
2023-01-03 20:00:56 +03:00
|
|
|
$TEA +llvm.org zsh -c "exit"
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing python"
|
2023-01-03 20:00:56 +03:00
|
|
|
$TEA +python.org zsh -c "exit"
|
2023-01-03 19:05:51 +03:00
|
|
|
fi
|
|
|
|
|
2023-01-04 10:20:36 +03:00
|
|
|
printf "${INPUT}"
|
|
|
|
read -p " Would you like to install development tools (GitHub CLI, make/cmake/meson/ninja)? (y/N): " INSTALL_TOOLS
|
2023-01-03 20:00:56 +03:00
|
|
|
if [[ $INSTALL_TOOLS == "y" || $INSTALL_TOOLS == "Y" ]]; then
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing GitHub CLI"
|
2023-01-03 20:00:56 +03:00
|
|
|
$TEA +cli.github.com zsh -c "exit"
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing make & automake & cmake & meson & ninja"
|
2023-01-03 20:00:56 +03:00
|
|
|
$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"
|
2023-01-03 19:05:51 +03:00
|
|
|
fi
|
|
|
|
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Configuring \$PATH"
|
2023-01-03 19:05:51 +03:00
|
|
|
for i in "tea" "nvim" "clang" "clang++" "lldb" "rustc" "cargo" "htop" "make" "cmake" "automake" "meson" "ninja" "git" "gh"
|
|
|
|
do
|
2023-06-25 15:53:33 +03:00
|
|
|
ln -s $TEA $HOME/.env/bin/$i
|
2023-01-03 19:05:51 +03:00
|
|
|
done
|
|
|
|
|
2023-06-25 15:32:30 +03:00
|
|
|
fi
|
|
|
|
|
2023-01-03 23:38:35 +03:00
|
|
|
echo "${ARROW} Installing dotfiles"
|
2023-06-25 15:53:33 +03:00
|
|
|
$TEA git clone https://github.com/ivabus/dotfiles $HOME/.env/dotfiles
|
2023-01-03 19:05:51 +03:00
|
|
|
ZSH="$HOME/.env/oh-my-zsh" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended > /dev/null 2>&1
|
|
|
|
curl -fsSL https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/ivabus.zsh-theme -o $HOME/.env/oh-my-zsh/custom/themes/ivabus.zsh-theme > /dev/null 2>&1
|
|
|
|
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.env/oh-my-zsh/custom/plugins/zsh-syntax-highlighting > /dev/null 2>&1
|
2023-06-25 15:53:33 +03:00
|
|
|
sh $HOME/.env/dotfiles/tools/link_env.sh
|
2023-01-03 19:05:51 +03:00
|
|
|
|
2023-06-25 15:53:33 +03:00
|
|
|
echo "${ARROW} Environment installed to $HOME/.env"
|
2023-06-25 15:32:30 +03:00
|
|
|
if [ $INSTALL_BIN_TOOLS = "1" ]
|
|
|
|
then
|
2023-01-03 19:05:51 +03:00
|
|
|
echo " To start environment just type:"
|
2023-06-25 15:32:30 +03:00
|
|
|
echo " PATH=\"\$HOME/.env/bin:\$PATH\" zsh"
|
|
|
|
fi
|