-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathupdate.js
35 lines (29 loc) · 1.05 KB
/
update.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
var scanpkg = require("scanpkg"),
fs = require('fs'),
child_process = require("child_process");
scanpkg.new("debs", function(err, result) {
if (err == scanpkg.noDirError)
console.error("Folder is not found");
if (err == scanpkg.emptyDirError)
console.error("Folder is empty");
// console.log(result);
fs.writeFile("Packages", result, "utf8", function(err) {
if (err) {
return console.log(err);
}
if (fs.existsSync("Packages.bz2")) {
fs.unlink("Packages.bz2", function(err) {
return console.log(err);
});
console.log("Removed existing Packages.bz2");
}
if (fs.existsSync("data.tar.lzma")) {
fs.unlink("data.tar.lzma", function(err) {
return console.log(err);
});
console.log("Removed wtf data.tar.lzma");
}
child_process.spawnSync("bzip2", ["Packages"]);
console.log("Finished making Packages.bz2");
});
});