-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtree.js
68 lines (60 loc) · 1.71 KB
/
tree.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
60
61
62
63
64
65
66
67
68
/**
* The `Tree` class contains a directory tree and associated
* default files in a CFS FHS implementation.
*/
class Tree {
/**
* Expose `Tree` class as static getter
* @public
* @accessor
* @type {Tree}
*/
static get Tree() { return Tree }
constructor() {
/**
* An array of partitioned file systems.
* @public
* @const
* @type {Array<String>}
*/
this.partitions = []
/**
* An array of the default directory structure for a CFS.
* This directory tree defines a subset of the Filesystem Hierarchy Standard.
* Directories in the file system tree are intended to have similar use to
* their "Unix" equivalent.
* @public
* @const
* @type {Array<String>}
*/
this.directories = []
/**
* An array of default files that are managed by a CFS file system. They
* are recreated, if deleted, and are typically reserved for internal usage.
* @public
* @const
* @type {Array<String>}
*/
this.files = []
// FHS partitions
this.partitions.push('/etc')
this.partitions.push('/lib')
this.partitions.push('/tmp')
this.partitions.push('/var')
this.partitions.push('/home')
// FHS partition directories
this.directories.push('/var/log')
this.directories.push('/var/cache')
// CFS files
this.files.push('/etc/cfs-id')
this.files.push('/etc/cfs-epoch')
this.files.push('/etc/cfs-signature')
this.files.push('/var/log/events')
// lock this tree down!
Object.seal(Object.freeze(this.partitions))
Object.seal(Object.freeze(this.directories))
Object.seal(Object.freeze(this.files))
Object.seal(Object.freeze(this))
}
}
module.exports = new Tree()