Browse Source

bug fixes, trimmed trailing whitespace

main
Zen 3 years ago
parent
commit
7c4879585e
  1. 92
      init.sh
  2. 58
      resources/ao-config
  3. 4
      resources/ao.nginx.conf
  4. 20
      resources/bitcoin-service-template
  5. 16
      resources/lightning-service-template
  6. 40
      resources/solarized.vim
  7. 2
      resources/tmux.conf
  8. 24
      resources/tor-service-template
  9. 2
      resources/vimrc
  10. 4
      resources/wordpress.nginx.conf
  11. BIN
      resources/wordpress.tar.gz
  12. 12
      resources/zshrc-extras
  13. 147
      scripts/ao.sh
  14. 72
      scripts/ingredients
  15. 2
      scripts/wordpress.sh
  16. 2
      scripts/write-image.sh

92
init.sh

@ -13,72 +13,74 @@ echo -e "${GREEN}${ULINE}Environment${RESET}"
if [ -f .env ]; then if [ -f .env ]; then
grep -v '^#' .env grep -v '^#' .env
export $(grep -v '^#' .env | xargs) export $(grep -v '^#' .env | xargs)
else else
echo "No .env file found, initializing" echo "No .env file found, initializing"
echo "ALCHEMY=true" > .env echo "ALCHEMY=true" > .env
fi fi
echo "" echo ""
echo -e "${GREEN}${ULINE}System Basics${RESET}" echo -e "${GREEN}${ULINE}System Basics${RESET}"
if [[ $ISA && $DISTRO && $UPDATED ]]; then if [[ $ISA && $DISTRO && $UPDATED ]]; then
echo "Nothing to do!" echo "Nothing to do!"
fi fi
if [[ ! $ISA ]]; then if [[ ! $ISA ]]; then
ISA=$(uname -m) ISA=$(uname -m)
if [ $ISA == 'x86_64' ]; then if [ $ISA == 'x86_64' ]; then
echo -e "Ayyy you got yourself an ${GREEN}x86${RESET} processor, cool" echo -e "Ayyy you got yourself an ${GREEN}x86${RESET} processor, cool"
elif [ $ISA == 'armv7l' ]; then elif [ $ISA == 'armv7l' ]; then
echo -e "I see you rockin an ${GREEN}ARM${RESET} processor, neato" echo -e "I see you rockin an ${GREEN}ARM${RESET} processor, neato"
fi fi
echo "ISA=$ISA" >> .env echo "ISA=$ISA" >> .env
fi fi
if [[ ! $DISTRO ]]; then if [[ ! $DISTRO ]]; then
if [ -f "/etc/debian_version" ]; then if [ -f "/etc/debian_version" ]; then
DISTRO="debian" DISTRO="debian"
echo -e "${GREEN}Debian${RESET}, Ubuntu, or Raspbian OS detected." echo -e "${GREEN}Debian${RESET}, Ubuntu, or Raspbian OS detected."
elif [ -f "/etc/arch-release" ]; then elif [ -f "/etc/arch-release" ]; then
DISTRO="arch" DISTRO="arch"
echo -e "${GREEN}Arch or Manjaro-based${RESET} OS detected." echo -e "${GREEN}Arch or Manjaro-based${RESET} OS detected."
elif [ -f "/etc/fedora-release" ]; then elif [ -f "/etc/fedora-release" ]; then
DISTRO="fedora" DISTRO="fedora"
echo -e "${GREEN}Fedora${RESET} detected as the Operating System" echo -e "${GREEN}Fedora${RESET} detected as the Operating System"
elif [ $(uname | grep -c "Darwin") -eq 1 ]; then elif [ $(uname | grep -c "Darwin") -eq 1 ]; then
DISTRO="mac" DISTRO="mac"
echo -e "${GREEN}MacOS${RESET} detected." echo -e "${GREEN}MacOS${RESET} detected."
else else
echo -e "I don't know ${RED}what OS you're running${RESET}! Cancelling this operation." echo -e "I don't know ${RED}what OS you're running${RESET}! Cancelling this operation."
exit 1 exit 1
fi fi
echo "DISTRO=$DISTRO" >> .env echo "DISTRO=$DISTRO" >> .env
fi fi
if [[ ! $UPDATED ]]; then if [[ ! $UPDATED ]]; then
echo "" echo ""
echo "Updating the repositories..." echo "Updating the repositories..."
echo -e "(you'll probably need to input ${BLUE}your 'sudo' password${RESET} here)" echo -e "(you'll probably need to input ${BLUE}your 'sudo' password${RESET} here)"
case $DISTRO in case $DISTRO in
"debian") "debian")
sudo apt update sudo apt update
sudo apt autoremove sudo apt autoremove
sudo apt upgrade sudo apt upgrade
;; sudo apt install build-essential
"arch") ;;
sudo pacman -Syu "arch")
;; sudo pacman -Syu --noconfirm
"fedora") sudo pacman -S base-devel --noconfirm
sudo dnf update ;;
sudo dnf upgrade "fedora")
;; sudo dnf update
"mac") sudo dnf upgrade
install ;;
sudo brew update "mac")
;; install
esac sudo brew update
;;
esac
echo "UPDATED=true" >> .env echo "UPDATED=true" >> .env
fi fi
echo "" echo ""
echo -e "${GREEN}${ULINE}Base Dependencies${RESET}" echo -e "${GREEN}${ULINE}Core Dependencies${RESET}"
install_if_needed make git wget install_if_needed git wget

