Compare commits
6 Commits
88176cdd3e
...
37aeee9e40
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37aeee9e40
|
||
|
|
bd9897b343
|
||
|
|
f69bbbf6be
|
||
|
|
a21ba6a0ca
|
||
|
|
46c52068e2
|
||
|
|
967e146480
|
@@ -1,7 +1,39 @@
|
||||
if ! command -v gpg &> /dev/null; then
|
||||
echo 'Installing gpg'
|
||||
sudo apt update
|
||||
sudo apt install gpg -y
|
||||
|
||||
source $HOME/.zshenv
|
||||
|
||||
if [[ "$OSNAME" == "Linux" ]]; then
|
||||
# Linux
|
||||
if [[ "$DISTRO_TYPE" == "debian" ]]; then
|
||||
# Debian-based
|
||||
sudo apt update
|
||||
sudo apt install gpg -y
|
||||
elif [[ "$DISTRO_TYPE" == "rpm" ]]; then
|
||||
# RPM-based
|
||||
echo 'ERROR: Currently unsupported'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
elif [[ "$DISTRO_TYPE" == "arch" ]]; then
|
||||
# Arch-based
|
||||
echo 'ERROR: Currently unsupported'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
else
|
||||
# Unknown distro
|
||||
echo 'ERROR: Unknown distro'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$OSNAME" == "macOS" ]]; then
|
||||
# macOS
|
||||
brew install gpg
|
||||
else
|
||||
# Unknown
|
||||
echo 'ERROR: Unknown OS'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo 'gpg is installed'
|
||||
|
||||
@@ -2,29 +2,26 @@ if ! command -v librespeed-cli &> /dev/null; then
|
||||
echo 'Installing librespeed-cli'
|
||||
|
||||
source $HOME/.zshenv
|
||||
if [[ "$ARCH" == "aarch64" ]]; then
|
||||
ARCH=arm64
|
||||
fi
|
||||
|
||||
if [[ "$OSNAME" == "Linux" ]]; then
|
||||
# Linux
|
||||
if [[ "$DISTRO_TYPE" == "debian" ]]; then
|
||||
# Debian-based
|
||||
if [[ "$ARCH" == "aarch64" ]]; then
|
||||
ARCH=arm64
|
||||
fi
|
||||
URL=$(curl -fsSL https://api.github.com/repos/librespeed/speedtest-cli/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep linux | grep $ARCH)
|
||||
mkdir -p $HOME/.temp/librespeed
|
||||
curl -fsSL -o $HOME/.temp/librespeed/librespeed.tar.gz "$URL"
|
||||
tar -xzf $HOME/.temp/librespeed/librespeed.tar.gz -C $HOME/.temp/librespeed/
|
||||
cp $HOME/.temp/librespeed/librespeed-cli $HOME/bin/external/
|
||||
rm -r $HOME/.temp/librespeed/
|
||||
else
|
||||
# Unknown distro
|
||||
echo 'ERROR: Unknown distro'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
URL=$(curl -fsSL https://api.github.com/repos/librespeed/speedtest-cli/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep linux | grep $ARCH)
|
||||
mkdir -p $HOME/.temp/librespeed
|
||||
curl -fsSL -o $HOME/.temp/librespeed/librespeed.tar.gz "$URL"
|
||||
tar -xzf $HOME/.temp/librespeed/librespeed.tar.gz -C $HOME/.temp/librespeed/
|
||||
cp $HOME/.temp/librespeed/librespeed-cli $HOME/bin/external/
|
||||
rm -r $HOME/.temp/librespeed/
|
||||
elif [[ "$OSNAME" == "macOS" ]]; then
|
||||
# macOS
|
||||
exit 1
|
||||
URL=$(curl -fsSL https://api.github.com/repos/librespeed/speedtest-cli/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep darwin | grep $ARCH)
|
||||
mkdir -p $HOME/.temp/librespeed
|
||||
curl -fsSL -o $HOME/.temp/librespeed/librespeed.tar.gz "$URL"
|
||||
tar -xzf $HOME/.temp/librespeed/librespeed.tar.gz -C $HOME/.temp/librespeed/
|
||||
cp $HOME/.temp/librespeed/librespeed-cli $HOME/bin/external/
|
||||
rm -r $HOME/.temp/librespeed/
|
||||
else
|
||||
# Unknown
|
||||
echo 'ERROR: Unknown OS'
|
||||
|
||||
@@ -1,15 +1,85 @@
|
||||
if ! command -v python3 &> /dev/null; then
|
||||
echo 'Installing python3'
|
||||
sudo apt update
|
||||
sudo apt install python3 -y
|
||||
|
||||
source $HOME/.zshenv
|
||||
|
||||
if [[ "$OSNAME" == "Linux" ]]; then
|
||||
# Linux
|
||||
if [[ "$DISTRO_TYPE" == "debian" ]]; then
|
||||
# Debian-based
|
||||
sudo apt update
|
||||
sudo apt install python3 -y
|
||||
elif [[ "$DISTRO_TYPE" == "rpm" ]]; then
|
||||
# RPM-based
|
||||
echo 'ERROR: Currently unsupported'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
elif [[ "$DISTRO_TYPE" == "arch" ]]; then
|
||||
# Arch-based
|
||||
echo 'ERROR: Currently unsupported'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
else
|
||||
# Unknown distro
|
||||
echo 'ERROR: Unknown distro'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$OSNAME" == "macOS" ]]; then
|
||||
# macOS
|
||||
brew install python3
|
||||
else
|
||||
# Unknown
|
||||
echo 'ERROR: Unknown OS'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo 'python3 is installed'
|
||||
|
||||
|
||||
if ! command -v pip3 &> /dev/null; then
|
||||
echo 'Installing pip3'
|
||||
sudo apt update
|
||||
sudo apt install python3-pip -y
|
||||
|
||||
source $HOME/.zshenv
|
||||
|
||||
if [[ "$OSNAME" == "Linux" ]]; then
|
||||
# Linux
|
||||
if [[ "$DISTRO_TYPE" == "debian" ]]; then
|
||||
# Debian-based
|
||||
sudo apt update
|
||||
sudo apt install python3-pip -y
|
||||
elif [[ "$DISTRO_TYPE" == "rpm" ]]; then
|
||||
# RPM-based
|
||||
echo 'ERROR: Currently unsupported'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
elif [[ "$DISTRO_TYPE" == "arch" ]]; then
|
||||
# Arch-based
|
||||
echo 'ERROR: Currently unsupported'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
else
|
||||
# Unknown distro
|
||||
echo 'ERROR: Unknown distro'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$OSNAME" == "macOS" ]]; then
|
||||
# macOS
|
||||
echo 'ERROR: pip3 is not installed'
|
||||
echo 'pip3 should have been installed by Homebrew together with python3.'
|
||||
echo
|
||||
echo 'Please re-run this script or manually re-install python3 with Homebrew.'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
else
|
||||
# Unknown
|
||||
echo 'ERROR: Unknown OS'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo 'pip3 is installed'
|
||||
|
||||
@@ -1,17 +1,72 @@
|
||||
#!/bin/bash
|
||||
source $HOME/.zshenv
|
||||
|
||||
if ! command -v zsh &> /dev/null; then
|
||||
echo 'Installing zsh'
|
||||
sudo apt update
|
||||
sudo apt install zsh -y
|
||||
|
||||
if [[ "$OSNAME" == "Linux" ]]; then
|
||||
# Linux
|
||||
if [[ "$DISTRO_TYPE" == "debian" ]]; then
|
||||
# Debian-based
|
||||
sudo apt update
|
||||
sudo apt install zsh -y
|
||||
elif [[ "$DISTRO_TYPE" == "rpm" ]]; then
|
||||
# RPM-based
|
||||
echo 'ERROR: Currently unsupported'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
elif [[ "$DISTRO_TYPE" == "arch" ]]; then
|
||||
# Arch-based
|
||||
echo 'ERROR: Currently unsupported'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
else
|
||||
# Unknown distro
|
||||
echo 'ERROR: Unknown distro'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$OSNAME" == "macOS" ]]; then
|
||||
# macOS
|
||||
brew install zsh
|
||||
else
|
||||
# Unknown
|
||||
echo 'ERROR: Unknown OS'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo 'zsh is installed'
|
||||
|
||||
if [ ! $(awk -F: -v user="$USER" '$1 == user {print $NF}' /etc/passwd) = $(which zsh) ]; then
|
||||
echo 'zsh is not default shell'
|
||||
echo 'Setting zsh as default shell...'
|
||||
sudo chsh -s $(which zsh) $(whoami)
|
||||
|
||||
if [[ "$OSNAME" == "Linux" ]]; then
|
||||
# Linux
|
||||
if [ ! $(awk -F: -v user="$USER" '$1 == user {print $NF}' /etc/passwd) = $(which zsh) ]; then
|
||||
echo 'zsh is not default shell'
|
||||
echo 'Setting zsh as default shell...'
|
||||
sudo chsh -s $(which zsh) $(whoami)
|
||||
fi
|
||||
elif [[ "$OSNAME" == "macOS" ]]; then
|
||||
# macOS
|
||||
if [[ "$SHELL" == "/bin/zsh" ]]; then
|
||||
echo 'Homebrew zsh is not default shell'
|
||||
|
||||
if ! brew list zsh > /dev/null ; then
|
||||
# Homebrew zsh not installed
|
||||
echo 'Installing zsh from Homebrew'
|
||||
brew install zsh
|
||||
fi
|
||||
echo 'Homebrew zsh installed'
|
||||
|
||||
echo 'Setting Homebrew zsh as default shell...'
|
||||
grep -qxF "$(brew --prefix zsh)/bin/zsh" /etc/shells || sudo bash -c "echo $(brew --prefix zsh)/bin/zsh >> /etc/shells"
|
||||
sudo chsh -s "$(brew --prefix zsh)/bin/zsh" $(whoami)
|
||||
fi
|
||||
else
|
||||
# Unknown
|
||||
echo 'ERROR: Unknown OS'
|
||||
echo 'Exiting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'zsh is default shell'
|
||||
|
||||
Reference in New Issue
Block a user