WIP: beginning of new seq to install matrix-dimenstion
This commit is contained in:
3
seqs/matrix-dimension.cfg.example
Normal file
3
seqs/matrix-dimension.cfg.example
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
SEQ_DIMENSION_DIR="/opt/matrix-dimension"
|
79
seqs/matrix-dimension.sh
Executable file
79
seqs/matrix-dimension.sh
Executable file
@@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
|
||||
toolName=matrix-dimension
|
||||
toolDownUrl="https://github.com/turt2live/matrix-dimension.git"
|
||||
toolAptDeps="nodejs"
|
||||
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
|
||||
APTOPT=
|
||||
CONFIG=0
|
||||
SCRIPT_FILE=$(basename -- $0)
|
||||
SCRIPT_NAME=${SCRIPT_FILE%%.*}
|
||||
CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg"
|
||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
||||
|
||||
step_config() {
|
||||
## or to use sequencer api with global config file:
|
||||
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
||||
if [ $? -eq 0 ] ; then
|
||||
CONFIG=1
|
||||
else
|
||||
# End if no configuration file exists
|
||||
[ $DRY -eq 0 ] && return -1
|
||||
fi
|
||||
|
||||
## Apt cmdline option to suppress user interaction
|
||||
[ $QUIET -ne 0 ] && APTOPT="-y"
|
||||
|
||||
echoerr " [W] $SCRIPT_NAME is still in alpha stage"
|
||||
echoerr " TODO: - systemd script"
|
||||
echoerr " - initial config creation"
|
||||
|
||||
## Return of non zero value will abort the sequence
|
||||
return 0
|
||||
}
|
||||
|
||||
step_1_info() { echo "Install $toolName dependencies"; }
|
||||
step_1_alias() { ALIAS="install"; }
|
||||
step_1() {
|
||||
exep curl -sL https://deb.nodesource.com/setup_12.x \| bash -
|
||||
exe apt install $toolAptDeps $APTOPT
|
||||
}
|
||||
|
||||
step_2_info() { echo "Setup and build"; }
|
||||
step_2_alias() { ALIAS="setup"; }
|
||||
step_2() {
|
||||
if [ ! -e "$SEQ_DIMENSION_DIR" ]; then
|
||||
exe mkdir -p "$SEQ_DIMENSION_DIR"
|
||||
exe cd "$SEQ_DIMENSION_DIR/.."
|
||||
# Download dimension
|
||||
exe git clone $toolDownUrl
|
||||
fi
|
||||
|
||||
exe cd "$SEQ_DIMENSION_DIR"
|
||||
|
||||
# Install dependencies
|
||||
exe npm install
|
||||
|
||||
# Build it
|
||||
exe npm run build
|
||||
}
|
||||
|
||||
step_10_info() { echo "Start $toolName"; }
|
||||
step_10_alias() { ALIAS="start"; }
|
||||
step_10() {
|
||||
if [ ! -e "$SEQ_DIMENSION_DIR" ]; then
|
||||
echoerr " [E] $toolName not found ad $SEQ_DIMENSION_DIR"
|
||||
return 1;
|
||||
fi
|
||||
exe cd "$SEQ_DIMENSION_DIR"
|
||||
# TODO is "node build/app/index.js" enough after build
|
||||
# NODE_ENV=production npm run start:app runs actually:
|
||||
# start:app: `npm run-script build && node build/app/index.js`
|
||||
exep NODE_ENV=production node build/app/index.js
|
||||
}
|
||||
|
||||
VERSION_SEQREV=15
|
||||
. /usr/local/bin/sequencer.sh
|
Reference in New Issue
Block a user