add terraform, aws tools, update git pull, update how PATH .profile is loaded

This commit is contained in:
Andrejus Kostarevas
2020-04-15 14:17:09 +01:00
parent 0bd67d48ae
commit 2a5d8004c1
11 changed files with 113 additions and 62 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
# install
tmp
.dotlock
*.deb

View File

@@ -1,9 +1,13 @@
if [ -z "$PROFILE_LOCK" ]; then
echo "acquiring profile lock"
export PROFILE_LOCK=1
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ]; then
PATH="$HOME/bin:$PATH"
export PATH="$HOME/bin:$PATH"
fi
if [ -d "$HOME/.local/bin" ]; then
export PATH="$HOME/.local/bin:$PATH"
fi
# config
@@ -19,32 +23,40 @@ if [ -z "$PROFILE_LOCK" ]; then
# workspace
if [ -z "$WORKSPACE" ]; then
export WORKSPACE="$HOME/workspace"
mkdir -p "$WORKSPACE"
fi
# .local
export PATH="$HOME/.local/bin:$PATH"
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
if [ -d "$PYENV_ROOT" ]; then
export PATH="$PYENV_ROOT/bin:$PATH"
export PATH="$PYENV_ROOT/shims:$PATH"
[ -x "$(command -v pyenv)" ] && eval "$(pyenv init -)"
fi
# poetry
export POETRY_ROOT="$HOME/.poetry"
if [ -d "$POETRY_ROOT" ]; then
export PATH="$POETRY_ROOT/bin:$PATH"
fi
# nvm
export NVM_DIR="$XDG_CONFIG_HOME/nvm"
if [ -d "$NVM_DIR" ]; then
export PATH="$NVM_DIR/bin:$PATH"
# [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
fi
# yarn
export YARN_DIR="$HOME/.yarn"
if ! [ -x "$(command -v yarn)" ]; then
if [ -d "$YARN_DIR" ]; then
export PATH="$YARN_DIR/bin:$PATH"
else
export PATH="$(yarn global bin):$PATH"
fi
# if ! [ -x "$(command -v yarn)" ]; then
# export PATH="$YARN_DIR/bin:$PATH"
# else
# export PATH="$(yarn global bin):$PATH"
# fi
fi

View File

@@ -2,32 +2,32 @@
# Cross-shell
# ---------------------------------------------------------------------------- #
# config
set XDG_CONFIG_HOME $HOME/.config
# # config
# set XDG_CONFIG_HOME $HOME/.config
# workspace
set WORKSPACE $HOME/workspace
# # workspace
# set WORKSPACE $HOME/workspace
# .local
set -x PATH $HOME/.local/bin $PATH
# # .local
# set -x PATH $HOME/.local/bin $PATH
# pyenv
set PYENV_ROOT $HOME/.pyenv
set -x PATH $PYENV_ROOT/bin $PATH
set -x PATH $PYENV_ROOT/shims $PATH
type -q pyenv && pyenv init - | source
# # pyenv
# set PYENV_ROOT $HOME/.pyenv
# set -x PATH $PYENV_ROOT/bin $PATH
# set -x PATH $PYENV_ROOT/shims $PATH
# type -q pyenv && pyenv init - | source
# poetry
set POETRY_ROOT $HOME/.poetry
set -x PATH $POETRY_ROOT/bin $PATH
# # poetry
# set POETRY_ROOT $HOME/.poetry
# set -x PATH $POETRY_ROOT/bin $PATH
# nvm
set NVM_ROOT $HOME/.nvm
set -x PATH $NVM_ROOT/bin $PATH
# # nvm
# set NVM_ROOT $HOME/.nvm
# set -x PATH $NVM_ROOT/bin $PATH
# yarn
set YARN_DIR $HOME/.yarn
set -x PATH $YARN_DIR/bin $PATH
# # yarn
# set YARN_DIR $HOME/.yarn
# set -x PATH $YARN_DIR/bin $PATH
# ---------------------------------------------------------------------------- #
# Fish specific

View File

@@ -1,13 +1,12 @@
#!/usr/bin/env bash
# apt clean, update, upgrade
clean
update
upgrade
echo "apt cleaned, updated, upgraded"
# Install list of packages in 00-apt-pkglist
package_list_file="$install_dir/00-apt-pkglist"
install_file "$package_list_file"
echo "list of dependencies installed"
# Log OS version
cat /etc/os-release

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env bash
# bash dotfiles are symlinked
bash_source="$dotfiles_dir/bash"
bash_target="$HOME"
link_folder "$bash_source" "$bash_target"
echo "bash dotfiles are linked"
bash --version

