Add OS Checks
This commit is contained in:
parent
5262138c94
commit
c4f6c66c6d
7
index.js
7
index.js
@ -14,10 +14,17 @@ function log(message, type) {
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform != 'darwin' && process.platform != 'linux') {
|
||||
log(`You can't run this script on (${process.platform}) only works on Darwin/Linux Platform.`, 'error');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function checkRoot() {
|
||||
return process.getuid && process.getuid() === 0
|
||||
};
|
||||
|
||||
log(`Running the script on ${process.platform} and arch ${process.arch}`, "success");
|
||||
|
||||
if (!checkRoot()) {
|
||||
log(`Please run ass root (Current UID = ${process.getuid()}, Need UID = 0)`, "error");
|
||||
process.exit(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user