FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodeos-boot-multiUser/server.js at master · javascriptit/nodeos-boot-multiUser · GitHub
javascriptit
nodeos-boot-multiUser
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodeos-boot-multiUser
/
server.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
67 lines (52 loc) · 1.59 KB
Breadcrumbs
nodeos-boot-multiUser
/
server.js
Copy path
File metadata and controls
executable file
·
67 lines (52 loc) · 1.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/env node
const
readFile
=
require
(
'fs'
)
.
readFile
const
basicEnvironment
=
require
(
'nodeos-boot-singleUser'
)
const
linuxCmdline
=
require
(
'linux-cmdline'
)
const
mountUsersFS
=
require
(
'nodeos-boot-singleUserMount'
)
const
rimraf
=
require
(
'rimraf'
)
.
sync
const
startRepl
=
require
(
'nodeos-mount-utils'
)
.
startRepl
const
prepareSessions
=
require
(
'.'
)
const
MOUNTPOINT
=
'/tmp'
/**
* This error handler traces the error and starts a Node.js REPL
*
*
@param
{
Error
} error The error that gets traced
*/
function
onerror
(
error
)
{
console
.
trace
(
error
)
startRepl
(
'NodeOS-boot-multiuser'
)
}
basicEnvironment
(
function
(
error
)
{
if
(
error
)
return
onerror
(
error
)
// Get Linux kernel command line arguments
readFile
(
'/proc/cmdline'
,
'utf8'
,
function
(
error
,
data
)
{
if
(
error
)
return
onerror
(
error
)
var
cmdline
=
linuxCmdline
(
data
)
// Mount users filesystem
mountUsersFS
(
MOUNTPOINT
,
cmdline
,
function
(
error
)
{
if
(
error
)
return
onerror
(
error
)
prepareSessions
(
MOUNTPOINT
,
cmdline
.
single
,
function
(
error
)
{
if
(
error
)
return
onerror
(
error
)
// Remove from initramfs the files only needed on boot to free memory
try
{
rimraf
(
'/bin/nodeos-boot-multiuser'
)
rimraf
(
'/init'
)
rimraf
(
'/lib/node_modules/nodeos-boot-multiuser'
)
rimraf
(
'/sbin'
)
}
catch
(
error
)
{
// If `rootfs` is read-only (like in `vagga`), ignore the error
if
(
error
.
code
!==
'EROFS'
)
return
callback
(
error
)
}
// KTHXBYE >^.^<
}
)
}
)
}
)
}
)
Back
|
FazBrowse Home
|
New Git URL