Add a "uname and arch" function, borrowed from update.js.

This commit is contained in:
David Glasser
2013-02-25 13:59:46 -08:00
parent 089c6fad21
commit 2db2392b10

View File

@@ -15,6 +15,7 @@
var path = require("path");
var fs = require("fs");
var os = require("os");
var Future = require("fibers/future");
var _ = require("underscore");
@@ -188,5 +189,17 @@ var warehouse = module.exports = {
_randomToken: function() {
return (Math.random() * 0x100000000 + 1).toString(36);
},
_unameAndArch: function () {
// Normalize from Node "os.arch()" to "uname -m".
var arch = os.arch();
if (arch === "ia32")
arch = "i686";
else if (arch === "x64")
arch = "x86_64";
else
throw new Error("Unsupported architecture " + arch);
return os.type() + "-" + arch;
}
};