diff --git a/package-lock.json b/package-lock.json index 3029a64..fd51ec5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -983,6 +983,11 @@ "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": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", diff --git a/package.json b/package.json index d4e7407..0d9be20 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "fs-extra": "^4.0.2", "prettyjson": "^1.2.1", "prompt": "^1.0.0", + "readline-sync": "^1.4.7", "shelljs": "^0.7.8" }, "devDependencies": { diff --git a/utils/requirements.js b/utils/requirements.js index da339af..26b2cdb 100644 --- a/utils/requirements.js +++ b/utils/requirements.js @@ -22,6 +22,12 @@ function requirements() { " if you want `up` to be ported for your distro"); shell.exit(1); } + + // Check if sudo + if (process.getuid() != 0) { + console.log("`up` requires root privileges to work. Please use `sudo up `"); + shell.exit(1); + } // Throw if Nginx is not found if (!shell.which('nginx')) { @@ -29,7 +35,6 @@ function requirements() { 'I need nginx to work. Install nginx first. https://nginx.org/'); shell.exit(1); } - } module.exports = requirements;