wip: further cleanup
This commit is contained in:
@@ -1,78 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
function apt_update {
|
||||
sudo apt-get update
|
||||
}
|
||||
# Utility functions for common tasks
|
||||
|
||||
# @arg $1 debian package to install if not present
|
||||
function apt_install {
|
||||
if ! dpkg -s $1; then
|
||||
sudo apt-get install -y $1
|
||||
fi
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Helper functions
|
||||
# ---------------------------------------------------------------------------- #
|
||||
clean() {
|
||||
sudo apt-get clean
|
||||
}
|
||||
|
||||
update() {
|
||||
apt_update
|
||||
}
|
||||
|
||||
# @arg $1 packages to install
|
||||
install() {
|
||||
apt_install $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 gpg --no-default-keyring --keyring $2 --import -
|
||||
# @arg $1 URL to download
|
||||
# @arg $2 Path to file
|
||||
function download_file {
|
||||
curl \
|
||||
--silent \
|
||||
--show-error \
|
||||
--location \
|
||||
--output $2 \
|
||||
$1
|
||||
}
|
||||
|
||||
# @arg $1 URL to run
|
||||
# @arg $2 binary to use
|
||||
run() {
|
||||
curl -fsSL $1 | $2
|
||||
}
|
||||
|
||||
# Symlink contents of source folder to target
|
||||
#
|
||||
# @arg $1 source folder
|
||||
# @arg $2 target folder
|
||||
link_folder() {
|
||||
mkdir -p $2
|
||||
cp -srf $1/. $2
|
||||
function download_run {
|
||||
file=$(mktemp)
|
||||
download_file $1 $file
|
||||
cat $file | $2
|
||||
}
|
||||
|
||||
# @arg $1 binary to test
|
||||
not_installed() {
|
||||
! [ -x "$(command -v $1)" ]
|
||||
function bin_in_path {
|
||||
command -v $1
|
||||
}
|
||||
|
||||
# Refreshes PATH
|
||||
refresh() {
|
||||
hash -r
|
||||
# @arg $1 apt package to test
|
||||
function apt_installed {
|
||||
dpkg --status $1
|
||||
}
|
||||
|
||||
# Add to PATH and refresh
|
||||
# @arg $1 path to add to PATH
|
||||
add_path() {
|
||||
export PATH="$1:$PATH"
|
||||
refresh
|
||||
function clean {
|
||||
sudo apt-get clean -qq
|
||||
}
|
||||
|
||||
function update {
|
||||
sudo apt-get update -qq
|
||||
}
|
||||
|
||||
# @arg $1 apt package to install if not present
|
||||
function install {
|
||||
if ! apt_installed $1; then
|
||||
sudo apt-get install -qq $1
|
||||
fi
|
||||
}
|
||||
|
||||
# Add apt repository
|
||||
# @arg $1 JSON object containing the following keys
|
||||
# * repository - apt repository
|
||||
# * signingKey - gpg signing key url
|
||||
# * components - apt components
|
||||
function add_repository {
|
||||
repository=$(jq -r ".repository" <<<"$1")
|
||||
if ! grep -q "^deb .*${repository}" /etc/apt/sources.list; then
|
||||
signingKey=$(jq -r ".signingKey" <<<"$1")
|
||||
components=$(jq -r ".components" <<<"$1")
|
||||
curl -fsSL $signingKey | sudo apt-key add -
|
||||
source="deb [arch=$(dpkg --print-architecture)] ${repository} ${components}"
|
||||
sudo add-apt-repository --yes "$source"
|
||||
fi
|
||||
}
|
||||
|
||||
# @arg $1 package list file to install
|
||||
function install_file {
|
||||
sudo apt-get install -qqf $(cat $1)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
NAME=`basename "$0"`
|
||||
#
|
||||
# Script that stows all tracked dotfiles into the user's home directory.
|
||||
#
|
||||
|
||||
REL_DIR=`dirname "$0"`
|
||||
ABS_DIR=`readlink -f $REL_DIR/../` # Scripts are nested inside of /scripts
|
||||
|
||||
|
||||
2
scripts/install.d/00-apt-pkglist
Normal file
2
scripts/install.d/00-apt-pkglist
Normal file
@@ -0,0 +1,2 @@
|
||||
bat
|
||||
ripgrep
|
||||
10
scripts/install.d/02-fish.sh
Executable file
10
scripts/install.d/02-fish.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
fish --version
|
||||
|
||||
fisher_location="$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
||||
if ! [ -f $fisher_location ]; then
|
||||
fish -c "curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher"
|
||||
fi
|
||||
|
||||
fish -c "fisher update"
|
||||
fish -c "fisher --version"
|
||||
@@ -1,15 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
if not_installed "pyenv"; then
|
||||
if ! bin_in_path "pyenv"; then
|
||||
# see https://github.com/pyenv/pyenv/wiki/common-build-problems
|
||||
pyenv_list_file="$INSTALL_DIR/10-pyenv-pkglist"
|
||||
install_file "$pyenv_list_file"
|
||||
|
||||
# see https://github.com/pyenv/pyenv-installer
|
||||
run "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \
|
||||
download_run "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \
|
||||
bash
|
||||
fi
|
||||
|
||||
export PATH="$HOME/.pyenv/bin:$PATH"
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
if not_installed "pip3"; then
|
||||
if ! bin_in_path "pip3"; then
|
||||
pyenv install 3.9.0
|
||||
pyenv global 3.9.0
|
||||
refresh
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
pip3 install --upgrade pip
|
||||
python3 --version
|
||||
pip3 --version
|
||||
|
||||
for dep in `jq -r ".pip_dependencies[]" $CONFIG`; do
|
||||
pip3 install --upgrade $dep
|
||||
done
|
||||
2
scripts/install.d/12-poetry.sh
Normal file
2
scripts/install.d/12-poetry.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
poetry --version
|
||||
14
scripts/install.d/13-nvm.sh
Executable file
14
scripts/install.d/13-nvm.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
nvm_version="v0.38.0"
|
||||
if ! bin_in_path "nvm"; then
|
||||
download_run "https://raw.githubusercontent.com/nvm-sh/nvm/${nvm_version}/install.sh" \
|
||||
"bash"
|
||||
fi
|
||||
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
nvm --version
|
||||
nvm install node
|
||||
nvm use node
|
||||
|
||||
node --version
|
||||
7
scripts/install.d/14-yarn.sh
Executable file
7
scripts/install.d/14-yarn.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
yarn --version
|
||||
|
||||
for dep in `jq -r ".node_dependencies[]" $CONFIG`; do
|
||||
yarn global add $dep
|
||||
yarn global upgrade $dep
|
||||
done
|
||||
2
scripts/install.d/15-java.sh
Executable file
2
scripts/install.d/15-java.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
java --version
|
||||
24
scripts/install.d/16-vim.sh
Executable file
24
scripts/install.d/16-vim.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Install neovim from unstable debian repo
|
||||
echo "deb http://deb.debian.org/debian unstable main" \
|
||||
| sudo tee /etc/apt/sources.list.d/unstable.list
|
||||
echo "Package: neovim
|
||||
Pin: release a=unstable
|
||||
Pin-Priority: 900" \
|
||||
| sudo tee /etc/apt/preferences.d/neovim
|
||||
update
|
||||
install neovim
|
||||
|
||||
mkdir -p "$XDG_DATA_HOME/nvim/backup"
|
||||
plug_dir="$XDG_DATA_HOME/nvim/site/autoload"
|
||||
mkdir -p "$plug_dir"
|
||||
plug_target="$plug_dir/plug.vim"
|
||||
if [ ! -f $plug_target ]; then
|
||||
download_file \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \
|
||||
"$plug_target"
|
||||
fi
|
||||
|
||||
nvim --headless +UpdateRemotePlugins +PlugClean! +PlugInstall +PlugUpgrade +PlugUpdate +qall
|
||||
nvim --version
|
||||
11
scripts/install.d/30-docker.sh
Executable file
11
scripts/install.d/30-docker.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
docker --version
|
||||
|
||||
readonly docker_group="docker"
|
||||
if ! grep -q "$docker_group" /etc/group; then
|
||||
sudo groupadd "$docker_group"
|
||||
fi
|
||||
|
||||
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
|
||||
sudo usermod -aG docker "$USER"
|
||||
fi
|
||||
2
scripts/install.d/31-gcloud.sh
Executable file
2
scripts/install.d/31-gcloud.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
gcloud --version
|
||||
2
scripts/install.d/32-firebase.sh
Executable file
2
scripts/install.d/32-firebase.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
firebase --version
|
||||
2
scripts/install.d/33-aws.sh
Executable file
2
scripts/install.d/33-aws.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
aws --version
|
||||
2
scripts/install.d/34-terraform.sh
Executable file
2
scripts/install.d/34-terraform.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
terraform --version
|
||||
@@ -1,18 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
TIME=${TIME:-`date`}
|
||||
UUID=${UUID:-`uuidgen`}
|
||||
HOST=${HOST:-`hostname`}
|
||||
#
|
||||
# Script that installs system dependencies specified in a config,
|
||||
# and runs all post-install scripts contained in a subdirectory.
|
||||
#
|
||||
|
||||
NAME=`basename "$0"`
|
||||
REL_DIR=`dirname "$0"`
|
||||
ABS_DIR=`readlink -f $REL_DIR/../` # Scripts are nested inside of /scripts
|
||||
TIME=${TIME:-$(date)}
|
||||
UUID=${UUID:-$(uuidgen)}
|
||||
HOST=${HOST:-$(hostname)}
|
||||
|
||||
LOG_DIR="$ABS_DIR/logs"
|
||||
mkdir -p $LOG_DIR
|
||||
LOG_TARGET=${LOG_TARGET:-$LOG_DIR/$UUID.log}
|
||||
NAME=$(basename "$0")
|
||||
REL_DIR=$(dirname "$0")
|
||||
ABS_DIR=$(readlink -f $REL_DIR/../) # Scripts are nested inside of /scripts
|
||||
|
||||
UTILS="${REL_DIR}/_utils.sh"
|
||||
CONFIG="${REL_DIR}/install_config.json"
|
||||
INSTALL_DIR="${REL_DIR}/install.d"
|
||||
|
||||
LOG_DIR="${ABS_DIR}/logs"
|
||||
mkdir -p "$LOG_DIR"
|
||||
LOG_TARGET=${LOG_TARGET:-"${LOG_DIR}/${UUID}.log"}
|
||||
|
||||
main() {
|
||||
echo "Running $NAME at $TIME"
|
||||
@@ -24,31 +32,38 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Loading utils"
|
||||
source $REL_DIR/_utils.sh
|
||||
|
||||
apt_update
|
||||
|
||||
echo "Installing jq..."
|
||||
apt_install jq
|
||||
|
||||
echo "Installing apt dependencies..."
|
||||
for dep in `jq -r ".apt_dependencies[]" $ABS_DIR/config.json`; do
|
||||
apt_install $dep
|
||||
# Load installer dependencies
|
||||
source "$UTILS"
|
||||
update
|
||||
install jq
|
||||
for dep in $(jq -r ".apt_core_dependencies[]" "$CONFIG"); do
|
||||
install "$dep"
|
||||
done
|
||||
|
||||
figlet -c "bootstrapping..."
|
||||
$ABS_DIR/scripts/bootstrap.sh
|
||||
source $HOME/.profile
|
||||
# Add apt repositories
|
||||
for i in $(jq ".apt_repositories | keys | .[]" "$CONFIG"); do
|
||||
value=$(jq -r ".apt_repositories[$i]" "$CONFIG")
|
||||
add_repository "$value"
|
||||
done
|
||||
update
|
||||
|
||||
figlet -c "installing..."
|
||||
export INSTALL_DIR="$REL_DIR/install"
|
||||
# Install apt dependencies
|
||||
for dep in $(jq -r ".apt_dependencies[]" "$CONFIG"); do
|
||||
install "$dep"
|
||||
done
|
||||
|
||||
# Install dotfiles on system and load them
|
||||
figlet -c "Bootstrapping..."
|
||||
$ABS_DIR/scripts/bootstrap.sh
|
||||
source "$HOME/.profile"
|
||||
|
||||
# Run custom installer scripts
|
||||
figlet -c "Installing..."
|
||||
for script in $INSTALL_DIR/*.sh; do
|
||||
figlet -c `basename $script`
|
||||
figlet -c "$(basename $script)"
|
||||
source $script
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
echo "main: Logging to $LOG_TARGET"
|
||||
main 2>&1 |tee $LOG_TARGET
|
||||
main 2>&1 | tee "$LOG_TARGET"
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
apt-transport-https
|
||||
software-properties-common
|
||||
ripgrep
|
||||
universal-ctags
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
if not_installed "fish"; then
|
||||
add_ppa "fish-shell/release-3"
|
||||
update
|
||||
install fish
|
||||
fi
|
||||
fish --version
|
||||
|
||||
fisher_location="$HOME/.config/fish/functions/fisher.fish"
|
||||
if ! [ -f "$fisher_location" ]; then
|
||||
curl https://git.io/fisher --create-dirs -sLo "$fisher_location"
|
||||
fish -c "fisher install jorgebucaran/fisher"
|
||||
fi
|
||||
|
||||
fish -c "fisher --version"
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
add_path "$HOME/.local/bin"
|
||||
|
||||
if not_installed "poetry"; then
|
||||
pip3 install --user poetry
|
||||
fi
|
||||
|
||||
pip3 install --upgrade poetry
|
||||
poetry --version
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh" \
|
||||
"bash"
|
||||
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
nvm --version
|
||||
nvm install node
|
||||
nvm use node
|
||||
|
||||
node --version
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
if not_installed "yarn"; then
|
||||
add_key https://dl.yarnpkg.com/debian/pubkey.gpg
|
||||
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
|
||||
|
||||
yarn --version
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
if not_installed "java"; then
|
||||
install default-jre
|
||||
fi
|
||||
|
||||
java --version
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
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
|
||||
|
||||
echo "Running PlugInstall";
|
||||
nvim --headless +UpdateRemotePlugins +PlugClean! +PlugInstall +PlugUpgrade +PlugUpdate +qall
|
||||
nvim --version
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
DOCKER_FOLDER="$HOME/.docker"
|
||||
if not_installed "docker"; then
|
||||
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" \
|
||||
"gnupg-ring:/etc/apt/trusted.gpg.d/docker-apt-key.gpg"
|
||||
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
|
||||
docker --version
|
||||
|
||||
if not_installed "docker-compose"; then
|
||||
pip3 install --user docker-compose
|
||||
fi
|
||||
pip3 install --upgrade docker-compose
|
||||
docker-compose --version
|
||||
|
||||
readonly docker_group="docker"
|
||||
if ! grep -q "$docker_group" /etc/group; then
|
||||
sudo groupadd "$docker_group"
|
||||
fi
|
||||
|
||||
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
|
||||
sudo usermod -aG docker "$USER"
|
||||
fi
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
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,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
if not_installed "firebase"; then
|
||||
run "https://firebase.tools" "bash"
|
||||
fi
|
||||
|
||||
echo "firebase is installed, upgrading..."
|
||||
curl -sL firebase.tools | upgrade=true bash
|
||||
firebase --version
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
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,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
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"
|
||||
80
scripts/install_config.json
Normal file
80
scripts/install_config.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"apt_repositories": [
|
||||
{
|
||||
"signingKey": "https://apt.releases.hashicorp.com/gpg",
|
||||
"repository": "https://apt.releases.hashicorp.com",
|
||||
"components": "buster main"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://dl.yarnpkg.com/debian/pubkey.gpg",
|
||||
"repository": "https://dl.yarnpkg.com/debian",
|
||||
"components": "stable main"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://packages.cloud.google.com/apt/doc/apt-key.gpg",
|
||||
"repository": "https://packages.cloud.google.com/apt",
|
||||
"components": "cloud-sdk main"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://packages.cloud.google.com/apt/doc/apt-key.gpg",
|
||||
"repository": "https://apt.kubernetes.io/",
|
||||
"components": "kubernetes-xenial main"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://download.docker.com/linux/debian/gpg",
|
||||
"repository": "https://download.docker.com/linux/debian",
|
||||
"components": "buster stable"
|
||||
},
|
||||
{
|
||||
"signingKey": "https://download.opensuse.org/repositories/shells:fish/Debian_10/Release.key",
|
||||
"repository": "https://download.opensuse.org/repositories/shells:/fish/Debian_10/",
|
||||
"components": "/"
|
||||
}
|
||||
],
|
||||
"apt_core_dependencies": [
|
||||
"curl",
|
||||
"gnupg",
|
||||
"gnupg2"
|
||||
],
|
||||
"apt_dependencies": [
|
||||
"apt-transport-https",
|
||||
"ca-certificates",
|
||||
"containerd.io",
|
||||
"cowsay",
|
||||
"default-jre",
|
||||
"devscripts",
|
||||
"docker-ce",
|
||||
"docker-ce-cli",
|
||||
"fd-find",
|
||||
"figlet",
|
||||
"fish",
|
||||
"fortune-mod",
|
||||
"google-cloud-sdk",
|
||||
"git",
|
||||
"kubectl",
|
||||
"lsb-release",
|
||||
"make",
|
||||
"net-tools",
|
||||
"openssh-client",
|
||||
"openssh-server",
|
||||
"screenfetch",
|
||||
"stow",
|
||||
"terraform",
|
||||
"terraform-ls",
|
||||
"tmux",
|
||||
"unzip",
|
||||
"yarn"
|
||||
],
|
||||
"node_dependencies": [
|
||||
"firebase-tools",
|
||||
"neovim"
|
||||
],
|
||||
"pip_dependencies": [
|
||||
"awscli",
|
||||
"docker-compose",
|
||||
"neovim",
|
||||
"poetry",
|
||||
"python-language-server[all]",
|
||||
"pyvim"
|
||||
]
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
#
|
||||
# Script that publishes the set up script for new installations.
|
||||
#
|
||||
|
||||
echo "Publishing..."
|
||||
|
||||
13
scripts/run.sh
Executable file
13
scripts/run.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
tag=$(uuidgen)
|
||||
docker build . \
|
||||
--build-arg UUID=$tag \
|
||||
--tag dotfiles:$tag \
|
||||
--target install
|
||||
|
||||
docker run \
|
||||
-v "$(pwd)"/logs:/home/test-user/.dotfiles/logs \
|
||||
dotfiles:$tag
|
||||
/bin/bash
|
||||
@@ -1,29 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
# GitHub repository details
|
||||
AUTHOR=${AUTHOR:-andrejusk}
|
||||
REPOSITORY=${REPOSITORY:-dotfiles}
|
||||
BRANCH=${BRANCH:-master}
|
||||
echo "Using repository $AUTHOR/$REPOSITORY at $BRANCH"
|
||||
#
|
||||
# Script that checks out a compatible dotfiles repository
|
||||
# and runs the installer to set up a new installation.
|
||||
#
|
||||
|
||||
# Target folder to checkout to
|
||||
DOTFILES_DIR=${DOTFILES_DIR:-$HOME/.dotfiles}
|
||||
mkdir -p $DOTFILES_DIR
|
||||
if [ -z `ls -A $DOTFILES_DIR` ]; then
|
||||
echo "Setting up $DOTFILES_DIR"
|
||||
author=${GITHUB_AUTHOR:-andrejusk}
|
||||
repository=${GITHUB_REPOSITORY:-dotfiles}
|
||||
branch=${GITHUB_BRANCH:-master}
|
||||
echo "Using repository $author/$repository at $branch"
|
||||
|
||||
setup_dir=${DOTFILES_DIR:-$HOME/.dotfiles}
|
||||
|
||||
# Prevent overwriting existing installation
|
||||
mkdir -p $setup_dir
|
||||
if [ -z `ls -A $setup_dir` ]; then
|
||||
echo "Setting up $setup_dir"
|
||||
else
|
||||
echo "Failed: Setup directory not empty $DOTFILES_DIR"
|
||||
echo "Failed: Setup directory not empty $setup_dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Download and untar repo
|
||||
tmp_dir=`mktemp -d`
|
||||
tmp_dest="$tmp_dir/dotfiles.tar.gz"
|
||||
wget "https://github.com/$AUTHOR/$REPOSITORY/archive/$BRANCH.tar.gz" -qO $tmp_dest
|
||||
wget "https://github.com/$author/$repository/archive/$branch.tar.gz" -qO $tmp_dest
|
||||
tar -C $tmp_dir -zxf $tmp_dest
|
||||
mv $tmp_dir/$REPOSITORY-$BRANCH/* $DOTFILES_DIR
|
||||
mv $tmp_dir/$repository-$branch/* $setup_dir
|
||||
rm -rf $tmp_dir
|
||||
|
||||
echo "Done!"
|
||||
$DOTFILES_DIR/scripts/install.sh
|
||||
$setup_dir/scripts/install.sh
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
tag=`uuidgen`
|
||||
tag=$(uuidgen)
|
||||
docker build . \
|
||||
-t dotfiles:$tag \
|
||||
--build-arg UUID=$tag \
|
||||
--tag dotfiles:$tag \
|
||||
--target test
|
||||
|
||||
docker run dotfiles:$tag
|
||||
docker run \
|
||||
-v "$(pwd)"/logs:/home/test-user/.dotfiles/logs \
|
||||
dotfiles:$tag
|
||||
|
||||
Reference in New Issue
Block a user