Browse Source

added remember util to lead

main
Zen 3 years ago
parent
commit
993595e46c
  1. 3
      ingredients/copper
  2. 39
      ingredients/iron
  3. 24
      ingredients/lead
  4. 8
      recipes/alchemy.sh
  5. 2
      recipes/ao.sh

3
ingredients/copper

@ -20,7 +20,8 @@ locate_torrc() {
elif [ -e $HOME/.tor/torrc ]; then
TORRCPATH="${HOME}/.tor/torrc"
else
echo -e "${RED}Uh oh...${RESET} I couldn't figure out where your torrc file is. That might cause some issues"
echo -e "${RED}Uh oh...${RESET} I couldn't figure out\
where your torrc file is. That might cause some issues"
exit 1
fi
fi

39
ingredients/iron

@ -0,0 +1,39 @@
#!/bin/sh
# Bare Metal Alchemist, 2022
#############################################
# Iron - ♂ #
#############################################
# Iron is the most common element found on our planet, and an element
# that we, as a species, frequently rely on to build our tools and
# our society as a whole.
# This ingredient contains functions for building web applications and
# installing common frameworks. Expect to use this one a lot if you're
# writing alchemy recipes!
install_nodejs() {
echo -e "${BOLD}Installing Node.js${RESET}"
chmod +x scripts/nvm_install.sh
scripts/nvm_install.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# if [ "$SHELL" = '/bin/zsh' ]; then
# echo 'sourcing zshrc'
# source ~/.zshrc
# else
# source ~/.bashrc
# fi
}
set_node_to() {
nvm install v16.13.0
nvm alias default v16.13.0
nvm use default
}

24
ingredients/lead

@ -24,15 +24,21 @@ RESET="\e[0m"
# Traps, in the case of shell scripting, listen for certain signals
# that are broadcast by the system and execute a command in response
# Make sure that ctrl+C consistently exits the script
trap "exit" INT
# Give informative error messages when we receive ERR
trap 'echo -e "${RED}Oops!${RESET} Something went wrong on line $LINENO of this script. Exit code was $?" >&2' ERR
# We only want these to activate if we're running a recipe
if [[ $SHLVL -gt 1 ]]; then
# Make sure that ctrl+C consistently exits the script
trap "exit" INT
# Give informative error messages when we receive ERR
trap 'echo -e "${RED}Oops!${RESET} Something went wrong on line $LINENO of this script. Exit code was $?" >&2' ERR
fi
# --------------- Environment Setup ---------------
if [ -d $ALCHEMY ]; then
cd $ALCHEMY
fi
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
else
@ -97,4 +103,12 @@ install_if_needed() {
done
}
remember() {
KEY=$(echo ${1} | cut -d'=' -f 1)
if [[ ${1} =~ ^[A-Z]+\=[a-z_0-9]*$ ]] && [[ -z $(env | grep ${KEY}) ]]; then
echo "${1}" >> .env
export ${1}
fi
}
LEAD=1

8
recipes/alchemy.sh

@ -32,7 +32,7 @@ if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
else
echo "No .env file found, let's initialize it"
echo "ALCHEMY=true" > .env
echo "ALCHEMY=`pwd`" >> .env
fi
echo ""
@ -48,7 +48,7 @@ if [[ ! $ISA ]]; then
elif [ $ISA == 'armv7l' ]; then
echo -e "I see you rockin an ${GREEN}ARM${RESET} processor, neato"
fi
echo "ISA=$ISA" >> .env
remember "ISA=$ISA"
fi
if [[ ! $DISTRO ]]; then
@ -68,7 +68,7 @@ if [[ ! $DISTRO ]]; then
echo -e "I don't know ${RED}what OS you're running${RESET}! Cancelling this operation."
exit 1
fi
echo "DISTRO=$DISTRO" >> .env
remember "DISTRO=$DISTRO"
fi
# TODO - Update intermittently (like if you haven't run it in a week? use date +%s and (($INT+$INT2))
@ -96,7 +96,7 @@ if [[ ! $UPDATED ]]; then
sudo brew update
;;
esac
echo "UPDATED=true" >> .env
remember "UPDATED=true"
fi
echo ""

2
recipes/ao.sh

@ -5,6 +5,7 @@
source ingredients/lead
source ingredients/copper
source ingredients/iron
source ingredients/gold
clear
@ -90,6 +91,7 @@ while [[ -z $AO ]]; do
;;
esac
done;
echo "AO=${AO}" >> .env
echo ""
if [ $AO = "3" ] || [ $AO = 'react' ]; then

Loading…
Cancel
Save