Browse Source

Added sudo requirement in requirements.js

pull/7/head
Muthu Kumar 7 years ago
parent
commit
34de278955
  1. 5
      package-lock.json
  2. 1
      package.json
  3. 7
      utils/requirements.js

5
package-lock.json

@ -983,6 +983,11 @@
"util-deprecate": "1.0.2" "util-deprecate": "1.0.2"
} }
}, },
"readline-sync": {
"version": "1.4.7",
"resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.7.tgz",
"integrity": "sha1-ABv91MBhEMPAhMY798alYCIhPzA="
},
"rechoir": { "rechoir": {
"version": "0.6.2", "version": "0.6.2",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",

1
package.json

@ -33,6 +33,7 @@
"fs-extra": "^4.0.2", "fs-extra": "^4.0.2",
"prettyjson": "^1.2.1", "prettyjson": "^1.2.1",
"prompt": "^1.0.0", "prompt": "^1.0.0",
"readline-sync": "^1.4.7",
"shelljs": "^0.7.8" "shelljs": "^0.7.8"
}, },
"devDependencies": { "devDependencies": {

7
utils/requirements.js

@ -23,13 +23,18 @@ function requirements() {
shell.exit(1); shell.exit(1);
} }
// Check if sudo
if (process.getuid() != 0) {
console.log("`up` requires root privileges to work. Please use `sudo up <command>`");
shell.exit(1);
}
// Throw if Nginx is not found // Throw if Nginx is not found
if (!shell.which('nginx')) { if (!shell.which('nginx')) {
shell.echo( shell.echo(
'I need nginx to work. Install nginx first. https://nginx.org/'); 'I need nginx to work. Install nginx first. https://nginx.org/');
shell.exit(1); shell.exit(1);
} }
} }
module.exports = requirements; module.exports = requirements;

Loading…
Cancel
Save