summaryrefslogtreecommitdiffstats
path: root/server/lib/shell.js
diff options
context:
space:
mode:
authorJannik Schönartz2018-07-02 21:52:25 +0200
committerJannik Schönartz2018-07-02 21:52:25 +0200
commitaa4e552a03657a63922f5cd085431257c183f458 (patch)
treefc8cd63129bb54b06326c11847a9731fe70f1b33 /server/lib/shell.js
downloadbas-aa4e552a03657a63922f5cd085431257c183f458.tar.gz
bas-aa4e552a03657a63922f5cd085431257c183f458.tar.xz
bas-aa4e552a03657a63922f5cd085431257c183f458.zip
[server] Initial commit to add the node server stuff.
Diffstat (limited to 'server/lib/shell.js')
-rw-r--r--server/lib/shell.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/lib/shell.js b/server/lib/shell.js
new file mode 100644
index 0000000..ab07b81
--- /dev/null
+++ b/server/lib/shell.js
@@ -0,0 +1,31 @@
+/* global __appdir */
+var path = require('path');
+var shell = require('shelljs');
+var ipxeGIT = 'git://git.ipxe.org/ipxe.git';
+
+module.exports = {
+ buildIPXE: function(req, res) {
+ if (!shell.which('git')) {
+ return res.status(500).send({ status: 'GIT_MISSING', error_message: 'Please install git on the server.' });
+ }
+
+
+ var gitclone = 'git clone ' + ipxeGIT;
+ shell.cd(path.join(__appdir, 'ipxe'));
+ shell.exec(gitclone, function(code, stdout, stderr) {
+ shell.cd(path.join(__appdir, 'ipxe', 'ipxe', 'src'));
+ var make = 'make EMBED=' + path.join(__appdir, 'ipxe', 'main.ipxe');
+ //shell.env.PATH = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin';
+ shell.env.DEBUG = '';
+ shell.exec(make, function(code, stdout, stderr) {
+ shell.cp('-rf', 'bin/ipxe.pxe', path.join(__appdir, 'tftp'));
+ shell.cp('-rf', 'bin/undionly.kpxe', path.join(__appdir, 'tftp'));
+ //shell.rm('-rf', 'ipxe');
+ return res.status(200).send({ status: 'success' });
+ });
+ });
+ }
+};
+
+// sudo apt-get install liblzma-dev
+// sudo apt-get install mkisofs \ No newline at end of file