Browse Source

more posixination

main
zen 3 years ago
parent
commit
6ff70b591b
  1. 34
      ingredients/copper
  2. 52
      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
TORRCPATH='/etc/tor/torrc'
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
echo "Anyways..."
say "Anyways..."
sleep 2
fi
fi
echo -e "Your torrc is located at ${BLUE}${TORRCPATH}${RESET}"
say "Your torrc is located at ${BLUE}${TORRCPATH}${RESET}"
remember "TORRCPATH=${TORRCPATH}"
}
@ -45,7 +45,7 @@ configure_tor() {
sudo sed -i "s#USER#${USER}#g" torrc-template
sudo sed -i "s#HOME#${HOME}#g" torrc-template
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."
@ -53,7 +53,7 @@ configure_tor() {
esac
echo ""
echo -e "Tor configuration ${GREEN}complete!${RESET}"
say "Tor configuration ${GREEN}complete!${RESET}"
}
get_external_ip() {
@ -63,7 +63,7 @@ get_external_ip() {
;;
"*")
#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
@ -196,10 +196,21 @@ configure_domain_for_site() {
}
enable_ssl() {
if [ ! -z $SSL ]; then
echo "We've already gone through the SSL enabling process! Skipping"
else
if [ ! -z $DOMAIN ]; then
if [ -n "$SSL" ]; then
say "We've already gone through the SSL enabling process!"
ask_for reenable "Would you like to do it again? ${BLUE}(y/n)${RESET}: "
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): "
say ""
case $ssl in
@ -220,7 +231,7 @@ enable_ssl() {
fi
fi
if [ -z $DOMAIN ]; then
if [ -z "$DOMAIN" ]; then
ACCESS_POINT=http://localhost
else
if [ -z $SSL ]; then
@ -229,6 +240,7 @@ enable_ssl() {
ACCESS_POINT=https://$DOMAIN
fi
fi
remember "ACCESS_POINT=${ACCESS_POINT}"
}

52
ingredients/gold

@ -22,7 +22,18 @@ install_bitcoin() {
fi
# This still relies on package management though
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
sleep 1
@ -32,13 +43,14 @@ install_bitcoin() {
./configure --without-bdb # Someday, someone will complain here
make
sudo make install
cd ..
rm -rf bitcoin-22.0
}
install_lightning() {
say "${BOLD}Installing lightningd${RESET}"
git clone https://github.com/ElementsProject/lightning.git ./lightning
pushd ./lightning
cd lightning
git checkout v0.10.2
./configure
@ -48,7 +60,7 @@ install_lightning() {
pip install --user mrkd
make
sudo make install
popd
cd ..
rm -rf lightning
}
@ -67,14 +79,9 @@ install_clboss() {
}
configure_bitcoin() {
say "${BOLD}Configuring Bitcoin${RESET}"
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
say "Looks like you already have a ${BLUE}bitcoin.conf${RESET} file!"
say ""
@ -95,7 +102,34 @@ configure_bitcoin() {
say 'Created default bitcoin config'
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 ""
ask_for prune "Next question - would you like to operate bitcoin in pruned mode? \

2
ingredients/lead

@ -158,7 +158,7 @@ install_if_needed() {
case $DISTRO in
"debian")
# 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!"
else
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 "while making it as easy as possible for you to get it going."
say ""
say "${BLUE}press enter to continue${RESET}"
read
ask_for nothing "${BLUE}press enter to continue${RESET}"
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 ""
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
;;
"arch")
if [[ ! $(pacman -Qg base-devel) ]]; then
if ! pacman -Qg base-devel; then
sudo pacman -S base-devel --noconfirm
fi
@ -64,12 +63,20 @@ case $DISTRO in
install_if_needed git wget tor sqlite3 autoconf autoconf-archive automake \
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
say ""
# ------------------- Step 2 - AO Environment Setup -------------------
if [ ! -z $AO ]; then
if [ ! -z "$AO" ]; then
say "You're currently using ao-$AO"
ask_for reinstall_ao "Would you like to re-install? ${BLUE}(y/n): ${RESET}"
say ""
@ -83,15 +90,15 @@ if [ ! -z $AO ]; then
esac
fi
if [ -z $AO ]; then
if [ -z "$AO" ]; then
AO=''
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}2.${RESET} ao-react (React)"
fi
while [[ -z $AO ]]; do
ask_for ao-select "${BLUE}(number):${RESET} "
while [ -z "$AO" ]; do
ask_for ao_select "${BLUE}(number):${RESET} "
say ""
say ""
@ -112,7 +119,7 @@ done;
remember "AO=${AO}"
say ""
if [ $AO = "3" ] || [ $AO = 'react' ]; then
if [ "$AO" = "3" -o "$AO" = 'react' ]; then
if [ -z $NVM_DIR ]; then
install_nvm
source ingredients/iron
@ -127,7 +134,7 @@ if [ $AO = "3" ] || [ $AO = 'react' ]; then
say ""
fi
if [ $AO = "3" ] || [ $AO = 'react' ]; then
if [ "$AO" = "3" -o "$AO" = 'react' ]; then
say "${BOLD}Installing Bitcoin Ecosystem${RESET}"
say ""
@ -146,7 +153,7 @@ if [ $AO = "3" ] || [ $AO = 'react' ]; then
fi
say ''
if [ $AO = "3" ] || [ $AO = 'react' ]; then
if [ "$AO" = "3" -o "$AO" = 'react' ]; then
say "${BOLD}Installing and configuring Tor${RESET}\n"
install_if_needed tor
configure_tor
@ -169,7 +176,7 @@ say ""
# TODO this is really janky/fragile, it would be better to store this in ~/.ao
CONFIG_FILE=$HOME/ao-$AO/configuration.js
UNIFIED_CONFIG=$HOME/.ao/env
UNIFIED_CONFIG=$HOME/.ao/config
if [ ! -f "$UNIFIED_CONFIG" ]; then
touch $UNIFIED_CONFIG
fi
@ -185,6 +192,7 @@ remember "LIGHTNINGDIR=0" to "$UNIFIED_CONFIG"
say "!!!!!!! WARNING !!!!!! I'm exaggerating but this is not going to \
configure AO properly. It's time that we build out the unified config"
read
case $AO in
"3")
if [ ! -d ~/ao-3 ]; then
@ -203,11 +211,11 @@ case $AO in
fi
say ""
pushd ~/ao-3
cd ~/ao-3
npm install
npm run build
npm run checkconfig
popd
cd $ALCHEMY
NODE_PARAMS=''
;;
@ -229,10 +237,10 @@ case $AO in
say ""
pushd ~/ao-react
cd ~/ao-react
npm install
npm run webpack
popd
cd $ALCHEMY
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 ""
# 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 ""
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