#!/usr/bin/env bash
#  vim:ts=4:sts=4:sw=4:et
#
#  Author: Hari Sekhon
#  Date: 2020-12-16 14:56:05 +0000 (Wed, 16 Dec 2020)
#
#  https://github.com/HariSekhon/DevOps-Bash-tools
#
#  License: see accompanying Hari Sekhon LICENSE file
#
#  If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
#  https://www.linkedin.com/in/HariSekhon
#

# ============================================================================ #
#           A W S   C l o u d   S h e l l   C u s t o m i z a t i o n
# ============================================================================ #

# This is designed after the standard GCP CloudShell behaviour which is mimicked via .bash.d/aws-cloudshell.sh

# see log at /var/log/customize_environment

# called as root using sudo by .bash.d/aws-cloudshell.sh

set -euxo pipefail

bash_tools="$HOME/github/bash-tools"

if ! [ -d "$bash_tools" ]; then
    parent_dir="${bash_tools%/*}"
    mkdir -pv "$parent_dir"
    pushd "$parent_dir"
    git clone https://github.com/HariSekhon/DevOps-Bash-tools "$bash_tools"
    popd
fi

pushd "$bash_tools"

git pull

# not calling gcp-shell which also links because it will link config files to /root
# instead just run 'make gcp-shell' one time to set up $USER's $HOME
make system-packages

popd
