aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore10
-rwxr-xr-xgetmeall.sh10
-rwxr-xr-xgetmecziconversion.sh26
-rwxr-xr-xgetmenode.sh6
-rwxr-xr-xgetmepostgres.sh64
-rwxr-xr-xgetmeredis.sh5
-rwxr-xr-xgetmeyarn.sh30
-rwxr-xr-xinstall.sh81
-rwxr-xr-xrunmenode.sh2
-rwxr-xr-xrunmepostgres.sh14
-rwxr-xr-xrunmeredis.sh2
-rwxr-xr-xsetAndStartPG.sh5
12 files changed, 93 insertions, 162 deletions
diff --git a/.gitignore b/.gitignore
index 3a2f358..10c9014 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,7 @@
node_modules/
# compiled files
-dist/
+ext/
# LaTeX output files
*.aux
@@ -14,8 +14,7 @@ dist/
*.blg
# PostreSQL log files
-POSTGRES_logfile
-*logfile
+*.log
# Vim swap files
*.sw*
@@ -28,8 +27,3 @@ docs/
# project files
files/*
-
-# redis folder
-redis*
-
-report/deliverable-3/main.synctex.gz
diff --git a/getmeall.sh b/getmeall.sh
deleted file mode 100755
index a730588..0000000
--- a/getmeall.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-./getmenode.sh
-npm i -g yarn
-yarn
-./getmepostgres.sh
-./getmecziconversion.sh
-./getmeredis.sh
-
-echo "COMPLETE! Ready to use.";
diff --git a/getmecziconversion.sh b/getmecziconversion.sh
deleted file mode 100755
index 923e75d..0000000
--- a/getmecziconversion.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-mkdir -p ./ext/bin
-
-git clone https://github.com/glencoesoftware/jxrlib.git
-cd ./jxrlib/
-mkdir build
-make ${PWD}/build/JxrDecApp
-cp ./build/JxrDecApp ../ext/bin/JxrDecApp
-cd ../
-rm -rf jxrlib
-
-curl -L https://github.com/jcupitt/libvips/releases/download/v8.6.3/vips-8.6.3.tar.gz > vips-8.6.3.tar.gz
-tar xf vips-8.6.3.tar.gz
-rm vips-8.6.3.tar.gz
-cd vips-8.6.3
-./configure --prefix="$PWD/../ext/"
-make install
-cd ..
-rm -rf vips-8.6.3
-PATH="$PATH:$PWD/ext/bin"
-LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/ext/lib"
-
-gcc -Wall -Wextra --pedantic -std=c99 ./src/conversion/czi/cziconvert.c -o ./ext/bin/CZICrunch
-
-cp ./src/conversion/czi/convertJxrs.py ./ext/bin/convertJxrs.py
diff --git a/getmenode.sh b/getmenode.sh
deleted file mode 100755
index 5c724e7..0000000
--- a/getmenode.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
-export NVM_DIR="$HOME/.nvm"
-[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
-[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
-nvm install v9.1.0
diff --git a/getmepostgres.sh b/getmepostgres.sh
deleted file mode 100755
index bd8fffd..0000000
--- a/getmepostgres.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/bash
-
-PGDIR=${1-"$PWD/pg"}
-
-echo "> Checking for postgres at $PGDIR";
-if [ -d "$PGDIR" ]; then
- echo "Postgres Directory exists, nevermind...";
- exit 1;
-fi
-
-echo;
-echo;
-echo;
-echo "This installation process takes ~3:50 minutes to complete.";
-echo;
-echo;
-echo;
-
-echo "> Making postgres directory at $PGDIR";
-mkdir -p "$PGDIR";
-currentDir=$(pwd);
-
-echo "> Changing dir to $PGDIR";
-cd "$PGDIR";
-
-echo "> Cloning Repo";
-git clone https://github.com/postgres/postgres.git;
-
-echo "> Checking out to version 10.1";
-cd ./postgres;
-git reset --hard REL_10_1;
-
-echo "> Configuring";
-./configure --prefix="$PWD" --with-python PYTHON="/usr/bin/python2.7";
-
-echo "> Building Postgres";
-make;
-
-echo "> Installing Postgres";
-make install;
-
-echo "> Initialise the Database";
-"$PGDIR/postgres/bin/initdb" -D "$PGDIR/postgres/data/";
-echo;
-echo;
-echo;
-echo;
-echo "> Starting the postgres server";
-"$PGDIR/postgres/bin/pg_ctl" -D "$PGDIR/postgres/data/" -l POSTGRES_logfile start;
-echo "> Create the Database";
-"$PGDIR/postgres/bin/createdb" be4;
-echo "> Creating Admin user";
-"$PGDIR/postgres/bin/psql" -U ${USER} postgres -c "CREATE USER admin;";
-echo "> Granting Admin Permissions";
-"$PGDIR/postgres/bin/psql" -U ${USER} postgres -c "ALTER DATABASE be4 OWNER TO admin;";
-
-
-echo;
-echo;
-echo;
-echo;
-echo;
-echo "> Completed the installation of Postgres.";
-cd $currentDir;
diff --git a/getmeredis.sh b/getmeredis.sh
deleted file mode 100755
index b60927f..0000000
--- a/getmeredis.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-wget http://download.redis.io/redis-stable.tar.gz
-tar xvzf redis-stable.tar.gz
-rm redis-stable.tar.gz
-cd redis-stable
-make
diff --git a/getmeyarn.sh b/getmeyarn.sh
deleted file mode 100755
index 6f8e5c0..0000000
--- a/getmeyarn.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-###
-### Source: https://hackernoon.com/how-to-use-yarn-in-a-project-without-installing-yarn-f946815ddb4e
-###
-
-# Choose which version of yarn you want to use
-EXPECTED_YARN_VERSION="0.16.1"
-
-function install_yarn {
- mkdir -p ~/.yarn
- DOWNLOAD_URL="https://github.com/yarnpkg/yarn/releases/download/v$EXPECTED_YARN_VERSION/yarn-v$EXPECTED_YARN_VERSION.tar.gz"
- echo "Downloading from $DOWNLOAD_URL"
- curl -fL $DOWNLOAD_URL > ~/.yarn/yarn.tar.gz
- tar zxf ~/.yarn/yarn.tar.gz --strip-components=1 -C ~/.yarn
-}
-
-if [ -f ~/.yarn/bin/yarn ]; then
- YARN_VERSION=$(node -e 'const fs = require("fs"); console.log(JSON.parse(fs.readFileSync(".yarn/package.json")).version);')
- if [ "$YARN_VERSION" != "$EXPECTED_YARN_VERSION" ]; then
- echo "The yarn version is $YARN_VERSION, expected $EXPECTED_YARN_VERSION. Re-downloading"
- rm -rf ~/.yarn
- install_yarn
- fi
-else
- echo "The file .yarn/bin/yarn does not exist, installing yarn".
- install_yarn
-fi
-
-alias yarn="~/.yarn/bin/yarn"
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..0e15f28
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+EXT_DIR="$PWD/ext"
+
+set -e
+
+function dl {
+ curl -L "$1" | tar -xz --one-top-level="$2" --strip-components 1
+}
+
+function build {
+ cd "$1"
+ if [ -e ./configure ]; then ./configure --prefix "$EXT_DIR"; fi
+ make && make PREFIX="$EXT_DIR" install
+ cd "$OLDPWD"
+}
+
+function get_postgres {
+ PG_VER="REL_11_1"
+ PG_DL="https://github.com/postgres/postgres/archive/$PG_VER.tar.gz"
+ PG_BUILD_DIR="postgresql"
+ dl "$PG_DL" "$PG_BUILD_DIR"
+ build "$PG_BUILD_DIR"
+ rm -r "$PG_BUILD_DIR"
+}
+
+function get_vips {
+ VIPS_VER="8.7.1"
+ VIPS_DL="https://github.com/libvips/libvips/releases/download/v8.7.1/vips-$VIPS_VER.tar.gz"
+ VIPS_BUILD_DIR="vips"
+ dl "$VIPS_DL" "$VIPS_BUILD_DIR"
+ build "$VIPS_BUILD_DIR"
+ rm -r "$VIPS_BUILD_DIR"
+}
+
+function get_jxrlib {
+ JXR_VER="0.2.1"
+ JXR_DL="https://github.com/glencoesoftware/jxrlib/archive/v$JXR_VER.tar.gz"
+ JXR_BUILD_DIR="jxrlib"
+ dl "$JXR_DL" "$JXR_BUILD_DIR"
+ # Building of JxrDecApp is a bit funky:
+ cd "$JXR_BUILD_DIR"
+ make "$PWD/build/JxrDecApp"
+ mkdir -p "$EXT_DIR/bin/JxrDecApp"
+ cp "$PWD/build/JxrDecApp" "$EXT_DIR/bin/JxrDecApp"
+ cd "$OLDPWD"
+ rm -r "$JXR_BUILD_DIR"
+}
+
+function get_redis {
+ REDIS_VER="5.0.2"
+ REDIS_DL="https://github.com/antirez/redis/archive/$REDIS_VER.tar.gz"
+ REDIS_BUILD_DIR="redis"
+ dl "$REDIS_DL" "$REDIS_BUILD_DIR"
+ build "$REDIS_BUILD_DIR"
+ rm -r "$REDIS_BUILD_DIR"
+}
+
+function get_node_and_yarn {
+ NODE_VER="9.1.0"
+ NODE_DL="https://nodejs.org/download/release/v$NODE_VER/node-v$NODE_VER.tar.gz"
+ NODE_BUILD_DIR="nodejs"
+ dl "$NODE_DL" "$NODE_BUILD_DIR"
+ build "$NODE_BUILD_DIR"
+ rm -r "$NODE_BUILD_DIR"
+
+ export PATH="$EXT_DIR/bin:$PATH"
+ npm install -g yarn
+ yarn
+}
+
+LOG_DIR="build_logs"
+mkdir -p "$LOG_DIR"
+
+get_postgres >$LOG_DIR/postgres.log 2>&1 &
+get_vips >$LOG_DIR/vips.log 2>&1 &
+get_jxrlib >$LOG_DIR/jxrlib.log 2>&1 &
+get_redis >$LOG_DIR/redis.log 2>&1 &
+get_node_and_yarn >$LOG_DIR/node_and_yarn.log 2>&1 &
+
+wait
diff --git a/runmenode.sh b/runmenode.sh
deleted file mode 100755
index f41a2ac..0000000
--- a/runmenode.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-npm start
diff --git a/runmepostgres.sh b/runmepostgres.sh
index 9eee307..064ded7 100755
--- a/runmepostgres.sh
+++ b/runmepostgres.sh
@@ -1,10 +1,12 @@
#!/bin/bash
-PGDIR=${1-"$PWD/pg"}
+set -e
-# read -p "Press [Enter] key to start Postgres (will already be running if you just got it) use ctl+c to cancel";
-echo "> Starting Server";
-"$PGDIR/postgres/bin/pg_ctl" -D "$PGDIR/postgres/data/" -l POSTGRES_logfile start;
+BIN_DIR="$PWD/ext/bin"
+PG_DATA=${1-"$PWD/db"}
-# echo "> Conecting as admin user: " + ${USER};
-# "$PGDIR/postgres/bin/psql" -U ${USER} postgres;
+export PATH="$BIN_DIR:$PATH"
+
+echo "> Starting Server"
+"$BIN_DIR/pg_ctl" -D "$PG_DATA/postgres/data/" -l db.log start
+echo "> Server Started"
diff --git a/runmeredis.sh b/runmeredis.sh
index 95bbf15..4bf510d 100755
--- a/runmeredis.sh
+++ b/runmeredis.sh
@@ -1,3 +1,5 @@
#!/bin/sh
+echo "> Starting Redis"
./redis-stable/src/redis-server redis-stable/redis.conf --daemonize yes
+echo "> Redis Started"
diff --git a/setAndStartPG.sh b/setAndStartPG.sh
deleted file mode 100755
index c1db44a..0000000
--- a/setAndStartPG.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-./getmeall.sh
-./runmepostgres.sh
-./redis-stable/src/redis-server redis-stable/redis.conf &