Install fixes

This commit is contained in:
NGPixel 2017-04-07 15:22:20 -04:00
parent 9f9e75c99f
commit 6fdea32a50
3 changed files with 21 additions and 39 deletions

View File

@ -91,7 +91,7 @@ module.exports = (port, spinner) => {
reject(new Error('Git is not installed or not reachable from PATH.')) reject(new Error('Git is not installed or not reachable from PATH.'))
} }
let gitver = _.chain(stdout.replace(/[^\d.]/g, '')).split('.').take(3).join('.').value() let gitver = _.chain(stdout.replace(/[^\d.]/g, '')).split('.').take(3).join('.').value()
if (!semver.satisfies(semver.clean(gitver), '>=2.11.0')) { if (!semver.satisfies(semver.clean(gitver), '>=2.7.4')) {
reject(new Error('Git version is too old. Minimum is v2.7.4.')) reject(new Error('Git version is too old. Minimum is v2.7.4.'))
} }
resolve('Git v' + gitver + ' detected. Minimum is v2.7.4.') resolve('Git v' + gitver + ' detected. Minimum is v2.7.4.')

View File

@ -192,47 +192,23 @@ module.exports = function (passport) {
db.onReady.then(() => { db.onReady.then(() => {
db.User.findOne({ provider: 'local', email: 'guest' }).then((c) => { db.User.findOne({ provider: 'local', email: 'guest' }).then((c) => {
if (c < 1) { if (c < 1) {
// Create root admin account // Create guest account
winston.info('[AUTH] No administrator account found. Creating a new one...') return db.User.create({
db.User.hashPassword('admin123').then((pwd) => { provider: 'local',
return db.User.create({ email: 'guest',
provider: 'local', name: 'Guest',
email: appconfig.admin, password: '',
name: 'Administrator', rights: [{
password: pwd, role: 'read',
rights: [{ path: '/',
role: 'admin', exact: false,
path: '/', deny: !appconfig.public
exact: false, }]
deny: false
}]
})
}).then(() => { }).then(() => {
winston.info('[AUTH] Administrator account created successfully!') winston.info('[AUTH] Guest account created successfully!')
}).then(() => {
if (appdata.capabilities.guest) {
// Create guest account
return db.User.create({
provider: 'local',
email: 'guest',
name: 'Guest',
password: '',
rights: [{
role: 'read',
path: '/',
exact: false,
deny: !appconfig.public
}]
}).then(() => {
winston.info('[AUTH] Guest account created successfully!')
})
} else {
return true
}
}).catch((err) => { }).catch((err) => {
winston.error('[AUTH] An error occured while creating administrator/guest account:') winston.error('[AUTH] An error occured while creating guest account:')
winston.error(err) winston.error(err)
}) })
} }

View File

@ -11,6 +11,7 @@ const zlib = require('zlib')
const inquirer = require('inquirer') const inquirer = require('inquirer')
const colors = require('colors/safe') const colors = require('colors/safe')
const _ = require('lodash') const _ = require('lodash')
const os = require('os')
let installDir = path.resolve(__dirname, '../..') let installDir = path.resolve(__dirname, '../..')
@ -32,6 +33,11 @@ pm2.connectAsync().then(() => {
}).catch(err => { // eslint-disable-line handle-callback-err }).catch(err => { // eslint-disable-line handle-callback-err
return true return true
}) })
}).then(() => {
if (os.totalmem() < 1024 * 1024 * 768) {
throw new Error('Not enough memory to install dependencies. Minimum is 768 MB.')
}
return true
}).then(() => { }).then(() => {
/** /**
* Fetch version from npm package * Fetch version from npm package