32 lines
1.8 KiB

#!/usr/bin/env bash
set -euox pipefail
apt-get update
apt-get install git -y
cd ~
cp /local_baserow_repo/docs/guides/installation/
# Process the guide to only extract the bash we want
sed -n '/## HTTPS \/ SSL Support/q;p' | # We don't want to setup https or do any upgrade scripts which follow
sed -n '/^```bash$/,/^```$/p' | # Extract bash code from markdown code blocks
sed '/^```/ d' | # Get rid of the backticks left in by the previous sed
sed 's/^\$ //' | # Get rid of the bash command $ prefixes
sed 's/^sudo passwd baserow/echo -e "yourpassword\nyourpassword" | sudo passwd baserow/' | # Enter a password non interactively
sed "s/git clone --branch master.*/cp -r \/local_baserow_repo baserow/" | # Copy your local repo over instead of checking out master
sed 's/https:\\\/\\\/\\\/\\\/api.baserow.vagrant.test/g' | # Fixup the sed commands for the URL env vars
sed 's/https:\\\/\\\/\\\/\\\/baserow.vagrant.test/g' |
sed 's/https:\\\/\\\/\\\/\\\/media.baserow.vagrant.test/g' |
sed 's/' | # Fixup the sed commands for the nginx config
sed 's/' |
sed 's/' >
# Prepend with some bash settings so we can see the output and it will fail if something
# crashes.
# We dont set -u here due to problems with it using an old virtualenv and PS1 not being
# set. See
echo -e "set -eox pipefail\n$(cat" >
# TODO Figure out the right sudo su incantation to run this as a normal user with sudo