feat: debian install, docker tests

This commit is contained in:
2024-03-08 11:34:37 +00:00
parent d9283511a3
commit 02afe496d5
24 changed files with 201 additions and 326 deletions

View File

@@ -8,7 +8,7 @@
if [[ "$OSTYPE" == "darwin"* ]]; then
sw_vers
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
lsb_release -a
cat /etc/os-release
else
echo "Unknown OS: $OSTYPE"
fi

View File

@@ -5,18 +5,21 @@
# Print SSH key.
#
ssh_method="ed25519"
# skip if SKIP_SSH_CONFIG is set
if [ -z "$SKIP_SSH_CONFIG" ]; then
ssh_method="ed25519"
ssh_target="${HOME}/.ssh"
ssh_key="${ssh_target}/id_${ssh_method}"
ssh_pub="${ssh_key}.pub"
if [ ! -f $ssh_key ]; then
ssh-keygen \
-t $ssh_method \
-f $ssh_key \
-C "$(whoami)@$(hostname)-$(date -I)"
ssh_target="${HOME}/.ssh"
ssh_key="${ssh_target}/id_${ssh_method}"
ssh_pub="${ssh_key}.pub"
if [ ! -f $ssh_key ]; then
ssh-keygen \
-t $ssh_method \
-f $ssh_key \
-C "$(whoami)@$(hostname)-$(date -I)"
fi
cat $ssh_pub
unset ssh_method ssh_target ssh_key ssh_pub
fi
cat $ssh_pub
unset ssh_method ssh_target ssh_key ssh_pub

View File

@@ -10,12 +10,11 @@ if command -v apt-get &> /dev/null; then
curl
gnupg
gnupg2
wget
)
sudo apt-get update -qq
if [ ${#apt_packages[@]} -gt 0 ]; then
sudo apt-get install -qq "${apt_packages[@]}"
fi
sudo apt-get install -qq "${apt_packages[@]}"
unset apt_packages
else
@@ -23,4 +22,3 @@ else
fi
apt --version
echo "Last updated: $(ls -l /var/lib/apt/periodic/update-success-stamp | awk '{print $6" "$7" "$8}')"

View File

@@ -28,6 +28,6 @@ rm -f $HOME/.ssh/config
mkdir -p $HOME/.config
mkdir -p $HOME/.ssh
sudo stow --dir="$root_dir" --target="$HOME" home
sudo stow --dir="$root_dir" --target="$HOME/.config" dot-config
sudo stow --dir="$root_dir" --target="$HOME/.ssh" dot-ssh
sudo stow --dir="$root_dir/files" --target="$HOME" home
sudo stow --dir="$root_dir/files" --target="$HOME/.config" dot-config
sudo stow --dir="$root_dir/files" --target="$HOME/.ssh" dot-ssh

View File

@@ -5,29 +5,16 @@
# Configure pyenv.
#
if ! command -v "pyenv" &> /dev/null; then
export PYENV_ROOT="$HOME/.pyenv"
if ! echo $PATH | grep -q "$PYENV_ROOT"; then
export PATH="$PYENV_ROOT/bin:$PATH"
fi
if ! command -v "pyenv" &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# see https://github.com/pyenv/pyenv/wiki/common-build-problems
ppyenv_packages=(
build-essential
libssl-dev
libbz2-dev
libreadline-dev
libsqlite3-dev
libxml2-dev
libxmlsec1-dev
llvm
libncurses5-dev
libncursesw5-dev
xz-utils
tk-dev
libffi-dev
liblzma-dev
zlib1g-dev
)
if [ ${#pyenv_packages[@]} -gt 0 ]; then
sudo apt-get install -qq "${pyenv_packages[@]}"
fi
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
sudo apt-get install -qq build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
# see https://github.com/pyenv/pyenv-installer
bash -c "$(curl -fsSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer)"
@@ -49,8 +36,6 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
unset virtualenv_path
fi
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv init --path)"
pyenv --version

View File

@@ -1,11 +1,4 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# (Ubuntu only) Configure docker.
#
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [[ "$OSTYPE" == "linux-gnu"* && -z "$SKIP_DOCKER_CONFIG" ]]; then
docker --version
readonly docker_group="docker"

View File

@@ -11,8 +11,8 @@ if ! command -v gh &>/dev/null; then
sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null &&
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg &&
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null &&
sudo apt update &&
sudo apt install gh -y
sudo apt-get update -qq &&
sudo apt-get install -qq gh
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install gh
fi

View File

@@ -7,7 +7,11 @@
if ! command -v "terraform" &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -qq terraform
wget -qO- https://apt.releases.hashicorp.com/gpg | sudo tee /etc/apt/keyrings/hashicorp-keyring.gpg >/dev/null &&
sudo chmod go+r /etc/apt/keyrings/hashicorp-keyring.gpg &&
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/hashicorp-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list >/dev/null &&
sudo apt-get update -qq &&
sudo apt-get install -qq terraform
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew tap hashicorp/tap
brew install hashicorp/tap/terraform

View File

@@ -7,7 +7,7 @@
if ! command -v "neofetch" &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install neofetch -qq
sudo apt-get install -qq neofetch &>/dev/null
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install neofetch
fi