Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Peter Kowalsky
redox
Commits
cda17ce4
Commit
cda17ce4
authored
Jan 05, 2017
by
Jeremy Soller
Browse files
Update init to handle directories
parent
e3f3f27f
Changes
8
Hide whitespace changes
Inline
Side-by-side
filesystem/etc/init.d/00_base
0 → 100644
View file @
cda17ce4
/sbin/randd
/sbin/ptyd
/sbin/pcid /etc/pcid.toml
filesystem/etc/init.d/10_net
0 → 100644
View file @
cda17ce4
/sbin/ethernetd
/sbin/ipd
/sbin/tcpd
/sbin/udpd
dhcpd -b
filesystem/etc/init.d/20_console
0 → 100644
View file @
cda17ce4
getty display:2
getty display:3
filesystem/etc/init.
rc
→
filesystem/etc/init.
d/30_orbital
View file @
cda17ce4
/sbin/randd
/sbin/ptyd
/sbin/pcid /etc/pcid.toml
/sbin/ethernetd
/sbin/ipd
/sbin/tcpd
/sbin/udpd
dhcpd -b
getty display:2
getty display:3
/sbin/orbital display:4/activate /ui/bin/orblogin /ui/bin/launcher
getty debug: -J
filesystem/etc/init.d/40_serial
0 → 100644
View file @
cda17ce4
getty debug: -J
initfs/etc/init.rc
View file @
cda17ce4
...
...
@@ -6,4 +6,4 @@ pcid /etc/pcid.toml
redoxfs disk:0 file
cd file:
export PATH file:/bin
run /etc/init.
rc
run
.d
/etc/init.
d
libc-artifacts
@
a3b7f7af
Compare
67098b38
...
a3b7f7af
Subproject commit
67098b38c671d7804c3b9b7b856090099d4cecda
Subproject commit
a3b7f7af5e2695c309eb5d87158deb50cbbab2a6
programs/init/src/main.rs
View file @
cda17ce4
extern
crate
syscall
;
use
std
::
env
;
use
std
::
fs
::
File
;
use
std
::
fs
::
{
File
,
read_dir
}
;
use
std
::
io
::{
BufRead
,
BufReader
,
Result
};
use
std
::
path
::
Path
;
use
std
::
process
::
Command
;
pub
fn
run
(
file
:
&
str
)
->
Result
<
()
>
{
pub
fn
run
(
file
:
&
Path
)
->
Result
<
()
>
{
let
file
=
File
::
open
(
file
)
?
;
let
reader
=
BufReader
::
new
(
file
);
...
...
@@ -46,12 +47,42 @@ pub fn run(file: &str) -> Result<()> {
println!
(
"init: failed to export: no argument"
);
},
"run"
=>
if
let
Some
(
new_file
)
=
args
.next
()
{
if
let
Err
(
err
)
=
run
(
&
new_file
)
{
if
let
Err
(
err
)
=
run
(
&
Path
::
new
(
new_file
)
)
{
println!
(
"init: failed to run '{}': {}"
,
new_file
,
err
);
}
}
else
{
println!
(
"init: failed to run: no argument"
);
},
"run.d"
=>
if
let
Some
(
new_dir
)
=
args
.next
()
{
match
read_dir
(
new_dir
)
{
Ok
(
list
)
=>
{
let
mut
entries
=
vec!
[];
for
entry_res
in
list
{
match
entry_res
{
Ok
(
entry
)
=>
{
entries
.push
(
entry
.path
());
},
Err
(
err
)
=>
{
println!
(
"init: failed to run.d: '{}': {}"
,
new_dir
,
err
);
}
}
}
entries
.sort
();
for
entry
in
entries
{
if
let
Err
(
err
)
=
run
(
&
entry
)
{
println!
(
"init: failed to run '{}': {}"
,
entry
.display
(),
err
);
}
}
},
Err
(
err
)
=>
{
println!
(
"init: failed to run.d: '{}': {}"
,
new_dir
,
err
);
}
}
}
else
{
println!
(
"init: failed to run.d: no argument"
);
},
"stdio"
=>
if
let
Some
(
stdio
)
=
args
.next
()
{
let
_
=
syscall
::
close
(
2
);
let
_
=
syscall
::
close
(
1
);
...
...
@@ -86,7 +117,7 @@ pub fn run(file: &str) -> Result<()> {
}
pub
fn
main
()
{
if
let
Err
(
err
)
=
run
(
"initfs:etc/init.rc"
)
{
if
let
Err
(
err
)
=
run
(
&
Path
::
new
(
"initfs:etc/init.rc"
)
)
{
println!
(
"init: failed to run initfs:etc/init.rc: {}"
,
err
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment