From 8e09f8bde7c1b9848ffe7122049c86cf2b253c7b Mon Sep 17 00:00:00 2001 From: zen Date: Mon, 11 Apr 2022 11:06:40 -0700 Subject: [PATCH] quick updates --- ingredients/gold | 2 +- ingredients/iron | 10 +++++----- ingredients/lead | 5 +++-- recipes/alchemy.sh | 5 ++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ingredients/gold b/ingredients/gold index ccdacfe..f3348b0 100644 --- a/ingredients/gold +++ b/ingredients/gold @@ -29,7 +29,7 @@ install_bitcoin() { # This still relies on package management though case $DISTRO in "arch") - install_if_needed boost autoconf + install_if_needed boost base-devel python3 openssl libevent zeromq qt5 protobuf git ccache sqlite3 autoconf ;; "debian") install_if_needed build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libminiupnpc-dev libzmq3-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler git libsqlite3-dev ccache diff --git a/ingredients/iron b/ingredients/iron index cf16c7f..1708d28 100644 --- a/ingredients/iron +++ b/ingredients/iron @@ -60,14 +60,14 @@ set_node_to() { nvm use default fi else - echo "nvm not available, something went wrong..." + say "nvm not available, something went wrong..." fi } install_nvm() { say "${BOLD}Installing Node Version Manager${RESET}" if [ -d "$NVM_DIR" ]; then - echo "nvm already installed! skipping" + say "nvm already installed! skipping" else chmod +x scripts/nvm_install.sh scripts/nvm_install.sh &> /dev/null @@ -81,7 +81,7 @@ install_nvm() { build_service_from_template() { SERVICE=$1 shift - echo "" + say "" if [ -f resources/service-templates/${SERVICE} ]; then say "Creating $SERVICE.service..." SERVICE_FILE=/etc/systemd/system/${SERVICE}.service @@ -105,8 +105,8 @@ build_service_from_template() { sudo sed -i "s#USER#${USER}#g" $SERVICE_FILE sudo sed -i "s#HOME#${HOME}#g" $SERVICE_FILE for keyval; do - KEY=$(echo $keyval | cut -d'=' -f 1) - VAL=$(echo $keyval | cut -d'=' -f 2) + KEY=$(say $keyval | cut -d'=' -f 1) + VAL=$(say $keyval | cut -d'=' -f 2) say "Substituting $KEY for $VAL" sudo sed -i "s#$KEY#$VAL#g" $SERVICE_FILE diff --git a/ingredients/lead b/ingredients/lead index 8d0ea4b..cca0626 100644 --- a/ingredients/lead +++ b/ingredients/lead @@ -116,7 +116,7 @@ ask_for() { # If there's an env file, export its contents to the environment source_env() { - if [ -f .env ]; then + if [ -s .env ]; then export $(grep -v '^#' .env | xargs) else if [ -z $ALCHEMY ]; then @@ -240,7 +240,8 @@ remember() { # If we're setting a valid key/value pair if say ${1} | grep -Eq "^[A-Z_]+\=[$VALID_CHARS]+$"; then - DOTENV_ENTRY=$(cat $ENV_LOCATION | grep "^${KEY}" ) + # This subshell sometimes returns a non zero and we try to exit, lets not + DOTENV_ENTRY=$(cat $ENV_LOCATION | grep "^${KEY}" ) && return 0 # If something already exists and we're trying to set it to something new if [ -n "$DOTENV_ENTRY" ] && [ "$DOTENV_ENTRY" != "$1" ]; then say "I'm trying to remember ${BLUE}${1}${RESET}, but..." diff --git a/recipes/alchemy.sh b/recipes/alchemy.sh index 592c040..d2e8798 100755 --- a/recipes/alchemy.sh +++ b/recipes/alchemy.sh @@ -27,13 +27,12 @@ say " ${BOLD}Initialization Script -- BMA${BLUE} Y8b say "${RESET}" say "${GREEN}${ULINE}Environment${RESET}" -if [ -f .env ]; then +if [ -s .env ]; then grep -v '^#' .env export $(grep -v '^#' .env | xargs) else say "No .env file found, let's initialize it" - touch "${ALCHEMY}/.env" - remember "ALCHEMY=${ALCHEMY}" + say "ALCHEMY=${ALCHEMY}" > "${ALCHEMY}/.env" fi say ""