init: scripts can now use #!
This commit is contained in:
parent
440c89efaf
commit
3370b35811
1
build.sh
1
build.sh
@ -64,6 +64,7 @@ pack_initrd() {
|
|||||||
cp ${build_dir}/red ${root_dir}/bin/red
|
cp ${build_dir}/red ${root_dir}/bin/red
|
||||||
|
|
||||||
cp -r ${workspace_dir}/etc ${root_dir}/
|
cp -r ${workspace_dir}/etc ${root_dir}/
|
||||||
|
chmod +x ${root_dir}/etc/rc.d/*
|
||||||
|
|
||||||
cd "${root_dir}"
|
cd "${root_dir}"
|
||||||
mkdir -p dev
|
mkdir -p dev
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
init:1:wait:/sbin/rc default
|
init:1:wait:/sbin/rc default
|
||||||
|
|
||||||
user:1:once:/sbin/login /dev/ttyS0
|
user:1:once:/sbin/login /dev/tty0
|
||||||
|
2
etc/rc.d/00-mount
Normal file → Executable file
2
etc/rc.d/00-mount
Normal file → Executable file
@ -1,2 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
/sbin/mount -t devfs /dev
|
/sbin/mount -t devfs /dev
|
||||||
/sbin/mount -t sysfs /sys
|
/sbin/mount -t sysfs /sys
|
||||||
|
0
etc/rc.d/99-motd
Normal file → Executable file
0
etc/rc.d/99-motd
Normal file → Executable file
@ -42,7 +42,7 @@ fn exec_script<P: AsRef<Path>>(path: P, arg: &str) -> Result<(), Error> {
|
|||||||
|
|
||||||
// TODO run those in parallel, if allowed
|
// TODO run those in parallel, if allowed
|
||||||
// TODO binfmt guessing
|
// TODO binfmt guessing
|
||||||
let mut process = Command::new("/bin/sh").arg(path).arg(arg).spawn()?;
|
let mut process = Command::new(path).arg(arg).spawn()?;
|
||||||
|
|
||||||
if !process.wait()?.success() {
|
if !process.wait()?.success() {
|
||||||
eprintln!("{:?}: Failed", path);
|
eprintln!("{:?}: Failed", path);
|
||||||
|
@ -141,6 +141,10 @@ fn run(mut input: Input, vars: &mut HashMap<String, String>) -> io::Result<ExitC
|
|||||||
}
|
}
|
||||||
|
|
||||||
let line = line.trim();
|
let line = line.trim();
|
||||||
|
let line = match line.split_once('#') {
|
||||||
|
Some((line, _)) => line.trim(),
|
||||||
|
None => line
|
||||||
|
};
|
||||||
let cmd = parser::parse_line(vars, line).unwrap();
|
let cmd = parser::parse_line(vars, line).unwrap();
|
||||||
|
|
||||||
match exec(input.is_interactive(), &cmd, vars) {
|
match exec(input.is_interactive(), &cmd, vars) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user