Add OS Checks
This commit is contained in:
		
							
								
								
									
										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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user