Skip to content

Commit

Permalink
Build updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sbs20 committed Aug 2, 2017
1 parent 309fb5e commit bc8dc9c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 14 deletions.
7 changes: 5 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ var gulp = require('gulp');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var zip = require('gulp-zip');
var chmod = require('gulp-chmod');
var filter = require('gulp-filter');
var tar = require('gulp-tar');
var gzip = require('gulp-gzip');

var browserify = require('browserify');
var browserifyshim = require('browserify-shim');
var source = require('vinyl-source-stream');
Expand Down Expand Up @@ -94,16 +94,19 @@ gulp.task('build', ['compile'], function () {
'./*assets/**/*',
'./*classes/**/*',
'./*data/**/*.md',
]).pipe(gulp.dest('./build'));
]).pipe(gulp.dest('./build/scanservjs'));
});

gulp.task('package', ['build'], function () {
var filename = 'scanservjs_' + dateFormat(new Date(), 'yyyymmdd.HHMMss') + '.tar';
var shellFilter = filter('**/*.sh', {restore: true})
return gulp.src('./build/**/*')
// Filter to shell scripts and chmod +x
.pipe(shellFilter)
.pipe(chmod(0o755))
.pipe(shellFilter.restore)
// Now chmod all dirs +x
.pipe(chmod(null, 0o755))
.pipe(tar(filename))
.pipe(gzip())
.pipe(gulp.dest('./release'));
Expand Down
5 changes: 3 additions & 2 deletions install.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ Download the [latest release](https://github.com/sbs20/scanservjs/releases) and

e.g.
```
wget -O ~/scanservjs-release.zip https://github.com/sbs20/scanservjs/releases/download/v0.1.2/scanservjs_20170117.144056.zip
unzip scanservjs-release.zip -d scanserv-release && rm scanservjs-release.zip
wget -O ~/scanservjs.tar.gz $(curl -s https://api.github.com/repos/sbs20/scanservjs/releases/latest | grep browser_download_url | cut -d '"' -f 4)
tar -xf scanservjs.tar.gz
sudo ./scanservjs/install.sh
```

Then see [install](install.sh)
33 changes: 25 additions & 8 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
#!/bin/bash
#!/bin/sh

# This script assumes you have already downloaded (or built) a
# *release* version of scanservjs. To download go to
# https://github.com/sbs20/scanservjs/releases and get the latest file
# https://github.com/sbs20/scanservjs/releases/latest and get the latest file

# ALSO - RUN THIS WITH SUDO
# Check we have the necessary privileges
ROOTUID="0"
if [ "$(id -u)" -ne "$ROOTUID" ] ; then
echo "Error: This script must be executed with root privileges. Try sudo."
exit 1
fi

# Check dependencies
if ! [ -x "$(command -v node)" ]; then
echo 'Error: nodejs is not installed.' >&2
exit 1
fi

if ! [ -x "$(command -v npm)" ]; then
echo 'Error: npm is not installed.' >&2
exit 1
fi

# Example:
# wget -O ~/scanservjs-release.zip https://github.com/sbs20/scanservjs/releases/download/v0.1.1/scanservjs_20170113.173920.zip
# unzip scanservjs-release.zip -d scanserv-release && rm scanservjs-release.zip
# Set correct src dir
srcdir="$( cd "$( dirname "$0" )" && pwd )"

# Set up variables here
scansrvjs_home=/var/www/scanservjs
scanservjs_status=`systemctl is-active scanservjs 2>&1 | tr -s \\n`
scanservjs_user_exists=`grep scanservjs /etc/passwd 2>&1 | tr -s \\n`
Expand Down Expand Up @@ -64,5 +79,7 @@ systemctl daemon-reload
# Start the new service
systemctl start scanservjs

# If you have problems with the service starting use
# `journalctl -xe`
echo "scanservjs starting"
echo "http://127.0.0.1:8080"
echo
echo "If you have problems, try 'journalctl -xe'"
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"gulp-jshint": "^2.0.4",
"gulp-tar": "^2.0.0",
"gulp-uglify": "^2.0.0",
"gulp-zip": "^3.2.0",
"jquery": "^3.1.1",
"jquery-jcrop": "^0.9.13",
"jqueryui": "^1.11.1",
Expand Down
10 changes: 9 additions & 1 deletion uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/bash
#!/bin/sh

# Check we have the necessary privileges
ROOTUID="0"
if [ "$(id -u)" -ne "$ROOTUID" ] ; then
echo "Error: This script must be executed with root privileges. Try sudo."
exit 1
fi

scansrvjs_home=/var/www/scanservjs

# Stop and dsiable service
Expand Down

0 comments on commit bc8dc9c

Please sign in to comment.