wip: dir organisation, script cleanup
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
apt-transport-https
|
||||
bat
|
||||
curl
|
||||
cowsay
|
||||
fd-find
|
||||
fortune-mod
|
||||
git
|
||||
gnupg2
|
||||
jq
|
||||
make
|
||||
neovim
|
||||
net-tools
|
||||
openssh-client
|
||||
openssh-server
|
||||
ripgrep
|
||||
ruby-full
|
||||
software-properties-common
|
||||
tmux
|
||||
universal-ctags
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
clean
|
||||
update
|
||||
upgrade
|
||||
echo "apt cleaned, updated, upgraded"
|
||||
|
||||
package_list_file="$install_dir/00-apt-pkglist"
|
||||
install_file "$package_list_file"
|
||||
echo "list of dependencies installed"
|
||||
|
||||
cat /etc/os-release
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "fish"; then
|
||||
echo "installing fish..."
|
||||
add_ppa "fish-shell/release-3"
|
||||
update
|
||||
install fish
|
||||
fi
|
||||
|
||||
echo "fish is installed"
|
||||
fish --version
|
||||
|
||||
fisher_location="$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
||||
if ! [ -f "$fisher_location" ]; then
|
||||
echo "Installing fisher..."
|
||||
curl https://git.io/fisher --create-dirs -sLo "$fisher_location"
|
||||
fi
|
||||
echo "fisher is installed, updating..."
|
||||
fish -c "fisher update";
|
||||
|
||||
fish -c "fisher --version"
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# ssh key exists
|
||||
ssh_target="$HOME/.ssh"
|
||||
ssh_key="$ssh_target/id_rsa"
|
||||
ssh_pub="$ssh_key.pub"
|
||||
if [ ! -f "$ssh_key" ]; then
|
||||
echo "generating ssh key..."
|
||||
ssh-keygen -t rsa -b 4096 -f "$ssh_key"
|
||||
fi
|
||||
echo "ssh key exists"
|
||||
|
||||
cat "$ssh_pub"
|
||||
@@ -1,15 +0,0 @@
|
||||
build-essential
|
||||
libssl-dev
|
||||
libbz2-dev
|
||||
libreadline-dev
|
||||
libreadline6
|
||||
libreadline6-dev
|
||||
libsqlite3-dev
|
||||
llvm
|
||||
libncurses5-dev
|
||||
libncursesw5-dev
|
||||
xz-utils
|
||||
tk-dev
|
||||
libffi-dev
|
||||
liblzma-dev
|
||||
zlib1g-dev
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# pyenv is installed
|
||||
if not_installed "pyenv"; then
|
||||
|
||||
echo "Installing pyenv..."
|
||||
|
||||
# Install pyenv prerequisites
|
||||
# see https://github.com/pyenv/pyenv/wiki/common-build-problems
|
||||
pyenv_list_file="$install_dir/10-pyenv-pkglist"
|
||||
install_file "$pyenv_list_file"
|
||||
|
||||
# Install pyenv
|
||||
# see https://github.com/pyenv/pyenv-installer
|
||||
run "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \
|
||||
"bash"
|
||||
|
||||
fi
|
||||
echo "pyenv is installed, upgrading $PYENV_ROOT..."
|
||||
git --git-dir="$PYENV_ROOT/.git" fetch -q
|
||||
git --git-dir="$PYENV_ROOT/.git" rebase -q --autostash FETCH_HEAD
|
||||
|
||||
pyenv --version
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
# python3 and pip3 are installed
|
||||
if not_installed "pip3"; then
|
||||
|
||||
echo "Installing python3 and pip3..."
|
||||
|
||||
pyenv install 3.7.0
|
||||
pyenv global 3.7.0
|
||||
refresh
|
||||
|
||||
fi
|
||||
echo "python3 and pip3 are installed, upgrading..."
|
||||
pip install --upgrade pip
|
||||
pip3 install --upgrade pip
|
||||
python3 --version
|
||||
pip3 --version
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
# poetry is installed
|
||||
if not_installed "poetry"; then
|
||||
|
||||
printf "Installing poetry...\n"
|
||||
|
||||
# Install poetry
|
||||
pip3 install --user poetry
|
||||
|
||||
fi
|
||||
printf "poetry is installed, upgrading...\n"
|
||||
pip3 install --upgrade poetry
|
||||
poetry --version
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# nvm is installed
|
||||
if not_installed "nvm"; then
|
||||
|
||||
printf "Installing nvm...\n"
|
||||
|
||||
# Install nvm
|
||||
mkdir -p $NVM_DIR
|
||||
run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh" \
|
||||
"bash"
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
nvm alias default node
|
||||
nvm install node
|
||||
|
||||
fi
|
||||
|
||||
printf "nvm is installed, upgrading...\n"
|
||||
run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh" \
|
||||
"bash"
|
||||
|
||||
nvm --version
|
||||
nvm use node
|
||||
node --version
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# yarn is installed
|
||||
if not_installed "yarn"; then
|
||||
|
||||
echo "Installing yarn..."
|
||||
|
||||
# Install yarn
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
update
|
||||
sudo apt install --no-install-recommends yarn
|
||||
|
||||
fi
|
||||
|
||||
echo "yarn is installed"
|
||||
# yarn --version
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "java"; then
|
||||
echo "Installing java..."
|
||||
install default-jre
|
||||
fi
|
||||
|
||||
echo "java is installed"
|
||||
java --version
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
mkdir -p "$XDG_DATA_HOME/nvim/backup"
|
||||
plug_target="$XDG_DATA_HOME/nvim/site/autoload/plug.vim"
|
||||
if [ ! -f $plug_target ]; then
|
||||
echo "Downloading vim-plug to $plug_target";
|
||||
curl -fLo "$plug_target" --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
fi
|
||||
|
||||
echo "Installing neovim support";
|
||||
pip3 install --user neovim pynvim 'python-language-server[all]'
|
||||
nvm use default
|
||||
npm install -g neovim
|
||||
sudo gem install neovim
|
||||
|
||||
echo "Running PlugInstall";
|
||||
nvim --headless +UpdateRemotePlugins +PlugClean! +PlugInstall +PlugUpgrade +PlugUpdate +qall
|
||||
nvim --version
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "elm"; then
|
||||
# Download the 0.19.1 binary for Linux.
|
||||
#
|
||||
# +-----------+----------------------+
|
||||
# | FLAG | MEANING |
|
||||
# +-----------+----------------------+
|
||||
# | -L | follow redirects |
|
||||
# | -o elm.gz | name the file elm.gz |
|
||||
# +-----------+----------------------+
|
||||
#
|
||||
curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz
|
||||
|
||||
# There should now be a file named `elm.gz` on your Desktop.
|
||||
#
|
||||
# The downloaded file is compressed to make it faster to download.
|
||||
# This next command decompresses it, replacing `elm.gz` with `elm`.
|
||||
#
|
||||
gunzip elm.gz
|
||||
|
||||
# There should now be a file named `elm` on your Desktop!
|
||||
#
|
||||
# Every file has "permissions" about whether it can be read, written, or executed.
|
||||
# So before we use this file, we need to mark this file as executable:
|
||||
#
|
||||
chmod +x elm
|
||||
|
||||
# The `elm` file is now executable. That means running `~/Desktop/elm --help`
|
||||
# should work. Saying `./elm --help` works the same.
|
||||
#
|
||||
# But we want to be able to say `elm --help` without specifying the full file
|
||||
# path every time. We can do this by moving the `elm` binary to one of the
|
||||
# directories listed in your `PATH` environment variable:
|
||||
#
|
||||
sudo mv elm /usr/local/bin/
|
||||
rm {elm,elm.gz}
|
||||
fi
|
||||
|
||||
npm install -g @elm-tooling/elm-language-server elm-format elm-test
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# docker is installed
|
||||
DOCKER_FOLDER="$HOME/.docker"
|
||||
if not_installed "docker"; then
|
||||
|
||||
printf "Installing docker...\n"
|
||||
|
||||
# Create folder
|
||||
mkdir -p "$DOCKER_FOLDER"
|
||||
|
||||
# Requirements
|
||||
install apt-transport-https ca-certificates curl gnupg-agent \
|
||||
software-properties-common
|
||||
|
||||
# Add repository
|
||||
distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]') # cast to lowercase
|
||||
add_key "https://download.docker.com/linux/$distro/gpg" "docker-apt-key"
|
||||
sudo add-apt-repository -y \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/$distro \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
update
|
||||
|
||||
# Install
|
||||
install docker-ce
|
||||
|
||||
# Chown
|
||||
sudo chown "$USER":"$USER" "$DOCKER_FOLDER" -R
|
||||
sudo chmod g+rwx "$DOCKER_FOLDER" -R
|
||||
|
||||
fi
|
||||
printf "docker is installed\n"
|
||||
docker --version
|
||||
|
||||
# docker-compose if installed
|
||||
if not_installed "docker-compose"; then
|
||||
|
||||
printf "Installing docker-compose...\n"
|
||||
|
||||
# Docker-compose
|
||||
pip3 install --user docker-compose
|
||||
|
||||
fi
|
||||
printf "docker-compose is installed, upgrading\n"
|
||||
pip3 install --upgrade docker-compose
|
||||
docker-compose --version
|
||||
|
||||
# docker group exists
|
||||
readonly docker_group='docker'
|
||||
if ! grep -q "$docker_group" /etc/group; then
|
||||
sudo groupadd "$docker_group"
|
||||
fi
|
||||
printf "group '$docker_group' is created\n"
|
||||
|
||||
# user is in docker group
|
||||
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
|
||||
sudo usermod -aG docker "$USER"
|
||||
fi
|
||||
printf "user '$USER' is in '$docker_group' group\n"
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "gcloud"; then
|
||||
echo "Installing gcloud..."
|
||||
# Add the Cloud SDK distribution URI as a package source
|
||||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||
# Import the Google Cloud Platform public key
|
||||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
|
||||
update
|
||||
install google-cloud-sdk
|
||||
refresh
|
||||
fi
|
||||
|
||||
gcloud --version
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "firebase"; then
|
||||
echo "Installing firebase..."
|
||||
run "https://firebase.tools" "bash"
|
||||
fi
|
||||
|
||||
echo "firebase is installed, upgrading..."
|
||||
curl -sL firebase.tools | upgrade=true bash
|
||||
firebase --version
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
||||
temp_dir=$(mktemp -d)
|
||||
unzip awscliv2.zip -d "$temp_dir"
|
||||
rm awscliv2.zip
|
||||
|
||||
if not_installed "aws"; then
|
||||
echo "Installing awscli..."
|
||||
sudo $temp_dir/aws/install
|
||||
fi
|
||||
|
||||
echo "awscli is installed, upgrading..."
|
||||
sudo $temp_dir/aws/install --update
|
||||
aws --version
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
tf_version="0.14.6"
|
||||
if not_installed "terraform"; then
|
||||
echo "Installing terraform..."
|
||||
tf_archive="terraform_${tf_version}_linux_amd64.zip"
|
||||
wget "https://releases.hashicorp.com/terraform/${tf_version}/${tf_archive}"
|
||||
unzip "$tf_archive" -d "$dotfiles_dir/tmp"
|
||||
rm "$tf_archive"
|
||||
mkdir -p ~/.local/bin
|
||||
mv "$dotfiles_dir/tmp/terraform" ~/.local/bin
|
||||
rm "$dotfiles_dir/tmp/terraform"
|
||||
fi
|
||||
|
||||
echo "terraform is installed"
|
||||
terraform --version
|
||||
|
||||
tf_lsp_version="0.13.0"
|
||||
if not_installed "terraform-ls"; then
|
||||
echo "Installing terraform-ls..."
|
||||
tf_lsp_archive="terraform-ls_${tf_lsp_version}_linux_amd64.zip"
|
||||
wget "https://releases.hashicorp.com/terraform-ls/${tf_lsp_version}/${tf_lsp_archive}"
|
||||
unzip "${tf_lsp_archive}" -d "$dotfiles_dir/tmp"
|
||||
rm "${tf_lsp_archive}"
|
||||
mkdir -p ~/.local/bin
|
||||
mv "$dotfiles_dir/tmp/terraform-ls" ~/.local/bin
|
||||
rm "$dotfiles_dir/tmp/terraform-ls"
|
||||
fi
|
||||
|
||||
echo "terraform-lsp is installed"
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "kubectl"; then
|
||||
echo "Installing kubectl..."
|
||||
sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2
|
||||
|
||||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||
|
||||
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
|
||||
|
||||
update
|
||||
|
||||
install kubectl
|
||||
refresh
|
||||
fi
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
echo "cleaning"
|
||||
clean
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "screenfetch"; then
|
||||
echo "Installing screenfetch..."
|
||||
install screenfetch
|
||||
fi
|
||||
|
||||
echo "screenfetch is installed"
|
||||
screenfetch --version
|
||||
screenfetch
|
||||
112
install/utils.sh
112
install/utils.sh
@@ -1,112 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Helper functions
|
||||
# ---------------------------------------------------------------------------- #
|
||||
clean() {
|
||||
sudo apt-get clean
|
||||
}
|
||||
|
||||
update() {
|
||||
sudo apt-get update
|
||||
}
|
||||
|
||||
# Non-interactive upgrade
|
||||
upgrade() {
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
sudo apt-get \
|
||||
-o Dpkg::Options::="--force-confdef" \
|
||||
-o Dpkg::Options::="--force-confold" \
|
||||
-y \
|
||||
dist-upgrade
|
||||
sudo apt-get -y autoremove
|
||||
}
|
||||
|
||||
# @arg $1 packages to install
|
||||
install() {
|
||||
sudo apt-get install -qqy $1
|
||||
refresh
|
||||
}
|
||||
|
||||
# @arg $1 package list file to install
|
||||
install_file() {
|
||||
sudo apt-get install -qqyf $(cat $1)
|
||||
refresh
|
||||
}
|
||||
|
||||
# @arg $1 repository to add
|
||||
add_ppa() {
|
||||
sudo add-apt-repository -y ppa:$1
|
||||
}
|
||||
|
||||
# @arg $1 url to add
|
||||
# @arg $2 keyring to add to
|
||||
add_key() {
|
||||
curl -fsSL $1 | sudo apt-key --keyring "/etc/apt/trusted.gpg.d/$2.gpg" add
|
||||
}
|
||||
|
||||
# @arg $1 URL to run
|
||||
# @arg $2 binary to use
|
||||
run() {
|
||||
curl -fsSL $1 | $2 | indent
|
||||
}
|
||||
|
||||
# Symlink contents of source folder to target
|
||||
#
|
||||
# @arg $1 source folder
|
||||
# @arg $2 target folder
|
||||
link_folder() {
|
||||
mkdir -p $2
|
||||
cp -srf $1/. $2
|
||||
}
|
||||
|
||||
indent() { sed 's/^/ /'; }
|
||||
|
||||
# @arg $1 binary to test
|
||||
not_installed() {
|
||||
! [ -x "$(command -v $1)" ]
|
||||
}
|
||||
|
||||
# Refreshes PATH
|
||||
refresh() {
|
||||
hash -r
|
||||
}
|
||||
|
||||
# Add to PATH and refresh
|
||||
# @arg $1 path to add to PATH
|
||||
add_path() {
|
||||
export PATH="$1:$PATH"
|
||||
refresh
|
||||
}
|
||||
|
||||
export -f clean update upgrade install install_file add_ppa add_key run \
|
||||
link_folder indent not_installed refresh add_path
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Shell colours
|
||||
# ---------------------------------------------------------------------------- #
|
||||
C_BLACK='\033[0;30m'
|
||||
C_DGRAY='\033[1;30m'
|
||||
C_RED='\033[0;31m'
|
||||
C_LRED='\033[1;31m'
|
||||
C_GREEN='\033[0;32m'
|
||||
C_LGREEN='\033[1;32m'
|
||||
C_ORANGE='\033[0;33m'
|
||||
C_YELLOW='\033[1;33m'
|
||||
C_BLUE='\033[0;34m'
|
||||
C_LBLUE='\033[1;34m'
|
||||
C_PURPLE='\033[0;35m'
|
||||
C_LPURPLE='\033[1;35m'
|
||||
C_CYAN='\033[0;36m'
|
||||
C_LCYAN='\033[1;36m'
|
||||
C_LGRAY='\033[0;37m'
|
||||
C_WHITE='\033[1;37m'
|
||||
C_NC='\033[0m'
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Helper variables #
|
||||
# ---------------------------------------------------------------------------- #
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
install_dir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
dotfiles_dir="$(dirname "$install_dir")"
|
||||
source "$dotfiles_dir/files/.bash_profile"
|
||||
refresh
|
||||
Reference in New Issue
Block a user