Working
This commit is contained in:
parent
78625c52d7
commit
53c5859678
147
tforgione.sh
147
tforgione.sh
@ -56,12 +56,16 @@ has_apt=0
|
|||||||
has_pacman=0
|
has_pacman=0
|
||||||
should_install_git=0
|
should_install_git=0
|
||||||
should_install_zsh=0
|
should_install_zsh=0
|
||||||
|
should_clone_dotfiles=0
|
||||||
should_install_dotfiles=0
|
should_install_dotfiles=0
|
||||||
should_install_update_remainder=0
|
should_install_update_remainder=0
|
||||||
should_install_neovim=0
|
should_install_neovim=0
|
||||||
|
should_configure_neovim=0
|
||||||
should_install_rust=0
|
should_install_rust=0
|
||||||
should_install_nodejs=0
|
should_install_nodejs=0
|
||||||
|
should_configure_nodejs=0
|
||||||
should_install_python=0
|
should_install_python=0
|
||||||
|
should_configure_python=0
|
||||||
should_install_hyprland=0
|
should_install_hyprland=0
|
||||||
|
|
||||||
find_os() {
|
find_os() {
|
||||||
@ -84,48 +88,77 @@ find_os() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ask_for_dotfiles() {
|
ask_for_dotfiles() {
|
||||||
yes_no_ask "do you wish to install and configure dotfiles?"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
test_command zsh
|
test_command zsh
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
should_install_zsh=1
|
has_zsh=1
|
||||||
|
else
|
||||||
|
has_zsh=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test_command git
|
test_command git
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
has_git=1
|
||||||
|
else
|
||||||
|
has_git=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $has_sudo -eq 0 ]; then
|
||||||
|
if [ $has_zsh -eq 0 ] || [ $has_git -eq 0 ]; then
|
||||||
|
warn "can't install dotfiles without sudo, or zsh and git"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
yes_no_ask "do you wish to install and configure dotfiles?"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
|
||||||
|
if [ $has_zsh -eq 0 ]; then
|
||||||
|
should_install_zsh=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $has_git -eq 0 ]; then
|
||||||
should_install_git=1
|
should_install_git=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
should_clone_dotfiles=1
|
||||||
should_install_dotfiles=1
|
should_install_dotfiles=1
|
||||||
|
|
||||||
yes_no_ask "do you want a weekly remainder to do your system's update?"
|
yes_no_ask "do you want a weekly remainder to do your system's update?"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
return
|
should_install_update_remainder=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
should_install_update_remainder=1
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ask_for_neovim() {
|
ask_for_neovim() {
|
||||||
if [ $has_sudo -eq 0 ]; then
|
test_command nvim
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
has_neovim=1
|
||||||
|
else
|
||||||
|
has_neovim=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $has_neovim -eq 0 ] && [ $has_sudo -eq 0 ]; then
|
||||||
warn "can't install neovim without sudo"
|
warn "can't install neovim without sudo"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $has_neovim -eq 1 ]; then
|
||||||
|
yes_no_ask "do you wish to configure neovim?"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
should_clone_dotfiles=1
|
||||||
|
should_configure_neovim=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
yes_no_ask "do you wish to install and configure neovim?"
|
yes_no_ask "do you wish to install and configure neovim?"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
return
|
should_clone_dotfiles=1
|
||||||
fi
|
|
||||||
|
|
||||||
should_install_dotfiles=1
|
|
||||||
|
|
||||||
test_command neovim
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
should_install_neovim=1
|
should_install_neovim=1
|
||||||
|
should_configure_neovim=1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ask_for_rust() {
|
ask_for_rust() {
|
||||||
@ -141,34 +174,58 @@ ask_for_rust() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ask_for_python() {
|
ask_for_python() {
|
||||||
if [ $has_sudo -eq 0 ]; then
|
test_command python
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
has_python=1
|
||||||
|
else
|
||||||
|
has_python=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $has_python -eq 0 ] && [ $has_sudo -eq 0 ]; then
|
||||||
warn "can't install python without sudo"
|
warn "can't install python without sudo"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
yes_no_ask "do you wish to install and configure python?"
|
if [ $has_python -eq 1 ]; then
|
||||||
if [ $? -ne 0 ]; then
|
yes_no_ask "do you wish to configure python?"
|
||||||
return
|
if [ $? -eq 0 ]; then
|
||||||
|
should_configure_python=1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
yes_no_ask "do you wish to install and configure python?"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
should_install_python=1
|
should_install_python=1
|
||||||
|
should_configure_python=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ask_for_nodejs() {
|
ask_for_nodejs() {
|
||||||
if [ $has_sudo -eq 0 ]; then
|
test_command node
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
has_node=1
|
||||||
|
else
|
||||||
|
has_node=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $has_node -eq 0 ] && [ $has_sudo -eq 0 ]; then
|
||||||
warn "can't install node without sudo"
|
warn "can't install node without sudo"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $has_node -eq 1 ]; then
|
||||||
|
yes_no_ask "do you wish to configure nodejs?"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
should_configure_node=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
yes_no_ask "do you wish to install and configure nodejs?"
|
yes_no_ask "do you wish to install and configure nodejs?"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
return
|
should_install_node=1
|
||||||
|
should_configure_node=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test_command node
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
should_install_nodejs=1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ask_for_hyprland() {
|
ask_for_hyprland() {
|
||||||
@ -187,6 +244,7 @@ ask_for_hyprland() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
should_clone_dotfiles=1
|
||||||
should_install_hyprland=1
|
should_install_hyprland=1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +320,7 @@ run() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Install some python plugins that work well with neovim if necessary
|
# Install some python plugins that work well with neovim if necessary
|
||||||
if [ $should_install_neovim -eq 1 ]; then
|
if [ $should_configure_neovim -eq 1 ]; then
|
||||||
python_packages+=(neovim)
|
python_packages+=(neovim)
|
||||||
python_packages+=(pycodestyle)
|
python_packages+=(pycodestyle)
|
||||||
python_packages+=("python-lsp-server[all]")
|
python_packages+=("python-lsp-server[all]")
|
||||||
@ -288,6 +346,7 @@ run() {
|
|||||||
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo bash
|
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo bash
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $has_sudo -eq 1 ]; then
|
||||||
if [ $has_apt -eq 1 ]; then
|
if [ $has_apt -eq 1 ]; then
|
||||||
sudo apt install -y ${packages[@]}
|
sudo apt install -y ${packages[@]}
|
||||||
|
|
||||||
@ -297,28 +356,33 @@ run() {
|
|||||||
sudo tar xf tmp.tar.gz -C / --strip-components=1
|
sudo tar xf tmp.tar.gz -C / --strip-components=1
|
||||||
rm tmp.tar.gz
|
rm tmp.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ $has_pacman -eq 1 ]; then
|
elif [ $has_pacman -eq 1 ]; then
|
||||||
sudo pacman -Sy ${packages[@]} --noconfirm --needed
|
sudo pacman -Sy ${packages[@]} --noconfirm --needed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $should_install_dotfiles ]; then
|
if [ $should_configure_dotfiles ]; then
|
||||||
sudo chsh $USER -s /usr/bin/zsh
|
sudo chsh $USER -s /usr/bin/zsh
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Prepare venv for python
|
# Prepare venv for python
|
||||||
if [ $should_install_python -eq 1 ]; then
|
if [ $should_configure_python -eq 1 ]; then
|
||||||
python -m venv $HOME/.venv
|
python -m venv $HOME/.venv
|
||||||
VIRTUAL_ENV=$HOME/.venv $HOME/.venv/bin/pip install ${python_packages[@]}
|
VIRTUAL_ENV=$HOME/.venv $HOME/.venv/bin/pip install ${python_packages[@]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure dotfiles
|
# Configure dotfiles
|
||||||
|
if [ $should_clone_dotfiles -eq 1 ]; then
|
||||||
|
if [ ! -d $HOME/.config/dotfiles ]; then
|
||||||
|
git clone https://gitea.tforgione.fr/tforgione/dotfiles $HOME/.config/dotfiles
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $should_install_dotfiles -eq 1 ]; then
|
if [ $should_install_dotfiles -eq 1 ]; then
|
||||||
if [ ! -d $HOME/.config/ohmyzsh ]; then
|
if [ ! -d $HOME/.config/ohmyzsh ]; then
|
||||||
git clone https://github.com/ohmyzsh/ohmyzsh $HOME/.config/ohmyzsh
|
git clone https://github.com/ohmyzsh/ohmyzsh $HOME/.config/ohmyzsh
|
||||||
fi
|
fi
|
||||||
if [ ! -d $HOME/.config/dotfiles ]; then
|
|
||||||
git clone https://gitea.tforgione.fr/tforgione/dotfiles $HOME/.config/dotfiles
|
|
||||||
fi
|
|
||||||
|
|
||||||
ln -s $HOME/.config/dotfiles/zshrc $HOME/.zshrc
|
ln -s $HOME/.config/dotfiles/zshrc $HOME/.zshrc
|
||||||
|
|
||||||
@ -348,12 +412,11 @@ run() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure neovim
|
# Configure neovim
|
||||||
if [ $should_install_neovim -eq 1 ]; then
|
if [ $should_configure_neovim -eq 1 ]; then
|
||||||
# Create config files an directories
|
# Create config files an directories
|
||||||
mkdir -p $HOME/.nvim/backups $HOME/.nvim/swp $HOME/.nvim/undo
|
mkdir -p $HOME/.nvim/backups $HOME/.nvim/swp $HOME/.nvim/undo
|
||||||
rm -f $HOME/.config/nvim
|
|
||||||
mkdir -p $HOME/.config/nvim
|
mkdir -p $HOME/.config/nvim
|
||||||
ln -s $HOME/.config/dotfiles/nvim.lua $HOME/.config/nvim/init.lua
|
ln -s $HOME/.config/dotfiles/nvim/init.lua $HOME/.config/nvim/init.lua
|
||||||
|
|
||||||
# Install vim plug
|
# Install vim plug
|
||||||
curl -fLo $HOME/.local/share/nvim/site/autoload/plug.vim --create-dirs \
|
curl -fLo $HOME/.local/share/nvim/site/autoload/plug.vim --create-dirs \
|
||||||
@ -364,7 +427,7 @@ run() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure nodejs
|
# Configure nodejs
|
||||||
if [ $should_install_nodejs -eq 1 ]; then
|
if [ $should_configure_nodejs -eq 1 ]; then
|
||||||
mkdir -p $HOME/.npmbin
|
mkdir -p $HOME/.npmbin
|
||||||
npm config set prefix $HOME/.npmbin
|
npm config set prefix $HOME/.npmbin
|
||||||
npm install -g npm
|
npm install -g npm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user