File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ const setup_boot = async (fs: AbstractFileSystem) => {
1616 }
1717
1818 // create etc directory if it doesn't exist
19- const absolute_etc = fs . absolute ( "/etc" ) ; ;
19+ const absolute_etc = fs . absolute ( "/etc" ) ;
2020 if ( ! ( await fs . dir_exists ( absolute_etc ) ) ) {
2121 await fs . make_dir ( absolute_etc ) ;
2222 }
@@ -29,7 +29,7 @@ const setup_boot = async (fs: AbstractFileSystem) => {
2929 }
3030
3131 // create default_shell file if it doesn't exist
32- const default_shell_content = "ash" ;
32+ const default_shell_content = "ash --login " ;
3333 const absolute_default_shell = fs . absolute ( "/etc/default_shell" ) ;
3434 if ( ! ( await fs . exists ( absolute_default_shell ) ) ) {
3535 await fs . write_file ( absolute_default_shell , default_shell_content ) ;
Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ export class Kernel {
163163
164164 // read /boot/init to determine init system
165165 let init_program : string ;
166+ let init_args : string [ ] = [ ] ;
166167
167168 try {
168169 const init_data = await fs . read_file ( "/boot/init" ) as string ;
@@ -177,9 +178,17 @@ export class Kernel {
177178 return false ;
178179 }
179180
181+ // separate args if any
182+ const init_parts = init_program . split ( " " ) ;
183+ init_program = init_parts [ 0 ] ;
184+
185+ if ( init_parts . length > 1 ) {
186+ init_args = init_parts . slice ( 1 ) ;
187+ }
188+
180189 // run init program
181190 try {
182- const init = this . spawn ( init_program , [ ] ) ;
191+ const init = this . spawn ( init_program , init_args ) ;
183192
184193 if ( init . process . pid !== 1 ) {
185194 this . panic ( `init program ${ init_program } did not start as PID 1!` ) ;
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ export default {
6969
7070 // determine boot target from /etc/boot_target
7171 let boot_target = "jetty" ;
72+ let boot_args : string [ ] = [ ] ;
7273
7374 try {
7475 const boot_target_data = await fs . read_file ( "/etc/boot_target" ) as string ;
@@ -87,6 +88,14 @@ export default {
8788 await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
8889 }
8990
91+ // separate args if any
92+ const boot_target_parts = boot_target . split ( " " ) ;
93+ boot_target = boot_target_parts [ 0 ] ;
94+
95+ if ( boot_target_parts . length > 1 ) {
96+ boot_args = boot_target_parts . slice ( 1 ) ;
97+ }
98+
9099 // create service manager
91100 const svc_mgr = new ServiceManager ( kernel ) ;
92101
@@ -193,7 +202,7 @@ export default {
193202
194203 // execute boot target in a respawn loop
195204 while ( running ) {
196- const boot_target_proc = kernel . spawn ( boot_target , [ ] ) ;
205+ const boot_target_proc = kernel . spawn ( boot_target , boot_args ) ;
197206 current_tty_process = boot_target_proc . process ;
198207
199208 const exit_code = await boot_target_proc . completion ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export default {
1717
1818 // determine default shell from /etc/default_shell
1919 let default_shell = "ash" ;
20+ let default_shell_args : string [ ] = [ ] ;
2021
2122 try {
2223 const default_shell_data = await fs . read_file ( "/etc/default_shell" ) as string ;
@@ -35,6 +36,14 @@ export default {
3536 await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
3637 }
3738
39+ // separate shell args if any
40+ const default_shell_parts = default_shell . split ( " " ) ;
41+ default_shell = default_shell_parts [ 0 ] ;
42+
43+ if ( default_shell_parts . length > 1 ) {
44+ default_shell_args = default_shell_parts . slice ( 1 ) ;
45+ }
46+
3847 let running = true ;
3948 let final_code = 0 ;
4049 let current_shell_process : ProcessContext ;
@@ -53,7 +62,7 @@ export default {
5362
5463 // execute shell in a respawn loop
5564 while ( running ) {
56- const shell_proc = kernel . spawn ( default_shell , [ "--login" ] ) ;
65+ const shell_proc = kernel . spawn ( default_shell , default_shell_args ) ;
5766 current_shell_process = shell_proc . process ;
5867
5968 const exit_code = await shell_proc . completion ;
You can’t perform that action at this time.
0 commit comments