Add OS Checks

This commit is contained in:
Yaya4 2021-12-18 14:02:56 +01:00
parent 5262138c94
commit c4f6c66c6d

View File

@ -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);