-
Notifications
You must be signed in to change notification settings - Fork 1
/
updater.js
59 lines (59 loc) · 2.11 KB
/
updater.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import fs from "fs";
console.log("initializing install...");
fs.readFile('config.js', 'utf8', function (err, data) {
if(err){
console.log("first time install");
console.log("creating default config...");
fs.copyFile("config-default.js", "config.js", (err) => {
if(err){
console.log("failed to create default config");
}
else{
console.log("default config created");
fs.rename("config-default.js", "mcburn-js/config-default.js", function (err_b) {
if(err_b){
console.log("failed to move config-default.js to mcburn-js");
}
else{
console.log("config-default.js moved to mcburn-js");
}
});
fs.rename("updater.js", "mcburn-js/updater.js", function (err_c) {
if(err_c){
console.log("failed to move updater.js to mcburn-js");
}
else{
console.log("updater.js moved to mcburn-js");
fs.rmSync('mcburn-js', { recursive: true });
console.log("mcburn-js purged");
console.log("mcburn installed successfully!");
console.log("open config.js and add your settings");
}
});
}
});
}
else{
console.log("previous install detected");
console.log("cleaning up!");
fs.rename("config-default.js", "mcburn-js/config-default.js", function (err_d) {
if(err_d){
console.log("failed to move config-default.js to mcburn-js");
}
else{
console.log("config-default.js moved to mcburn-js");
}
});
fs.rename("updater.js", "mcburn-js/updater.js", function (err_e) {
if(err_e){
console.log("failed to move updater.js to mcburn-js");
}
else{
console.log("updater.js moved to mcburn-js");
fs.rmSync('mcburn-js', { recursive: true });
console.log("mcburn-js purged");
console.log("mcburn updated successfully!");
}
});
}
});