diff options
author | Teddy Wing | 2018-11-09 13:13:10 +0100 |
---|---|---|
committer | Teddy Wing | 2018-11-09 13:14:24 +0100 |
commit | 5f915bf49fe9651d9390dc3bf54af75b5cd6e421 (patch) | |
tree | d6396fc364225a375d71fe4554736ced7cfd42f0 | |
parent | 9f00878e27f8729112367f832dc6191c1ccc3d3f (diff) | |
download | dome-key-web-5f915bf49fe9651d9390dc3bf54af75b5cd6e421.tar.bz2 |
Add setup scripts
Add a script to install dependencies and perform initial application
setup.
Another script sources the environment file.
-rwxr-xr-x | license-generator/bin/init | 3 | ||||
-rwxr-xr-x | license-generator/bin/setup | 39 |
2 files changed, 42 insertions, 0 deletions
diff --git a/license-generator/bin/init b/license-generator/bin/init new file mode 100755 index 0000000..fc94ebd --- /dev/null +++ b/license-generator/bin/init @@ -0,0 +1,3 @@ +#!/bin/sh + +source .env diff --git a/license-generator/bin/setup b/license-generator/bin/setup new file mode 100755 index 0000000..04b411f --- /dev/null +++ b/license-generator/bin/setup @@ -0,0 +1,39 @@ +#!/bin/sh + +function program_exists () { + local program="$1" + + command -v "$program" > /dev/null +} + +function install_if_not_found () { + local program="$1" + + if ! program_exists "$1"; then + brew install "$program" + fi +} + +if [ "$1" = "--install" ]; then + if ! program_exists hasp; then + mkdir /usr/local/Cellar/hasp + git clone https://github.com/djanowski/hasp.git /usr/local/Cellar/hasp/HEAD + brew link hasp + fi + + install_if_not_found golang-migrate + + if ! program_exists mysql; then + brew install mariadb + fi +fi + + +if [ ! -f .env ]; then + cp .env.sample .env +fi + + +vim .env +source .env +migrate-up |