1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-04-14 23:00:45 +01:00

#382 Prevent partial execution of install.sh

This commit is contained in:
nvbn 2015-10-21 18:00:08 +08:00
parent 12a33f56bc
commit f5b0e96747

View File

@ -8,50 +8,54 @@ installed () {
hash $1 2>/dev/null hash $1 2>/dev/null
} }
# Install os dependencies: install_thefuck () {
if installed apt-get; then # Install os dependencies:
# Debian/ubuntu: if installed apt-get; then
sudo apt-get update -yy # Debian/ubuntu:
sudo apt-get install -yy python-pip python-dev command-not-found sudo apt-get update -yy
sudo apt-get install -yy python-pip python-dev command-not-found
if [[ -n $(apt-cache search python-commandnotfound) ]]; then if [[ -n $(apt-cache search python-commandnotfound) ]]; then
# In case of different python versions: # In case of different python versions:
sudo apt-get install -yy python-commandnotfound sudo apt-get install -yy python-commandnotfound
fi fi
else
if installed brew; then
# OS X:
brew update
brew install python
else else
# Genreic way: if installed brew; then
wget https://bootstrap.pypa.io/get-pip.py # OS X:
sudo python get-pip.py brew update
rm get-pip.py brew install python
else
# Genreic way:
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
rm get-pip.py
fi
fi fi
fi
# thefuck requires fresh versions of setuptools and pip: # thefuck requires fresh versions of setuptools and pip:
sudo pip install -U pip setuptools sudo pip install -U pip setuptools
sudo pip install -U thefuck sudo pip install -U thefuck
# Setup aliases: # Setup aliases:
if should_add_alias ~/.bashrc; then if should_add_alias ~/.bashrc; then
echo 'eval $(thefuck --alias)' >> ~/.bashrc echo 'eval $(thefuck --alias)' >> ~/.bashrc
fi fi
if should_add_alias ~/.bash_profile; then if should_add_alias ~/.bash_profile; then
echo 'eval $(thefuck --alias)' >> ~/.bash_profile echo 'eval $(thefuck --alias)' >> ~/.bash_profile
fi fi
if should_add_alias ~/.zshrc; then if should_add_alias ~/.zshrc; then
echo 'eval $(thefuck --alias)' >> ~/.zshrc echo 'eval $(thefuck --alias)' >> ~/.zshrc
fi fi
if should_add_alias ~/.config/fish/config.fish; then if should_add_alias ~/.config/fish/config.fish; then
thefuck --alias >> ~/.config/fish/config.fish thefuck --alias >> ~/.config/fish/config.fish
fi fi
if should_add_alias ~/.tcshrc; then if should_add_alias ~/.tcshrc; then
echo 'eval `thefuck --alias`' >> ~/.tcshrc echo 'eval `thefuck --alias`' >> ~/.tcshrc
fi fi
}
install_thefuck