Browse Source

more posixination

main
zen 3 years ago
parent
commit
6ff70b591b
  1. 34
      ingredients/copper
  2. 88
      ingredients/gold
  3. 2
      ingredients/lead
  4. 6
      package-lock.json
  5. 40
      recipes/ao.sh
  6. 2
      recipes/flask.sh

34
ingredients/copper

@ -20,14 +20,14 @@ locate_torrc() {
elif [ -f /etc/tor/torrc ]; then elif [ -f /etc/tor/torrc ]; then
TORRCPATH='/etc/tor/torrc' TORRCPATH='/etc/tor/torrc'
else else
echo -e "${RED}Uh oh...${RESET} I couldn't figure out where your torrc file is. That might cause some issues" say "${RED}Uh oh...${RESET} I couldn't figure out where your torrc file is. That might cause some issues"
sleep 3 sleep 3
echo "Anyways..." say "Anyways..."
sleep 2 sleep 2
fi fi
fi fi
echo -e "Your torrc is located at ${BLUE}${TORRCPATH}${RESET}" say "Your torrc is located at ${BLUE}${TORRCPATH}${RESET}"
remember "TORRCPATH=${TORRCPATH}" remember "TORRCPATH=${TORRCPATH}"
} }
@ -45,7 +45,7 @@ configure_tor() {
sudo sed -i "s#USER#${USER}#g" torrc-template sudo sed -i "s#USER#${USER}#g" torrc-template
sudo sed -i "s#HOME#${HOME}#g" torrc-template sudo sed -i "s#HOME#${HOME}#g" torrc-template
sudo mv torrc-template $TORRCPATH sudo mv torrc-template $TORRCPATH
echo -e "${GREEN}Torrc file reset!${RESET}" say "${GREEN}Torrc file reset!${RESET}"
;; ;;
'*') '*')
echo "Okay, we'll leave it as is." echo "Okay, we'll leave it as is."
@ -53,7 +53,7 @@ configure_tor() {
esac esac
echo "" echo ""
echo -e "Tor configuration ${GREEN}complete!${RESET}" say "Tor configuration ${GREEN}complete!${RESET}"
} }
get_external_ip() { get_external_ip() {
@ -63,7 +63,7 @@ get_external_ip() {
;; ;;
"*") "*")
#install_if_needed dig #install_if_needed dig
echo "Not yet supported! Feel free to help out here :)" say "Not yet supported! Feel free to help out here :)"
;; ;;
esac esac
@ -196,10 +196,21 @@ configure_domain_for_site() {
} }
enable_ssl() { enable_ssl() {
if [ ! -z $SSL ]; then if [ -n "$SSL" ]; then
echo "We've already gone through the SSL enabling process! Skipping" say "We've already gone through the SSL enabling process!"
else ask_for reenable "Would you like to do it again? ${BLUE}(y/n)${RESET}: "
if [ ! -z $DOMAIN ]; then case $reenable in
"y"|"Y")
forget "SSL"
;;
"n"|"N")
say "skipping!"
;;
esac
fi
if [ -z "$SSL" ]; then
if [ ! -z "$DOMAIN" ]; then
ask_for ssl "Would you like to enable SSL via Certbot? (y/n): " ask_for ssl "Would you like to enable SSL via Certbot? (y/n): "
say "" say ""
case $ssl in case $ssl in
@ -220,7 +231,7 @@ enable_ssl() {
fi fi
fi fi
if [ -z $DOMAIN ]; then if [ -z "$DOMAIN" ]; then
ACCESS_POINT=http://localhost ACCESS_POINT=http://localhost
else else
if [ -z $SSL ]; then if [ -z $SSL ]; then
@ -229,6 +240,7 @@ enable_ssl() {
ACCESS_POINT=https://$DOMAIN ACCESS_POINT=https://$DOMAIN
fi fi
fi fi
remember "ACCESS_POINT=${ACCESS_POINT}" remember "ACCESS_POINT=${ACCESS_POINT}"
} }

88
ingredients/gold