58
resources/ao-config

@ -1,35 +1,35 @@
export default { export default {
bitcoind: { bitcoind: {
network: 'mainnet', network: 'mainnet',
username: 'ao', username: 'ao',
password: 'PASSLINE' password: 'PASSLINE'
}, },
bitcoinAverage: { bitcoinAverage: {
pub: '', pub: '',
secret: '' secret: ''
}, },
clightning: { clightning: {
// default is '~/.lightning/bitcoin' // default is '~/.lightning/bitcoin'
dir: 'CLIGHTNING_DIR' dir: 'CLIGHTNING_DIR'
}, },
tor: { tor: {
//hostname: '$TORHOSTNAME' //hostname: '$TORHOSTNAME'
hostname: 'TOR_HOSTNAME' hostname: 'TOR_HOSTNAME'
}, },
sqlite3: { sqlite3: {
// default is '~/.ao/database.sqlite3' // default is '~/.ao/database.sqlite3'
file: 'SQLITE_DATABASE' file: 'SQLITE_DATABASE'
}, },
hostnames: [] hostnames: [],
privateKey: 'PRIVATEKEY', privateKey: 'PRIVATEKEY',
memes: { memes: {
// default is ~/.ao/memes' // default is ~/.ao/memes'
dir: 'MEMES_DIR' dir: 'MEMES_DIR'
}, },
jitsi: { jitsi: {
domain: 'meet.dctrl.ca' domain: 'meet.dctrl.ca'
}, },
socketUrl: 'http://localhost:8003' // development socketUrl: 'http://localhost:8003' // development
// socketUrl: null // production // socketUrl: null // production
} }

4
resources/ao.nginx.conf

