-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
executable file
·42 lines (35 loc) · 1.16 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env node
process.env.UV_THREADPOOL_SIZE = 128;
const colors = require('colors/safe');
const { exec } = require('child_process');
const execsync = require('child_process').execSync;
const fs = require('fs');
// eslint-disable-next-line camelcase
const download_oc = require('./src/download');
console.log(colors.yellow('======================== Check for OC Version Installed ============================='));
console.log(colors.yellow('The folowing versions of oc are installed at /opt/openshift'));
// Check to see if /usr/bin/oc exists
if (execsync('test /usr/bin/oc')) {
execsync('sudo touch /usr/bin/oc');
}
// Check to see if /opt/openshift exists creates empty dir Installed
if (!fs.existsSync('/opt/openshift/Installed')) {
execsync('sudo mkdir -p /opt/openshift/Installed');
}
function startprogram() {
exec('ls /opt/openshift', (error, stdout, stderr) => {
if (error) {
console.log('error :', error);
}
if (stderr) {
console.log('stderr', stderr);
}
console.log(colors.yellow(stdout));
if (stdout) {
execsync('sudo rm -rf /opt/openshift/Installed');
download_oc(() => {
});
}
});
}
startprogram();