-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Messages of love to all the fucks that waste my time :)
Google should just implement an incremental fucking download manager for their fucking users who don't want to download 50 gb's of data everytime they want a full backup.
- Loading branch information
1 parent
c18f49e
commit 6226bf5
Showing
2 changed files
with
76 additions
and
14 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,85 @@ | ||
const fs = require('fs') | ||
const fs = require('fs'); | ||
|
||
var f = fs.readFileSync('/proc/self/mounts').toString() | ||
|
||
var p = f.split("\n"); | ||
class MountInfo | ||
{ | ||
constructor(entry) | ||
{ | ||
this.Device = entry[0]; | ||
this.MountPoint = entry[1]; | ||
this.FSType = entry[2]; | ||
this.Options = entry[3]; | ||
this.DumpOption = entry[4]; | ||
this.MountOrder= entry[5]; | ||
|
||
// so what if there is a goddamn space in the mountpoint name ? | ||
var mounts = []; | ||
this.ContainsPath = function(pathitem) | ||
{ | ||
// ok john you're half asleep | ||
// but this should be simple no matter how goddamn old you are | ||
// and you are. | ||
// damn it. | ||
|
||
for (var i in p) | ||
{ | ||
var toentry = [] | ||
// ugh i did this already ! | ||
|
||
var entry = p[i].split(" ") | ||
// /mounty1/dir | ||
// /mounty1/dir/mounty2 | ||
// /mounty1/dir/mounty2/dir2/mounty3 | ||
// sort these out if you end up with a file /mounty1/dir/mounty2/dir/mounty3/afile | ||
// obcviously its under the third one. | ||
|
||
for (var r in entry) | ||
{ | ||
toentry.push(entry[r].replace("\\040"," ")) | ||
} | ||
if (fs.existsSync(pathitem)) | ||
{ | ||
if (pathitem.startsWith(this.MountPoint)) | ||
{ | ||
return true; | ||
} | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
this.OnDevice = function(item) | ||
{ | ||
|
||
} | ||
} | ||
} | ||
|
||
function FSMounts() { | ||
var f = fs.readFileSync('/proc/self/mounts').toString(); | ||
|
||
mounts.push(toentry); | ||
var p = f.split('\n'); | ||
|
||
// so what if there is a goddamn space in the mountpoint name ? | ||
var mounts = []; | ||
|
||
for (var i in p) { | ||
var toentry = []; | ||
|
||
var entry = p[i].split(' '); | ||
|
||
for (var r in entry) { | ||
toentry.push(entry[r].replaceAll('\\040', ' ')); | ||
} | ||
|
||
var mp = new MountInfo(toentry) | ||
mounts.push(mp); | ||
|
||
for (var m in mounts) | ||
{ | ||
if (mounts[m] != mp ) | ||
{ | ||
mp.ContainsPath(mounts[m].MountPoint); | ||
} | ||
} | ||
} | ||
|
||
return mounts; | ||
} | ||
|
||
module.exports = { | ||
GetMounts: FSMounts, | ||
MountInfo: MountInfo | ||
} |