Skip to content

Commit e8b7752

Browse files
authored
release merge (#375)
* EWC-360 preinstall to preuninstall (#374) * Update package.json
1 parent 55dc95a commit e8b7752

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iofogcontroller",
3-
"version": "1.0.16",
3+
"version": "1.0.17",
44
"description": "ioFog Controller project for Eclipse IoFog @ iofog.org \\nCopyright (c) 2018 Edgeworx, Inc.",
55
"main": "./src/main.js",
66
"author": "Saeid Baghbidi",
@@ -37,7 +37,7 @@
3737
"start": "NODE_ENV=production node ./src/main.js start",
3838
"start-dev": "NODE_ENV=development node ./src/main.js start",
3939
"build": "export NODE_ENV=production && cd src/sequelize && ../../node_modules/.bin/sequelize db:migrate && ../../node_modules/.bin/sequelize db:seed:all",
40-
"preinstall": "bash scripts/preinstall.sh",
40+
"preuninstall": "bash scripts/preuninstall.sh",
4141
"postinstall": "bash scripts/postinstall.sh",
4242
"lint": "./node_modules/.bin/eslint \"**/*.js\""
4343
},

scripts/preuninstall.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
#store prev ver number
4+
export PREV_IOFOG_CONTROLLER_VER=$(npm list --depth=0 -g --silent | grep iofogcontroller | awk -F "@" '{print $2}')
5+
printf 'prev_ver: '$PREV_IOFOG_CONTROLLER_VER > /tmp/iofogcontroller_install_variables
6+
7+
#backup db
8+
IOFOG_CONTROLLER_BIN_DIR=$(whereis iofog-controller | awk -F " " '{print $2}')
9+
IOFOG_CONTROLLER_BIN_DIR=${IOFOG_CONTROLLER_BIN_DIR%"iofog-controller"}
10+
IOFOG_CONTROLLER_SEQUELIZE_DIR=$IOFOG_CONTROLLER_BIN_DIR'../lib/node_modules/iofogcontroller/src/sequelize'
11+
12+
DEV_DB_FILE=$IOFOG_CONTROLLER_SEQUELIZE_DIR'/dev_database.sqlite'
13+
if [ -f $DEV_DB_FILE ]; then
14+
mv $DEV_DB_FILE /tmp/
15+
fi
16+
PROD_DB_FILE=$IOFOG_CONTROLLER_SEQUELIZE_DIR'/prod_database.sqlite'
17+
if [ -f $PROD_DB_FILE ]; then
18+
mv $PROD_DB_FILE /tmp/
19+
fi

0 commit comments

Comments
 (0)