Skip to content

Commit bce318e

Browse files
committed
Cleaned execution of ExclFS
1 parent c5c4d9d commit bce318e

File tree

2 files changed

+17
-36
lines changed

2 files changed

+17
-36
lines changed

lib/jocker_root.js

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const MS_NODEV = flags.MS_NODEV
1212
const MS_NOSUID = flags.MS_NOSUID
1313

1414

15-
const EXCLFS_BIN = '/bin/exclfs'
16-
const HOME = '/tmp'
15+
const HOME = '/tmp'
1716

1817

1918
/**
@@ -106,47 +105,28 @@ function prepareRootFilesystems(upperdir, callback)
106105
}
107106
]
108107

109-
// Using ExclFS filesystem
110-
fs.access(EXCLFS_BIN, fs.constants.X_OK, function(error)
108+
const path = upperdir+'/dev'
109+
110+
mkdirp(path, '0000', function(error)
111111
{
112-
var path = upperdir+'/dev'
112+
if(error && error.code !== 'EEXIST') return callback(error)
113113

114-
if(error)
114+
var argv = ['/dev', path, '-o', 'ownerPerm=true']
115+
var options =
115116
{
116-
arr.unshift({
117-
path: path,
118-
flags: MS_BIND,
119-
extras: {devFile: '/dev'}
120-
})
121-
122-
return async.each(arr, mkdirMountInfo, callback)
117+
detached: true,
118+
stdio: 'inherit'
123119
}
124120

125-
mkdirp(path, '0000', function(error)
126-
{
127-
if(error && error.code !== 'EEXIST') return callback(error)
128-
129-
var argv = ['/dev', path, '-o', 'ownerPerm=true']
130-
var options =
131-
{
132-
detached: true,
133-
stdio: 'inherit'
134-
}
135-
136-
spawn(EXCLFS_BIN, argv, options)
137-
.on('error', console.error.bind(console))
138-
.unref()
139-
140-
waitUntilDevMounted(path, 5, function(error)
141-
{
142-
if(error) return callback(error)
121+
spawn('exclfs', argv, options)
122+
.on('error', console.error.bind(console))
123+
.unref()
143124

144-
// Remove ExclFS from initramfs to free memory
145-
rimraf(EXCLFS_BIN)
146-
rimraf('/lib/node_modules/exclfs')
125+
waitUntilDevMounted(path, 5, function(error)
126+
{
127+
if(error) return callback(error)
147128

148-
async.each(arr, mkdirMountInfo, callback)
149-
})
129+
async.each(arr, mkdirMountInfo, callback)
150130
})
151131
})
152132
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"homepage": "https://github.com/NodeOS/nodeos-mount-filesystems",
2323
"dependencies": {
2424
"async": "^2.1.4",
25+
"exclfs": "^0.0.5",
2526
"linux-cmdline": "^1.0.0",
2627
"mkdirp": "^0.5.1",
2728
"nodeos-boot-singleUser": "^0.4.2",

0 commit comments

Comments
 (0)