add install targets

This commit is contained in:
Andrejus
2020-03-25 19:57:24 +00:00
parent 826cc598b9
commit ae4fc2832c
19 changed files with 111 additions and 196 deletions

View File

@@ -1,20 +1,13 @@
#!/usr/bin/env bash
#
# apt update and upgrade
#
# Install list of packages in 00-apt-pkglist
#
# pre clean
# apt clean, update, upgrade
clean
# apt update, upgrade
update
upgrade
# Package installs
# Install list of packages in 00-apt-pkglist
package_list_file="$install_dir/00-apt-pkglist"
install_file "$package_list_file"
# Log version
# Log OS version
cat /etc/os-release

View File

@@ -1,11 +1,8 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. bash dotfiles are symlinked
#
# 1. bash dotfiles are symlinked
# bash dotfiles are symlinked
bash_source="$dotfiles_dir/bash"
bash_target="$HOME"
link_folder "$bash_source" "$bash_target"
printf "bash dotfiles are linked\n"
echo "bash dotfiles are linked"
bash --version

View File

@@ -1,53 +1,39 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. fish shell is installed
# 2. fish shell is default login shell
# 3. fish dotfiles are symlinked
# 4. fisher is installed
#
# 1. fish shell is installed
# fish shell is installed
if not_installed "fish"; then
echo "Installing fish..."
printf "Installing fish...\n"
# Add fish repository
add_ppa "fish-shell/release-3"
update
# Install fish
install fish
fi
printf "fish is installed\n"
echo "fish is installed"
fish --version
# 2. fish shell is default login shell
# 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"
printf "setting fish as default, current shell was $current_shell\n"
# Update default login shell
sudo chsh -s "$fish_path" "$USER"
sudo usermod -s "$fish_path" "$USER"
fi
printf "fish is default login shell\n"
echo "fish is default login shell"
# 3. fish dotfiles are symlinked
# fish dotfiles are symlinked
fish_source="$dotfiles_dir/fish"
fish_target="$XDG_CONFIG_HOME/fish"
link_folder "$fish_source" "$fish_target"
printf "fish dotfiles linked\n"
echo "fish dotfiles linked"
# 4. fisher is installed
# fisher is installed
fisher_location="$XDG_CONFIG_HOME/fish/functions/fisher.fish"
if ! [ -f "$fisher_location" ]; then
printf "Installing fisher...\n"
echo "Installing fisher..."
# Install fisher
curl https://git.io/fisher --create-dirs -sLo "$fisher_location"

View File

@@ -1,22 +1,17 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. ssh key exists
# 2. ssh dotfiles are symlinked
#
# 1. ssh key exists
ssh_target="$HOME/.ssh"
ssh_key="$ssh_target/id_rsa"
ssh_pub="$ssh_key.pub"
if [ ! -f "$ssh_key" ]; then
printf "generating ssh key...\n"
echo "generating ssh key..."
ssh-keygen -t rsa -b 4096 -f "$ssh_key"
fi
printf "ssh key exists\n"
echo "ssh key exists"
# 2. ssh dotfiles are symlinked
ssh_source="$dotfiles_dir/ssh"
link_folder "$ssh_source" "$ssh_target"
printf "ssh dotfiles are symlinked\n"
echo "ssh dotfiles are symlinked"
cat "$ssh_pub"

View File

@@ -1,8 +1,4 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. git dotfiles are symlinked
#
# 1. git dotfiles are symlinked
git_source="$dotfiles_dir/git"

View File

@@ -1,13 +1,9 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. pyenv is installed
#
# 1. pyenv is installed
if not_installed "pyenv"; then
printf "Installing pyenv...\n"
echo "Installing pyenv..."
# Install pyenv prerequisites
# see https://github.com/pyenv/pyenv/wiki/common-build-problems
@@ -20,6 +16,6 @@ if not_installed "pyenv"; then
"bash"
fi
printf "pyenv is installed, upgrading...\n"
echo "pyenv is installed, upgrading..."
git --git-dir="$PYENV_ROOT/.git" pull
pyenv --version

View File

@@ -1,19 +1,15 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. python3 and pip3 are installed
#
# 1. python3 and pip3 are installed
if not_installed "pip3"; then
printf "Installing python3 and pip3...\n"
echo "Installing python3 and pip3..."
pyenv install 3.7.0
pyenv global 3.7.0
fi
printf "python3 and pip3 are installed, upgrading...\n"
echo "python3 and pip3 are installed, upgrading..."
pip3 install --upgrade pip
python3 --version
pip3 --version

View File

@@ -1,8 +1,4 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. poetry is installed
#
# 1. poetry is installed
if not_installed "poetry"; then

View File

@@ -1,8 +1,4 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. nvm is installed
#
# 1. nvm is installed
if not_installed "nvm"; then
@@ -10,10 +6,12 @@ if not_installed "nvm"; then
printf "Installing nvm...\n"
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
refresh
run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh" \
"bash"
source "$NVM_DIR/nvm.sh"
fi
printf "nvm is installed, upgrading...\n"
git --git-dir="$NVM_DIR/.git" pull
nvm update --lts node

View File

@@ -1,11 +1,4 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. docker is installed
# 2. docker-compose if installed
# 3. docker group exists
# 4. user is in docker group
#
# 1. docker is installed
DOCKER_FOLDER="$HOME/.docker"

View File

@@ -1,8 +1,4 @@
#!/usr/bin/env bash
#
# After running this script:
# 1. keybase is installed
#
# 1.keybase is installed
if not_installed "keybase"; then

105
install/utils.sh Normal file
View File

@@ -0,0 +1,105 @@
#!/usr/bin/env bash
# ---------------------------------------------------------------------------- #
# Helper functions
# ---------------------------------------------------------------------------- #
clean() {
sudo apt-get clean
}
update() {
sudo apt-get update -qq
}
# Non-interactive upgrade
# Skip if FAST_MODE is defined
upgrade() {
[ "$FAST_MODE" != false ] && return
DEBIAN_FRONTEND=noninteractive \
sudo apt-get dist-upgrade -qq \
-o Dpkg::Options::="--force-confdef" \
-o Dpkg::Options::="--force-confold"
}
# @arg $1 packages to install
install() {
sudo apt-get install -qq $1
refresh
}
# @arg $1 package list file to install
install_file() {
sudo apt-get install -fqq $(cat $1)
refresh
}
# @arg $1 repository to add
add_ppa() {
sudo add-apt-repository -y ppa:$1
}
# @arg $1 url to add
add_key() {
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=true \
curl -fsSL $1 \
| sudo apt-key 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'