@ -22,7 +22,18 @@ install_bitcoin() {
fi fi
# This still relies on package management though # This still relies on package management though
install_if_needed boost autoconf case $DISTRO in
"arch")
install_if_needed boost 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
;;
*)
say "hol up, I don't know what to do with $DISTRO"
ask_for nothing "press enter to continue, at your own PERIL!!"
;;
esac
tar -xvf 🜍/bitcoin-22.0.tar.gz tar -xvf 🜍/bitcoin-22.0.tar.gz
sleep 1 sleep 1
@ -32,13 +43,14 @@ install_bitcoin() {
./configure --without-bdb # Someday, someone will complain here ./configure --without-bdb # Someday, someone will complain here
make make
sudo make install sudo make install
cd ..
rm -rf bitcoin-22.0 rm -rf bitcoin-22.0
} }
install_lightning() { install_lightning() {
say "${BOLD}Installing lightningd${RESET}" say "${BOLD}Installing lightningd${RESET}"
git clone https://github.com/ElementsProject/lightning.git ./lightning git clone https://github.com/ElementsProject/lightning.git ./lightning
pushd ./lightning cd lightning
git checkout v0.10.2 git checkout v0.10.2
./configure ./configure
@ -48,7 +60,7 @@ install_lightning() {
pip install --user mrkd pip install --user mrkd
make make
sudo make install sudo make install
popd cd ..
rm -rf lightning rm -rf lightning
} }
@ -67,14 +79,9 @@ install_clboss() {
} }
configure_bitcoin() { configure_bitcoin() {
say "${BOLD}Configuring Bitcoin${RESET}"
mkdir -p ~/.bitcoin mkdir -p ~/.bitcoin
AUTHDEETS=$(python3 scripts/rpcauth.py ao)
AUTHLINE=$(say "$AUTHDEETS" | sed '2q;d' )
PASSLINE=$(say "$AUTHDEETS" | sed '4q;d' )
remember "BTC_PASS=${PASSLINE}"
if [ -f $HOME/.bitcoin/bitcoin.conf ]; then if [ -f $HOME/.bitcoin/bitcoin.conf ]; then
say "Looks like you already have a ${BLUE}bitcoin.conf${RESET} file!" say "Looks like you already have a ${BLUE}bitcoin.conf${RESET} file!"
say "" say ""
@ -95,27 +102,54 @@ configure_bitcoin() {
say 'Created default bitcoin config' say 'Created default bitcoin config'
fi fi
sed -i "s/BTC_LOGIN/${AUTHLINE}/" $HOME/.bitcoin/bitcoin.conf if [ -n "$BTC_PASS" ]; then
ask_for new_deets "Would you like to generate new authentication credentials for bitcoin? ${BLUE} (y/n): ${RESET}"
case $new_deets in
"y"|"Y")
AUTHDEETS=$(python3 scripts/rpcauth.py ao)
AUTHLINE=$(say "$AUTHDEETS" | sed '2q;d' )
PASSLINE=$(say "$AUTHDEETS" | sed '4q;d' )
NEWCREDS=1
remember "BTC_PASS=${PASSLINE}"
say "${GREEN}New credentials!${RESET}"
;;
"n"|"N")
say "Skipping re-credentulation"
;;
esac
else
AUTHDEETS=$(python3 scripts/rpcauth.py ao)
AUTHLINE=$(say "$AUTHDEETS" | sed '2q;d' )
PASSLINE=$(say "$AUTHDEETS" | sed '4q;d' )
NEWCREDS=1
remember "BTC_PASS=${PASSLINE}"
fi
if [ -n "$NEWCREDS" ]; then
sed -iE -e "s/BTC_LOGIN|^rpcauth.*/${AUTHLINE}/" $HOME/.bitcoin/bitcoin.conf
fi
say "" say ""
ask_for prune "Next question - would you like to operate bitcoin in pruned mode? \ ask_for prune "Next question - would you like to operate bitcoin in pruned mode? \
This reduces its file size from ~500GB to something more portable ${BLUE}(y/n)${RESET}: " This reduces its file size from ~500GB to something more portable ${BLUE}(y/n)${RESET}: "
say "" say ""
case $prune in case $prune in
y | Y) y | Y)
say "Let's ${GREEN}enable pruning${RESET} to keep the file size down, then." say "Let's ${GREEN}enable pruning${RESET} to keep the file size down, then."
prune_size=0 prune_size=0
while [ "$prune_size" -lt 550 ]; do while [ "$prune_size" -lt 550 ]; do
ask_for prune_size "How many Mb are you willing to put towards btc? Min 550: " ask_for prune_size "How many Mb are you willing to put towards btc? Min 550: "
done done
sed -i "s/txindex=1/prune=${prune_size}/" $HOME/.bitcoin/bitcoin.conf sed -i "s/txindex=1/prune=${prune_size}/" $HOME/.bitcoin/bitcoin.conf
;; ;;
*) *)
say "Okay great! We'll leave the bitcoin config it as it is." say "Okay great! We'll leave the bitcoin config it as it is."
;; ;;
esac esac
} }
configure_lightning() { configure_lightning() {
mkdir -p $HOME/.lightning mkdir -p $HOME/.lightning

2
ingredients/lead

@ -158,7 +158,7 @@ install_if_needed() {
case $DISTRO in case $DISTRO in
"debian") "debian")
# TODO Better installation detection than check_for # TODO Better installation detection than check_for
if dpkg -l | grep -q "$package"; then if dpkg -l | awk '{ print $2 }' | grep -q "^${package}"; then
say "$package already installed!" say "$package already installed!"
else else
say "installing $package" say "installing $package"

6
package-lock.json generated

@ -0,0 +1,6 @@
{
"name": "Alchemy",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}

40
recipes/ao.sh

@ -27,10 +27,9 @@ say ""
say "This script is designed to ask you just enough questions to keep you involved in the process," say "This script is designed to ask you just enough questions to keep you involved in the process,"
say "while making it as easy as possible for you to get it going." say "while making it as easy as possible for you to get it going."
say "" say ""
say "${BLUE}press enter to continue${RESET}" ask_for nothing "${BLUE}press enter to continue${RESET}"
read
if [ "$EUID" -eq 0 ]; then if ! id -u > /dev/null; then
say "${RED}Woah there!${RESET} Seems you're running this script as a superuser." say "${RED}Woah there!${RESET} Seems you're running this script as a superuser."
say "" say ""
say "That might cause some issues with permissions and whatnot. Run this script as your default user (without sudo) and I'll ask you when I need superuser permissions" say "That might cause some issues with permissions and whatnot. Run this script as your default user (without sudo) and I'll ask you when I need superuser permissions"
@ -50,7 +49,7 @@ case $DISTRO in
libcurl4-gnutls-dev libssl-dev fakeroot devscripts libcurl4-gnutls-dev libssl-dev fakeroot devscripts
;; ;;
"arch") "arch")
if [[ ! $(pacman -Qg base-devel) ]]; then if ! pacman -Qg base-devel; then
sudo pacman -S base-devel --noconfirm sudo pacman -S base-devel --noconfirm
fi fi
@ -64,12 +63,20 @@ case $DISTRO in
install_if_needed git wget tor sqlite3 autoconf autoconf-archive automake \ install_if_needed git wget tor sqlite3 autoconf autoconf-archive automake \
python python3 python3-mako pkg-config fakeroot devscripts python python3 python3-mako pkg-config fakeroot devscripts
;; ;;
"*")
if [ -z "$DISTRO" ]; then
say "No distro defined. Have you run \`make alchemy\` yet?"
else
say "Woah! I don't know what to do with $DISTRO yet"
fi
exit 1
;;
esac esac
say "" say ""
# ------------------- Step 2 - AO Environment Setup ------------------- # ------------------- Step 2 - AO Environment Setup -------------------
if [ ! -z $AO ]; then if [ ! -z "$AO" ]; then
say "You're currently using ao-$AO" say "You're currently using ao-$AO"
ask_for reinstall_ao "Would you like to re-install? ${BLUE}(y/n): ${RESET}" ask_for reinstall_ao "Would you like to re-install? ${BLUE}(y/n): ${RESET}"
say "" say ""
@ -83,15 +90,15 @@ if [ ! -z $AO ]; then
esac esac
fi fi
if [ -z $AO ]; then if [ -z "$AO" ]; then
AO='' AO=''
say "${BOLD}Hey!${RESET} I was wondering which ${BLUE}version of AO${RESET} you wanted to install. \n" say "${BOLD}Hey!${RESET} I was wondering which ${BLUE}version of AO${RESET} you wanted to install. \n"
say "${BOLD}1.${RESET} ao-3 (Vue)" say "${BOLD}1.${RESET} ao-3 (Vue)"
say "${BOLD}2.${RESET} ao-react (React)" say "${BOLD}2.${RESET} ao-react (React)"
fi fi
while [[ -z $AO ]]; do while [ -z "$AO" ]; do
ask_for ao-select "${BLUE}(number):${RESET} " ask_for ao_select "${BLUE}(number):${RESET} "
say "" say ""
say "" say ""
@ -112,7 +119,7 @@ done;
remember "AO=${AO}" remember "AO=${AO}"
say "" say ""
if [ $AO = "3" ] || [ $AO = 'react' ]; then if [ "$AO" = "3" -o "$AO" = 'react' ]; then
if [ -z $NVM_DIR ]; then if [ -z $NVM_DIR ]; then
install_nvm install_nvm
source ingredients/iron source ingredients/iron
@ -127,7 +134,7 @@ if [ $AO = "3" ] || [ $AO = 'react' ]; then
say "" say ""
fi fi
if [ $AO = "3" ] || [ $AO = 'react' ]; then if [ "$AO" = "3" -o "$AO" = 'react' ]; then
say "${BOLD}Installing Bitcoin Ecosystem${RESET}" say "${BOLD}Installing Bitcoin Ecosystem${RESET}"
say "" say ""
@ -146,7 +153,7 @@ if [ $AO = "3" ] || [ $AO = 'react' ]; then
fi fi
say '' say ''
if [ $AO = "3" ] || [ $AO = 'react' ]; then if [ "$AO" = "3" -o "$AO" = 'react' ]; then
say "${BOLD}Installing and configuring Tor${RESET}\n" say "${BOLD}Installing and configuring Tor${RESET}\n"
install_if_needed tor install_if_needed tor
configure_tor configure_tor
@ -169,7 +176,7 @@ say ""
# TODO this is really janky/fragile, it would be better to store this in ~/.ao # TODO this is really janky/fragile, it would be better to store this in ~/.ao
CONFIG_FILE=$HOME/ao-$AO/configuration.js CONFIG_FILE=$HOME/ao-$AO/configuration.js
UNIFIED_CONFIG=$HOME/.ao/env UNIFIED_CONFIG=$HOME/.ao/config
if [ ! -f "$UNIFIED_CONFIG" ]; then if [ ! -f "$UNIFIED_CONFIG" ]; then
touch $UNIFIED_CONFIG touch $UNIFIED_CONFIG
fi fi
@ -185,6 +192,7 @@ remember "LIGHTNINGDIR=0" to "$UNIFIED_CONFIG"
say "!!!!!!! WARNING !!!!!! I'm exaggerating but this is not going to \ say "!!!!!!! WARNING !!!!!! I'm exaggerating but this is not going to \
configure AO properly. It's time that we build out the unified config" configure AO properly. It's time that we build out the unified config"
read read
case $AO in case $AO in
"3") "3")
if [ ! -d ~/ao-3 ]; then if [ ! -d ~/ao-3 ]; then
@ -203,11 +211,11 @@ case $AO in
fi fi
say "" say ""
pushd ~/ao-3 cd ~/ao-3
npm install npm install
npm run build npm run build
npm run checkconfig npm run checkconfig
popd cd $ALCHEMY
NODE_PARAMS='' NODE_PARAMS=''
;; ;;
@ -229,10 +237,10 @@ case $AO in
say "" say ""
pushd ~/ao-react cd ~/ao-react
npm install npm install
npm run webpack npm run webpack
popd cd $ALCHEMY
NODE_PARAMS='--experimental-specifier-resolution=node -r dotenv/config' NODE_PARAMS='--experimental-specifier-resolution=node -r dotenv/config'
;; ;;

2
recipes/flask.sh

@ -31,7 +31,7 @@ say "Well, as an alchemy-themed toolkit, I must say: ${GREEN}good decision :)${R
say "" say ""
# Make sure this script isn't being run with sudo in front # Make sure this script isn't being run with sudo in front
if [ "$(id -u)" -eq 0 ]; then if id -u; then
say "${RED}${BOLD}Woah there!${RESET} Seems you're running this script as a superuser." say "${RED}${BOLD}Woah there!${RESET} Seems you're running this script as a superuser."
say "" say ""
say "That might cause some issues with permissions and whatnot. Run this script as your default user (without sudo) and I'll ask you when I need superuser permissions" say "That might cause some issues with permissions and whatnot. Run this script as your default user (without sudo) and I'll ask you when I need superuser permissions"

Loading…
Cancel
Save