2022-04-20 20:58:25 +02:00
|
|
|
#!/bin/bash
|
2023-03-21 07:39:28 +01:00
|
|
|
# shellcheck disable=2045,2086
|
2022-04-20 20:58:25 +02:00
|
|
|
|
2022-07-18 21:08:52 +02:00
|
|
|
function timestamp() {
|
|
|
|
echo "[+] $(date +'%F %T') [INFO] $*"
|
|
|
|
}
|
|
|
|
|
|
|
|
function err() {
|
|
|
|
echo "[-] $(date +'%F %T') [ERROR] $*" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
function command_start() {
|
|
|
|
timestamp "Command $* has been started."
|
|
|
|
if ! "$*"; then
|
|
|
|
err "Command $* went wrong."
|
|
|
|
fi
|
|
|
|
timestamp "Command $* has been ended."
|
|
|
|
}
|
|
|
|
|
2022-10-05 08:14:09 +02:00
|
|
|
function update_pip() {
|
|
|
|
python3 -m pip install --upgrade pip --user
|
|
|
|
}
|
|
|
|
|
2022-11-21 22:21:28 +01:00
|
|
|
function install_neovim_module_for_python() {
|
|
|
|
pip3 install neovim --pre --user --force
|
|
|
|
}
|
|
|
|
|
2022-07-18 21:08:52 +02:00
|
|
|
function install_pyright() {
|
|
|
|
# Install pyright
|
|
|
|
sudo npm -g i pyright --force
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_bash-language-server() {
|
|
|
|
# Install bash-language-server
|
|
|
|
sudo npm -g i bash-language-server --force
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_yaml-language-server() {
|
|
|
|
# Install yaml-language-server
|
|
|
|
sudo npm -g i yaml-language-server --force
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_shfmt() {
|
|
|
|
# Install shfmt
|
|
|
|
GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@latest
|
|
|
|
}
|
|
|
|
|
2023-01-03 08:44:12 +01:00
|
|
|
function install_terraform() {
|
|
|
|
# Install terraform and terraform-ls
|
|
|
|
GO111MODULE=on go install github.com/hashicorp/terraform@latest
|
|
|
|
GO111MODULE=on go install github.com/hashicorp/terraform-ls@latest
|
|
|
|
if [[ "$(uname)" == "Darwin" ]]; then
|
|
|
|
brew install tflint
|
|
|
|
else
|
|
|
|
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-03-21 12:06:20 +01:00
|
|
|
function install_terragrunt() {
|
|
|
|
# Install terragrunt
|
|
|
|
if [[ "$(uname)" == "Darwin" ]]; then
|
|
|
|
brew install terragrunt
|
|
|
|
else
|
|
|
|
wget https://github.com/gruntwork-io/terragrunt/releases/latest/download/terragrunt_linux_amd64 -O $HOME/.local/bin/terragrunt
|
|
|
|
chmod +x $HOME/.local/bin/terragrunt
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-10-16 23:14:40 +02:00
|
|
|
function install_shellcheck() {
|
|
|
|
# Install shellcheck
|
2023-01-03 08:44:12 +01:00
|
|
|
if [[ "$(uname)" == "Darwin" ]]; then
|
|
|
|
brew install shellcheck
|
|
|
|
else
|
|
|
|
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
|
|
|
|
fi
|
2022-10-16 23:14:40 +02:00
|
|
|
}
|
|
|
|
|
2022-07-18 21:08:52 +02:00
|
|
|
function install_gopls() {
|
|
|
|
# Install gopls
|
|
|
|
GO111MODULE=on go install golang.org/x/tools/gopls@latest
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_black() {
|
|
|
|
# Install black
|
2022-11-21 22:21:28 +01:00
|
|
|
pip3 install black --pre --user --force
|
2022-10-05 08:14:30 +02:00
|
|
|
}
|
|
|
|
|
2022-10-05 08:14:09 +02:00
|
|
|
function install_ansible() {
|
2022-11-08 15:02:14 +01:00
|
|
|
pip3 install --pre --user ansible ansible-lint ansible-core --force
|
2022-07-18 21:08:52 +02:00
|
|
|
}
|
|
|
|
|
2022-10-09 20:46:39 +02:00
|
|
|
function install_ansible-language-server() {
|
|
|
|
# Install ansible-language-server
|
|
|
|
sudo npm -g i @ansible/ansible-language-server --force
|
|
|
|
sudo npm -g i yaml-language-server --force
|
|
|
|
}
|
|
|
|
|
2022-11-24 13:57:23 +01:00
|
|
|
function install_meraki_ansible() {
|
|
|
|
ansible-galaxy collection install cisco.meraki --force
|
|
|
|
pip3 install meraki --user --force
|
|
|
|
}
|
|
|
|
|
2023-01-05 10:11:33 +01:00
|
|
|
function install_azure_cli() {
|
|
|
|
pip3 install azure-cli --user --pre --force
|
|
|
|
}
|
|
|
|
|
2023-03-21 07:39:28 +01:00
|
|
|
function install_awscli() {
|
|
|
|
pip3 install awscli --pre --user --force
|
|
|
|
}
|
|
|
|
|
|
|
|
function update_zsh() {
|
2023-03-21 12:32:14 +01:00
|
|
|
mkdir -p "$ZSHFOLDER/azure-cli" "$ZSHFOLDER/aws"
|
2023-03-21 07:39:28 +01:00
|
|
|
for i in $(ls $HOME/.config/zsh); do
|
|
|
|
FOLDER="$HOME/.config/zsh/$i"
|
|
|
|
cd "$FOLDER" || echo "Folder is not exists"
|
2023-03-21 12:32:14 +01:00
|
|
|
git pull
|
2023-03-21 07:39:28 +01:00
|
|
|
done
|
|
|
|
ZSHFOLDER="$HOME/.config/zsh/"
|
2023-03-21 12:32:14 +01:00
|
|
|
curl -s https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/aws/aws.plugin.zsh -o "$ZSHFOLDER"/aws/aws.plugin.zsh
|
|
|
|
curl -s https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion -o "$ZSHFOLDER"/azure-cli/az.completion
|
2023-03-21 07:39:28 +01:00
|
|
|
}
|
|
|
|
|
2022-07-18 21:08:52 +02:00
|
|
|
function main() {
|
2022-10-05 08:14:09 +02:00
|
|
|
command_start update_pip
|
2022-07-18 21:08:52 +02:00
|
|
|
command_start install_pyright
|
|
|
|
command_start install_bash-language-server
|
|
|
|
command_start install_yaml-language-server
|
|
|
|
command_start install_ansible-language-server
|
|
|
|
command_start install_shfmt
|
2022-10-16 23:14:40 +02:00
|
|
|
command_start install_shellcheck
|
2022-07-18 21:08:52 +02:00
|
|
|
command_start install_gopls
|
2023-01-03 08:44:12 +01:00
|
|
|
command_start install_terraform
|
2023-03-21 12:06:20 +01:00
|
|
|
command_start install_terragrunt
|
2023-01-05 10:11:33 +01:00
|
|
|
command_start install_azure_cli
|
2022-07-18 21:08:52 +02:00
|
|
|
command_start install_black
|
2022-10-05 08:14:09 +02:00
|
|
|
command_start install_ansible
|
2022-11-24 13:57:23 +01:00
|
|
|
command_start install_meraki_ansible
|
2023-03-21 07:39:28 +01:00
|
|
|
command_start update_zsh
|
2022-07-18 21:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|