@ -2,10 +2,10 @@ server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server; listen [::]:80 default_server;
server_name SERVER_NAME; server_name SERVER_NAME;
root FILE_ROOT; root FILE_ROOT;
index index.html; index index.html;
location = /favicon.ico { location = /favicon.ico {
log_not_found off; log_not_found off;
access_log off; access_log off;

20
resources/bitcoin-service-template

@ -1,9 +1,9 @@
[Unit] [Unit]
Description=Bitcoin daemon Description=Bitcoin daemon
After=network.target After=network.target
[Service] [Service]
Type=notify Type=notify
NotifyAccess=all NotifyAccess=all
ExecStart=BITCOIND --daemon --server --pid=HOME/.bitcoin/bitcoind.pid ExecStart=BITCOIND --daemon --server --pid=HOME/.bitcoin/bitcoind.pid
@ -11,17 +11,17 @@ Type=forking
PIDFile=HOME/.bitcoin/bitcoind.pid PIDFile=HOME/.bitcoin/bitcoind.pid
Restart=on-failure Restart=on-failure
KillSignal=SIGINT KillSignal=SIGINT
TimeoutSec=60 TimeoutSec=60
WatchdogSec=60 WatchdogSec=60
LimitNOFILE=32768 LimitNOFILE=32768
User=USER User=USER
Group=USER Group=USER
# Hardening # Hardening
PrivateTmp=yes PrivateTmp=yes
PrivateDevices=yes PrivateDevices=yes
MemoryDenyWriteExecute=true MemoryDenyWriteExecute=true
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

16
resources/lightning-service-template

@ -1,12 +1,12 @@
[Unit] [Unit]
Description=C-Lightning daemon Description=C-Lightning daemon
Requires=bitcoin.service Requires=bitcoin.service
After=bitcoin.service After=bitcoin.service
Wants=network.target Wants=network.target
After=network.target After=network.target
[Service] [Service]
Type=forking Type=forking
NotifyAccess=all NotifyAccess=all
ExecStart=LIGHTNINGD --daemon --log-file HOME/.lightning/log --conf HOME/.lightning/config --pid-file=HOME/.lightning/lightningd.pid ExecStart=LIGHTNINGD --daemon --log-file HOME/.lightning/log --conf HOME/.lightning/config --pid-file=HOME/.lightning/lightningd.pid
User=USER User=USER
@ -15,17 +15,17 @@ Type=forking
PIDFile=HOME/.lightning/lightningd.pid PIDFile=HOME/.lightning/lightningd.pid
Restart=on-failure Restart=on-failure
KillSignal=SIGINT KillSignal=SIGINT
TimeoutSec=60 TimeoutSec=60
WatchdogSec=60 WatchdogSec=60
LimitNOFILE=32768 LimitNOFILE=32768
# Hardening # Hardening
PrivateTmp=yes PrivateTmp=yes
PrivateDevices=yes PrivateDevices=yes
ProtectSystem=true ProtectSystem=true
MemoryDenyWriteExecute=true MemoryDenyWriteExecute=true
NoNewPrivileges=true NoNewPrivileges=true
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

40
resources/solarized.vim

@ -19,9 +19,9 @@
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" OPTIONS: " OPTIONS:
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" See the "solarized.txt" help file included with this colorscheme (in the " See the "solarized.txt" help file included with this colorscheme (in the
" "doc" subdirectory) for information on options, usage, the Toggle Background " "doc" subdirectory) for information on options, usage, the Toggle Background
" function and more. If you have already installed Solarized, this is available " function and more. If you have already installed Solarized, this is available
" from the Solarized menu and command line as ":help solarized" " from the Solarized menu and command line as ":help solarized"
" "
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
@ -36,7 +36,7 @@
" and unarchive the file. " and unarchive the file.
" 2. Move `solarized.vim` to your `.vim/colors` directory. " 2. Move `solarized.vim` to your `.vim/colors` directory.
" 3. Move each of the files in each subdirectories to the corresponding .vim " 3. Move each of the files in each subdirectories to the corresponding .vim
" subdirectory (e.g. autoload/togglebg.vim goes into your .vim/autoload " subdirectory (e.g. autoload/togglebg.vim goes into your .vim/autoload
" directory as .vim/autoload/togglebg.vim). " directory as .vim/autoload/togglebg.vim).
" "
" RECOMMENDED PATHOGEN INSTALLATION OPTION: " RECOMMENDED PATHOGEN INSTALLATION OPTION:
@ -131,7 +131,7 @@
" "
" }}} " }}}
" Environment Specific Overrides "{{{ " Environment Specific Overrides "{{{
" Allow or disallow certain features based on current terminal emulator or " Allow or disallow certain features based on current terminal emulator or
" environment. " environment.
" Terminals that support italics " Terminals that support italics
@ -159,8 +159,8 @@ endif
" }}} " }}}
" Default option values"{{{ " Default option values"{{{
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" s:options_list is used to autogenerate a list of all non-default options " s:options_list is used to autogenerate a list of all non-default options
" using "call SolarizedOptions()" or with the "Generate .vimrc commands" " using "call SolarizedOptions()" or with the "Generate .vimrc commands"
" Solarized menu option. See the "Menus" section below for the function itself. " Solarized menu option. See the "Menus" section below for the function itself.
let s:options_list=[ let s:options_list=[
\'" this block of commands has been autogenerated by solarized.vim and', \'" this block of commands has been autogenerated by solarized.vim and',
@ -484,8 +484,8 @@ exe "let s:fmt_ital = ' ".s:vmode."=NONE".s:i. " term=NONE".s:i."'"
exe "let s:fmt_stnd = ' ".s:vmode."=NONE".s:s. " term=NONE".s:s."'" exe "let s:fmt_stnd = ' ".s:vmode."=NONE".s:s. " term=NONE".s:s."'"
exe "let s:fmt_revr = ' ".s:vmode."=NONE".s:r. " term=NONE".s:r."'" exe "let s:fmt_revr = ' ".s:vmode."=NONE".s:r. " term=NONE".s:r."'"
exe "let s:fmt_revb = ' ".s:vmode."=NONE".s:r.s:b. " term=NONE".s:r.s:b."'" exe "let s:fmt_revb = ' ".s:vmode."=NONE".s:r.s:b. " term=NONE".s:r.s:b."'"
" revbb (reverse bold for bright colors) is only set to actual bold in low " revbb (reverse bold for bright colors) is only set to actual bold in low
" color terminals (t_co=8, such as OS X Terminal.app) and should only be used " color terminals (t_co=8, such as OS X Terminal.app) and should only be used
" with colors 8-15. " with colors 8-15.
exe "let s:fmt_revbb = ' ".s:vmode."=NONE".s:r.s:bb. " term=NONE".s:r.s:bb."'" exe "let s:fmt_revbb = ' ".s:vmode."=NONE".s:r.s:bb. " term=NONE".s:r.s:bb."'"
exe "let s:fmt_revbbu = ' ".s:vmode."=NONE".s:r.s:bb.s:u." term=NONE".s:r.s:bb.s:u."'" exe "let s:fmt_revbbu = ' ".s:vmode."=NONE".s:r.s:bb.s:u." term=NONE".s:r.s:bb.s:u."'"
@ -729,7 +729,7 @@ hi! link diffLine Identifier
"exe "hi! gitDiffAdded" "exe "hi! gitDiffAdded"
"exe "hi! gitDiffRemoved" "exe "hi! gitDiffRemoved"
"gitcommit "gitcommit
"exe "hi! gitcommitSummary" "exe "hi! gitcommitSummary"
exe "hi! gitcommitComment" .s:fmt_ital .s:fg_base01 .s:bg_none exe "hi! gitcommitComment" .s:fmt_ital .s:fg_base01 .s:bg_none
hi! link gitcommitUntracked gitcommitComment hi! link gitcommitUntracked gitcommitComment
hi! link gitcommitDiscarded gitcommitComment hi! link gitcommitDiscarded gitcommitComment
@ -972,19 +972,19 @@ hi! link pandocMetadataTitle pandocMetadata
"}}} "}}}
" Utility autocommand "{{{ " Utility autocommand "{{{
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" In cases where Solarized is initialized inside a terminal vim session and " In cases where Solarized is initialized inside a terminal vim session and
" then transferred to a gui session via the command `:gui`, the gui vim process " then transferred to a gui session via the command `:gui`, the gui vim process
" does not re-read the colorscheme (or .vimrc for that matter) so any `has_gui` " does not re-read the colorscheme (or .vimrc for that matter) so any `has_gui`
" related code that sets gui specific values isn't executed. " related code that sets gui specific values isn't executed.
" "
" Currently, Solarized sets only the cterm or gui values for the colorscheme " Currently, Solarized sets only the cterm or gui values for the colorscheme
" depending on gui or terminal mode. It's possible that, if the following " depending on gui or terminal mode. It's possible that, if the following
" autocommand method is deemed excessively poor form, that approach will be " autocommand method is deemed excessively poor form, that approach will be
" used again and the autocommand below will be dropped. " used again and the autocommand below will be dropped.
" "
" However it seems relatively benign in this case to include the autocommand " However it seems relatively benign in this case to include the autocommand
" here. It fires only in cases where vim is transferring from terminal to gui " here. It fires only in cases where vim is transferring from terminal to gui
" mode (detected with the script scope s:vmode variable). It also allows for " mode (detected with the script scope s:vmode variable). It also allows for
" other potential terminal customizations that might make gui mode suboptimal. " other potential terminal customizations that might make gui mode suboptimal.
" "
autocmd GUIEnter * if (s:vmode != "gui") | exe "colorscheme " . g:colors_name | endif autocmd GUIEnter * if (s:vmode != "gui") | exe "colorscheme " . g:colors_name | endif
@ -998,7 +998,7 @@ function! s:SolarizedHiTrail()
syn match solarizedTrailingSpace "\s*$" syn match solarizedTrailingSpace "\s*$"
exe "hi! solarizedTrailingSpace " .s:fmt_undr .s:fg_red .s:bg_none .s:sp_red exe "hi! solarizedTrailingSpace " .s:fmt_undr .s:fg_red .s:bg_none .s:sp_red
endif endif
endfunction endfunction
augroup SolarizedHiTrail augroup SolarizedHiTrail
autocmd! autocmd!
if g:solarized_hitrail==1 if g:solarized_hitrail==1

2
resources/tmux.conf

@ -20,7 +20,7 @@ bind l select-pane -R
# reloading for faster tmux configuration # reloading for faster tmux configuration
bind r source-file ~/.tmux.conf \; display "Reloaded!" bind r source-file ~/.tmux.conf \; display "Reloaded!"
# a e s t h e t i c s # a e s t h e t i c s
set -g default-terminal "tmux-256color" set -g default-terminal "tmux-256color"
set -g default-shell /bin/zsh set -g default-shell /bin/zsh
set-option -g status on set-option -g status on

24
resources/tor-service-template

@ -1,23 +1,23 @@
[Unit] [Unit]
Description=Anonymizing overlay network for TCP (multi-instance-master) Description=Anonymizing overlay network for TCP (multi-instance-master)
After=syslog.target network.target nss-lookup.target After=syslog.target network.target nss-lookup.target
[Service] [Service]
Type=notify Type=notify
NotifyAccess=all NotifyAccess=all
ExecStartPre=+/bin/chown USER:USER /var/lib/tor ExecStartPre=+/bin/chown USER:USER /var/lib/tor
ExecStartPre=TORPATH -f TORRCPATH --verify-config ExecStartPre=TORPATH -f TORRCPATH --verify-config
ExecStart=TORPATH -f TORRCPATH ExecStart=TORPATH -f TORRCPATH
ExecReload=/bin/kill -HUP ${MAINPID} ExecReload=/bin/kill -HUP ${MAINPID}
KillSignal=SIGINT KillSignal=SIGINT
TimeoutSec=60 TimeoutSec=60
Restart=on-failure Restart=on-failure
WatchdogSec=60 WatchdogSec=60
LimitNOFILE=32768 LimitNOFILE=32768
User=root User=root
Group=USER Group=USER
# Hardening # Hardening
PrivateTmp=yes PrivateTmp=yes
PrivateDevices=yes PrivateDevices=yes
@ -29,6 +29,6 @@ ReadWriteDirectories=-/var/log/tor
ReadWriteDirectories=-HOME/.tor ReadWriteDirectories=-HOME/.tor
NoNewPrivileges=no NoNewPrivileges=no
CapabilityBoundingSet=CAP_SETUID CAP_SETGID CAP_NET_BIND_SERVICE CAP_DAC_READ_SEARCH CapabilityBoundingSet=CAP_SETUID CAP_SETGID CAP_NET_BIND_SERVICE CAP_DAC_READ_SEARCH
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

2
resources/vimrc

@ -23,7 +23,7 @@ set expandtab
" Searching -- press '/' to search in vim (or '?' to search backwards) " Searching -- press '/' to search in vim (or '?' to search backwards)
set incsearch " Highlights as you type set incsearch " Highlights as you type
set ignorecase set ignorecase
set smartcase " ignore case, unless you capitalise set smartcase " ignore case, unless you capitalise
set hlsearch set hlsearch
set showmatch set showmatch

4
resources/wordpress.nginx.conf

@ -2,10 +2,10 @@ server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server; listen [::]:80 default_server;
server_name SERVER_NAME; server_name SERVER_NAME;
root FILE_ROOT; root FILE_ROOT;
index index.php; index index.php;
location = /favicon.ico { location = /favicon.ico {
log_not_found off; log_not_found off;
access_log off; access_log off;

BIN
resources/wordpress.tar.gz

Binary file not shown.

12
resources/zshrc-extras

@ -1,10 +1,10 @@
# Extra Aliases # Extra Aliases
alias b='cd ..' alias b='cd ..'
# Checks for active tmux # Checks for active tmux
tmux ls &> /dev/null tmux ls &> /dev/null
if [ $? -eq 0 ] && [ -z "$TMUX" ]; then if [ $? -eq 0 ] && [ -z "$TMUX" ]; then
echo "\nYou have an active tmux session! Run 'tmux attach' to restore it.\n" echo "\nYou have an active tmux session! Run 'tmux attach' to restore it.\n"
elif [ -z "$TMUX" ]; then elif [ -z "$TMUX" ]; then
tmux new -s "tmux" tmux new -s "tmux"
fi fi

147
scripts/ao.sh

@ -16,7 +16,7 @@ echo ' d88P 888 888 888 888 888 888 "Y8888b. 888 .d888888 88
echo ' d8888888888 Y88b. .d88P 888 888 888 X88 Y88b. 888 888 888 888 Y8b. 888 ' echo ' d8888888888 Y88b. .d88P 888 888 888 X88 Y88b. 888 888 888 888 Y8b. 888 '
echo 'd88P 888 "Y88888P" 8888888 888 888 88888P" "Y888 "Y888888 888 888 "Y8888 888 ' echo 'd88P 888 "Y88888P" 8888888 888 888 88888P" "Y888 "Y888888 888 888 "Y8888 888 '
echo '' echo ''
# ------------------- Step 1 - Baseline Setup ------------------- # ------------------- Step 1 - Baseline Setup -------------------
@ -26,7 +26,7 @@ echo -e "This script is designed to ask you just enough questions to keep you in
read read
# echo -e "${ULINE}System Basics${RESET}" # echo -e "${ULINE}System Basics${RESET}"
# #
# if [ -f "/etc/debian_version" ]; then # if [ -f "/etc/debian_version" ]; then
# DISTRO="debian" # DISTRO="debian"
# echo -e "${GREEN}Debian${RESET}, Ubuntu, or Raspbian OS detected." # echo -e "${GREEN}Debian${RESET}, Ubuntu, or Raspbian OS detected."
@ -43,31 +43,31 @@ read
# echo -e "I don't know ${RED}what OS you're running${RESET}! Cancelling this operation." # echo -e "I don't know ${RED}what OS you're running${RESET}! Cancelling this operation."
# exit 1 # exit 1
# fi # fi
# #
# ARCHY=$(uname -m) # ARCHY=$(uname -m)
# #
# if [ $ARCHY == 'x86_64' ]; then # if [ $ARCHY == 'x86_64' ]; then
# echo -e "Ayyy you got yourself an ${GREEN}x86${RESET} processor, cool" # echo -e "Ayyy you got yourself an ${GREEN}x86${RESET} processor, cool"
# elif [ $ARCHY == 'armv7l' ]; then # elif [ $ARCHY == 'armv7l' ]; then
# echo -e "I see you rockin an ${GREEN}ARM${RESET} processor, neato" # echo -e "I see you rockin an ${GREEN}ARM${RESET} processor, neato"
# fi # fi
# #
# echo "" # echo ""
# export ALCHEMY_DISTRO=$DISTRO # export ALCHEMY_DISTRO=$DISTRO
# export ALCHEMY_ARCH=$ARCHY # export ALCHEMY_ARCH=$ARCHY
# echo "" # echo ""
# #
# echo -e "Got it! Next we're going to make sure the system's repositories (where they get their data from)\nare updated and that you have all the basic command line utilities we need to continue. \n\n${BLUE}(enter)${RESET}" # echo -e "Got it! Next we're going to make sure the system's repositories (where they get their data from)\nare updated and that you have all the basic command line utilities we need to continue. \n\n${BLUE}(enter)${RESET}"
# read # read
# #
# # Coding Moment: generally, whenever you see something with brackets at the end of it, like this() # # Coding Moment: generally, whenever you see something with brackets at the end of it, like this()
# # or like(this), it's a function! It takes inputs and gives (or does) something as an output # # or like(this), it's a function! It takes inputs and gives (or does) something as an output
# install_if_needed() { # install_if_needed() {
# for package in "$@" # for package in "$@"
# do # do
# if [ -z $(which $package 2>/dev/null) ]; then # if [ -z $(which $package 2>/dev/null) ]; then
# echo "installing" $package # echo "installing" $package
# #
# case $DISTRO in # case $DISTRO in
# "debian") # "debian")
# sudo apt install -y $package # sudo apt install -y $package
@ -82,13 +82,13 @@ read
# brew install $package # brew install $package
# ;; # ;;
# esac # esac
# #
# else # else
# echo $package 'already installed!' # echo $package 'already installed!'
# fi # fi
# done # done
# } # }
# #
# echo "Updating the repositories..." # echo "Updating the repositories..."
# echo -e "(you'll probably need to input ${BLUE}your 'sudo' password${RESET} here)" # echo -e "(you'll probably need to input ${BLUE}your 'sudo' password${RESET} here)"
# case $DISTRO in # case $DISTRO in
@ -126,7 +126,7 @@ case $DISTRO in
fi fi
install_if_needed wget python gmp sqlite3 \ install_if_needed wget python gmp sqlite3 \
python-mako python-pip net-tools zlib libsodium gettext dnsutil nginx python-mako python-pip net-tools zlib libsodium gettext dnsutils nginx
;; ;;
"mac") "mac")
# install_if_needed better-computer # install_if_needed better-computer
@ -146,7 +146,7 @@ echo -e "${BOLD}1.${RESET} ao-3 (Vue)"
echo -e "${BOLD}2.${RESET} ao-react (React)" echo -e "${BOLD}2.${RESET} ao-react (React)"
while [[ -z $AO ]]; do while [[ -z $AO ]]; do
echo -en "${BLUE}(number):${RESET} " echo -en "${BLUE}(number):${RESET} "
read -n1 ao_select read -n1 ao_select
echo "" echo ""
echo "" echo ""
@ -233,16 +233,16 @@ if [ $AO = "3" ] || [ $AO = 'react' ]; then
echo -e "${BOLD}Bitcoin installed!${RESET} Let's make sure it's configured now." echo -e "${BOLD}Bitcoin installed!${RESET} Let's make sure it's configured now."
mkdir -p ~/.bitcoin mkdir -p ~/.bitcoin
AUTHDEETS=$(python3 scripts/rpcauth.py ao) AUTHDEETS=$(python3 scripts/rpcauth.py ao)
AUTHLINE=$(echo $AUTHDEETS | grep -o rpcauth=ao:[^[:space:]]*[[:space:]]) AUTHLINE=$(echo $AUTHDEETS | grep -o rpcauth=ao:[^[:space:]]*[[:space:]])
PASSLINE=$(echo $AUTHDEETS | grep -o [^[:space:]]*\$) PASSLINE=$(echo $AUTHDEETS | grep -o [^[:space:]]*\$)
if [ -f $HOME/.bitcoin/bitcoin.conf ]; then if [ -f $HOME/.bitcoin/bitcoin.conf ]; then
echo 'bitcoin config exists' echo 'bitcoin config exists'
else else
cp resources/sample_bitcoin.conf $HOME/.bitcoin/bitcoin.conf cp resources/sample_bitcoin.conf $HOME/.bitcoin/bitcoin.conf
echo 'created default bitcoin config' echo 'created default bitcoin config'
fi fi
sed -i "s/BTC_LOGIN/${AUTHLINE}/" $HOME/.bitcoin/bitcoin.conf sed -i "s/BTC_LOGIN/${AUTHLINE}/" $HOME/.bitcoin/bitcoin.conf
@ -262,12 +262,12 @@ if [ $AO = "3" ] || [ $AO = 'react' ]; then
mkdir -p $HOME/.lightning mkdir -p $HOME/.lightning
if [ -f $HOME/.lightning/config ]; then if [ -f $HOME/.lightning/config ]; then
echo 'lightning config exists' echo 'lightning config exists'
else else
cp resources/sample_lightning_config $HOME/.lightning/config cp resources/sample_lightning_config $HOME/.lightning/config
echo 'created default lightning config' echo 'created default lightning config'
fi fi
fi fi
echo '' echo ''
@ -277,7 +277,7 @@ if [ $AO = "3" ] || [ $AO = 'react' ]; then
if [ -e /usr/local/etc/tor/torrc ]; then if [ -e /usr/local/etc/tor/torrc ]; then
TORRCPATH='/usr/local/etc/tor/torrc' TORRCPATH='/usr/local/etc/tor/torrc'
elif [ -e /etc/tor/torrc ]; then elif [ -e /etc/tor/torrc ]; then
TORRCPATH='/etc/tor/torrc' TORRCPATH='/etc/tor/torrc'
fi fi
@ -300,14 +300,28 @@ fi
echo -e "${BOLD}Configuring AO Core${RESET}\n" echo -e "${BOLD}Configuring AO Core${RESET}\n"
mkdir -p $HOME/.ao mkdir -p $HOME/.ao
if [ -f $HOME/.ao/key ]; then
echo 'We already have a private key for this AO, sweet!'
else
node scripts/createPrivateKey.js >> $HOME/.ao/key
echo -e "Just made a fresh private key and put it in ${GREEN}~/.ao${RESET}"
fi
# TODO this is really janky/fragile, it would be better to store this in ~/.ao
CONFIG_FILE=$HOME/ao-$AO/configuration.js
if [ -f $HOME/.ao/key ]; then if [ -f "$CONFIG_FILE" ]; then
echo 'We already have a private key for this AO, sweet!' echo configuration.js already exists
else else
node scripts/createPrivateKey.js >> $HOME/.ao/key cp resources/ao-config $CONFIG_FILE
echo -e "Just made a fresh private key and put it in ${GREEN}~/.ao${RESET}" sed -i "s#SQLITE_DATABASE#${HOME}/.ao/database.sqlite3#" $CONFIG_FILE
fi sed -i "s#PASSLINE#${PASSLINE}#" $CONFIG_FILE
sed -i "s#PRIVATEKEY#${HOME}/.ao/key#" $CONFIG_FILE
sed -i "s#CLIGHTNING_DIR#${HOME}/.lightning/bitcoin#" $CONFIG_FILE
sed -i "s#MEMES_DIR#${HOME}/.ao/memes#" $CONFIG_FILE
fi
echo "" echo ""
case $AO in case $AO in
@ -317,23 +331,12 @@ case $AO in
pushd ~/ao-3 pushd ~/ao-3
npm install npm install
npm run build npm run build
if [ -f "$HOME/ao-3/configuration.js" ]; then
echo configuration.js already exists
else
cp resources/ao-config $HOME/ao-react/configuration.js
sed -i "s#SQLITE_DATABASE#${HOME}/.ao/database.sqlite3#" $HOME/ao-react/configuration.js
sed -i "s#CLIGHTNING_DIR#${HOME}/.lightning/bitcoin#" $HOME/ao-react/configuration.js
sed -i "s#MEMES_DIR#${HOME}/.ao/memes#" $HOME/ao-react/configuration.js
fi
npm run checkconfig npm run checkconfig
popd popd
;; ;;
"react") "react")
echo -e "Installing ${BLUE}ao-react${RESET}" echo -e "Installing ${BLUE}ao-react${RESET}"
git clone 'https://github.com/coalition-of-invisible-colleges/ao-react.git' ~/ao-react git clone 'https://github.com/coalition-of-invisible-colleges/ao-react.git' ~/ao-react
pushd ~/ao-react pushd ~/ao-react
npm install npm install
npm run webpack npm run webpack
@ -341,24 +344,10 @@ case $AO in
;; ;;
esac esac
# TODO this is kind of janky/fragile, it would be better to store this in ~/.ao
CONFIG_FILE=$HOME/ao-$AO/configuration.js
if [ -f "$CONFIG_FILE" ]; then
echo configuration.js already exists
else
cp resources/ao-config $CONFIG_FILE
sed -i "s#SQLITE_DATABASE#${HOME}/.ao/database.sqlite3#" $CONFIG_FILE
sed -i "s#PASSLINE#${PASSLINE}#" $CONFIG_FILE
sed -i "s#PRIVATEKEY#${HOME}/.ao/key#" $CONFIG_FILE
sed -i "s#CLIGHTNING_DIR#${HOME}/.lightning/bitcoin#" $CONFIG_FILE
sed -i "s#MEMES_DIR#${HOME}/.ao/memes#" $CONFIG_FILE
fi
# ------------------- Step 4 - NGINX Setup ------------------- # ------------------- Step 4 - NGINX Setup -------------------
echo "" echo ""
echo -e "You still there? I need to ask you some questions! \n\n${BLUE}(enter)${RESET}" echo -e "You still there? I need to ask you some questions! \n\n${BLUE}(enter)${RESET}"
read read
echo "" echo ""
read -p "Do you have a domain name pointing to this computer? (y/n): " dns read -p "Do you have a domain name pointing to this computer? (y/n): " dns
@ -375,13 +364,13 @@ fi
echo "Try accessing this AO from either localhost, 127.0.0.1, or ${domain}" echo "Try accessing this AO from either localhost, 127.0.0.1, or ${domain}"
;; ;;
esac esac
if [ "$anywhere" -eq 1 ]; then if [ "$anywhere" -eq 1 ]; then
ACCESS_POINT=http://localhost ACCESS_POINT=http://localhost
else else
ACCESS_POINT=https://$domain ACCESS_POINT=https://$domain
fi fi
echo "" echo ""
# Making sure this version of NGINX supports sites-enabled # Making sure this version of NGINX supports sites-enabled
@ -395,13 +384,13 @@ fi
AO_NGINX_CONF=/etc/nginx/sites-available/ao AO_NGINX_CONF=/etc/nginx/sites-available/ao
sudo cp resources/ao.nginx.conf $AO_NGINX_CONF sudo cp resources/ao.nginx.conf $AO_NGINX_CONF
if [ -n $anywhere ]; then if [ -n $anywhere ]; then
sudo sed -i "s#SERVER_NAME#_#" $AO_NGINX_CONF sudo sed -i "s#SERVER_NAME#_#" $AO_NGINX_CONF
else else
sudo sed -i "s#SERVER_NAME#${domain}#" $AO_NGINX_CONF sudo sed -i "s#SERVER_NAME#${domain}#" $AO_NGINX_CONF
fi fi
sudo sed -i "s#FILE_ROOT#${HOME}/ao-react/dist#" $AO_NGINX_CONF sudo sed -i "s#FILE_ROOT#${HOME}/ao-react/dist#" $AO_NGINX_CONF
if [ ! -e /etc/nginx/sites-enabled/ao ]; then if [ ! -e /etc/nginx/sites-enabled/ao ]; then
@ -410,7 +399,7 @@ fi
echo "" echo ""
echo "Excellent! We've configured $AO_NGINX_CONF to serve your AO from $domain" echo "Excellent! We've configured $AO_NGINX_CONF to serve your AO from $domain"
echo "" echo ""
read -p "Would you like to enable SSL via Certbot? (y/n): " -n1 ssl read -p "Would you like to enable SSL via Certbot? (y/n): " -n1 ssl
echo "" echo ""
case $ssl in case $ssl in
@ -432,7 +421,7 @@ READY=''
echo -e "\n${BOLD}Alright, almost there!${RESET} Now we just need to set up the system daemons for Tor, Bitcoin, Lightning, and the AO so that everything opens on startup." echo -e "\n${BOLD}Alright, almost there!${RESET} Now we just need to set up the system daemons for Tor, Bitcoin, Lightning, and the AO so that everything opens on startup."
while [[ -z $READY ]]; do while [[ -z $READY ]]; do
echo -en "${BLUE}You ready? (y/n):${RESET} " echo -en "${BLUE}You ready? (y/n):${RESET} "
read -n1 ao_select read -n1 ao_select
echo "" echo ""
echo "" echo ""
@ -488,7 +477,7 @@ else
fi fi
echo -e "Enabling and starting ${GREEN}Bitcoin${RESET}" echo -e "Enabling and starting ${GREEN}Bitcoin${RESET}"
sudo systemctl enable bitcoin sudo systemctl enable bitcoin
sudo systemctl start bitcoin sudo systemctl start bitcoin
echo "" echo ""
echo "Creating lightning.service..." echo "Creating lightning.service..."
@ -505,7 +494,7 @@ else
fi fi
echo -e "Enabling and starting ${GREEN}lightning${RESET} " echo -e "Enabling and starting ${GREEN}lightning${RESET} "
sudo systemctl enable lightning sudo systemctl enable lightning
sudo systemctl start lightning sudo systemctl start lightning
echo "" echo ""
echo "Creating ao.service..." echo "Creating ao.service..."
@ -522,7 +511,7 @@ else
fi fi
echo -e "Enabling and starting the ${GREEN}AO${RESET}'s backend" echo -e "Enabling and starting the ${GREEN}AO${RESET}'s backend"
sudo systemctl enable ao sudo systemctl enable ao
sudo systemctl start ao sudo systemctl start ao
echo "" echo ""
echo -e "Enabling and starting ${GREEN}NGINX${RESET} as the webserver" echo -e "Enabling and starting ${GREEN}NGINX${RESET} as the webserver"
@ -564,37 +553,37 @@ fi
echo '*********************************************************' echo '*********************************************************'
echo -e "* ${BOLD}Version Information${RESET} *" echo -e "* ${BOLD}Version Information${RESET} *"
echo '*********************************************************' echo '*********************************************************'
echo ' ' echo ' '
echo 'make Version' echo 'make Version'
echo '*********************************************************' echo '*********************************************************'
make --version make --version
echo ' ' echo ' '
echo 'node Version' echo 'node Version'
echo '*********************************************************' echo '*********************************************************'
node --version node --version
echo ' ' echo ' '
echo 'sqlite3 Version' echo 'sqlite3 Version'
echo '*********************************************************' echo '*********************************************************'
sqlite3 --version sqlite3 --version
echo ' ' echo ' '
echo 'tor Version' echo 'tor Version'
echo '*********************************************************' echo '*********************************************************'
tor --version tor --version
echo ' ' echo ' '
echo 'bitcoind Version' echo 'bitcoind Version'
echo '*********************************************************' echo '*********************************************************'
bitcoind --version bitcoind --version
echo ' ' echo ' '
echo 'lightningd Version' echo 'lightningd Version'
echo '*********************************************************' echo '*********************************************************'
lightningd --version lightningd --version
echo ' ' echo ' '
echo 'clboss Version' echo 'clboss Version'
echo '*********************************************************' echo '*********************************************************'

72
scripts/ingredients

@ -1,49 +1,49 @@
#!/bin/bash #!/bin/bash
# Font decoration for better a e s t h e t i c # Font decoration for better a e s t h e t i c
RED="\e[0;31m" RED="\e[0;31m"
GREEN="\e[0;32m" GREEN="\e[0;32m"
BLUE="\e[0;34m" BLUE="\e[0;34m"
BOLD="\e[1m" BOLD="\e[1m"
ULINE="\e[4m" ULINE="\e[4m"
RESET="\e[0m" RESET="\e[0m"
# Make sure that ctrl+C actually exits the script # Make sure that ctrl+C actually exits the script
trap "exit" INT trap "exit" INT
# Give informative error messages # Give informative error messages
trap 'echo "Oops! Something went wrong on line $LINENO of this script. Exit code was $?" >&2' ERR trap 'echo -e "${RED}Oops!${RESET} Something went wrong on line $LINENO of this script. Exit code was $?" >&2' ERR
# --------------- Functions --------------- # --------------- Functions ---------------
# Coding Moment: generally, whenever you see something with brackets at the end of it, like this() # Coding Moment: generally, whenever you see something with brackets at the end of it, like this()
# or like(this), it's a function! It takes inputs and gives (or does) something as an output # or like(this), it's a function! It takes inputs and gives (or does) something as an output
install_if_needed() { install_if_needed() {
for package in "$@" for package in "$@"
do do
# TODO Better installation detection than "which" # TODO Better installation detection than "which"
if [ -z $(which $package 2>/dev/null) ]; then if [ -z $(which $package 2>/dev/null) ]; then
echo "installing" $package echo "installing" $package
case $DISTRO in case $DISTRO in
"debian") "debian")
sudo apt install -y $package sudo apt install -y $package
;; ;;
"arch") "arch")
sudo pacman -S $package --noconfirm --needed sudo pacman -S $package --noconfirm --needed
;; ;;
"fedora") "fedora")
sudo dnf install -y $package sudo dnf install -y $package
;; ;;
"mac") "mac")
brew install $package brew install $package
;; ;;
esac esac
else else
echo $package 'already installed!' echo $package 'already installed!'
fi fi
done done
} }
# --------------- Environment Setup --------------- # --------------- Environment Setup ---------------
if [ -f .env ]; then if [ -f .env ]; then

2
scripts/wordpress.sh

@ -79,7 +79,7 @@ while [[ MATCH -eq 0 ]]; do
sudo mariadb -e "CREATE DATABASE wordpress;" sudo mariadb -e "CREATE DATABASE wordpress;"
sudo mariadb -e "GRANT ALL ON wordpress.* TO '${USER}'@'localhost' IDENTIFIED BY '${pass}' WITH GRANT OPTION;" sudo mariadb -e "GRANT ALL ON wordpress.* TO '${USER}'@'localhost' IDENTIFIED BY '${pass}' WITH GRANT OPTION;"
sudo mariadb -e "FLUSH PRIVILEGES;" sudo mariadb -e "FLUSH PRIVILEGES;"
else else
echo "Passwords did not match :(" echo "Passwords did not match :("
echo "" echo ""
fi fi

2
scripts/write-image.sh

@ -74,7 +74,7 @@ esac
echo "" echo ""
echo -e "Getting ready to write ${GREEN}$image${NC} to ${BLUE}$target${NC}" echo -e "Getting ready to write ${GREEN}$image${NC} to ${BLUE}$target${NC}"
echo "" echo ""
read -p "Press Enter to continue (ctrl+C to cancel):" read -p "Press Enter to continue (ctrl+C to cancel):"
case $image in case $image in
*.iso) *.iso)

Loading…
Cancel
Save