View File

@@ -1,44 +1,49 @@
#!/usr/bin/env bash
# fish shell is installed
if not_installed "fish"; then
echo "Installing fish..."
echo "installing fish..."
add_ppa "fish-shell/release-3"
update
install fish
fi
echo "fish is installed"
fish --version
# fish shell is default login shell
current_shell="$(getent passwd $USER | cut -d: -f7)"
fish_path="$(which fish)"
if [ "$current_shell" != "$fish_path" ]; then
echo "setting fish as default, current shell was $current_shell"
# current_shell="$(getent passwd $USER | cut -d: -f7)"
# fish_path="$(which fish)"
# if [ "$current_shell" != "$fish_path" ]; then
# echo "setting fish as default, current shell was $current_shell"
# sudo chsh -s "$fish_path" "$USER"
# sudo usermod -s "$fish_path" "$USER"
# fi
# echo "fish is default login shell"
sudo chsh -s "$fish_path" "$USER"
sudo usermod -s "$fish_path" "$USER"
fi
echo "fish is default login shell"
# fish dotfiles are symlinked
fish_source="$dotfiles_dir/fish"
fish_target="$XDG_CONFIG_HOME/fish"
link_folder "$fish_source" "$fish_target"
echo "fish dotfiles linked"
# fisher is installed
fish --version
fisher_location="$XDG_CONFIG_HOME/fish/functions/fisher.fish"
if ! [ -f "$fisher_location" ]; then
echo "Installing fisher..."
# Install fisher
curl https://git.io/fisher --create-dirs -sLo "$fisher_location"
fi
printf "fisher is installed, updating...\n"
echo "fisher is installed, updating..."
fish -c "fisher"
fish -c "fisher --version"
if not_installed "fishlogin"; then
echo "setting up fishlogin..."
mkdir -p ~/bin
target="$HOME/bin/fishlogin"
tee -a $target << END
#!/bin/bash -l
exec -l fish "\$@"
END
sudo chmod +x $target
echo $target | sudo tee -a /etc/shells
sudo usermod -s $target $USER
fi

View File

@@ -17,5 +17,7 @@ if not_installed "pyenv"; then
fi
echo "pyenv is installed, upgrading..."
git --git-dir="$PYENV_ROOT/.git" pull
git --git-dir="$PYENV_ROOT/.git" fetch -q
git --git-dir="$PYENV_ROOT/.git" rebase -q --autostash FETCH_HEAD
pyenv --version

View File

@@ -13,7 +13,9 @@ if not_installed "nvm"; then
fi
printf "nvm is installed, upgrading...\n"
git --git-dir="$NVM_DIR/.git" pull
git --git-dir="$NVM_DIR/.git" fetch -q
git --git-dir="$NVM_DIR/.git" rebase -q --autostash FETCH_HEAD
nvm --version
node --version
npm --version

View File

@@ -6,8 +6,8 @@ if not_installed "keybase"; then
printf "Installing keybase...\n"
curl --remote-name https://prerelease.keybase.io/keybase_amd64.deb
install keybase_amd64.deb
rm keybase_amd64.deb
install ./keybase_amd64.deb
rm ./keybase_amd64.deb
fi
printf "keybase is installed\n"

16
install/33-aws.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip -d "$dotfiles_dir/tmp"
rm awscliv2.zip
if not_installed "aws"; then
echo "Installing awscli..."
sudo ./tmp/aws/install
fi
echo "awscli is installed, upgrading..."
sudo ./tmp/aws/install --update
aws --version
rm -rf ./tmp/aws

14
install/34-terraform.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
if not_installed "terraform"; then
echo "Installing terraform..."
wget https://releases.hashicorp.com/terraform/0.12.24/terraform_0.12.24_linux_amd64.zip
unzip terraform_0.12.24_linux_amd64.zip -d "$dotfiles_dir/tmp"
rm terraform_0.12.24_linux_amd64.zip
mkdir -p ~/.local/bin
mv "$dotfiles_dir/tmp/terraform" ~/.local/bin
rm "$dotfiles_dir/tmp/terraform"
fi
echo "terraform is installed"
terraform --version