@@ -8,34 +8,33 @@ use crate::utils::env::find_in_path;
88const FEX_X86_BINFMT_MISC_RULE : & str = ":FEX-x86:M:0:\\ x7fELF\\ x01\\ x01\\ x01\\ x00\\ x00\\ x00\\ x00\\ \
99 x00\\ x00\\ x00\\ x00\\ x00\\ x02\\ x00\\ x03\\ x00:\\ xff\\ xff\\ \
1010 xff\\ xff\\ xff\\ xfe\\ xfe\\ x00\\ x00\\ x00\\ x00\\ xff\\ xff\\ \
11- xff\\ xff\\ xff\\ xfe\\ xff\\ xff\\ xff:${FEX_INTERPRETER }:POCF";
11+ xff\\ xff\\ xff\\ xfe\\ xff\\ xff\\ xff:${FEX }:POCF";
1212const FEX_X86_64_BINFMT_MISC_RULE : & str =
1313 ":FEX-x86_64:M:0:\\ x7fELF\\ x02\\ x01\\ x01\\ x00\\ x00\\ x00\\ x00\\ x00\\ x00\\ x00\\ x00\\ x00\\ x02\\ \
1414 x00\\ x3e\\ x00:\\ xff\\ xff\\ xff\\ xff\\ xff\\ xfe\\ xfe\\ x00\\ x00\\ x00\\ x00\\ xff\\ xff\\ xff\\ xff\\ \
15- xff\\ xfe\\ xff\\ xff\\ xff:${FEX_INTERPRETER }:POCF";
15+ xff\\ xfe\\ xff\\ xff\\ xff:${FEX }:POCF";
1616
1717pub fn setup_fex ( ) -> Result < ( ) > {
18- let fex_interpreter_path =
19- find_in_path ( "FEXInterpreter" ) . context ( "Failed to check existence of `FEXInterpreter`" ) ?;
20- let Some ( fex_interpreter_path) = fex_interpreter_path else {
21- return Err ( anyhow ! ( "Failed to find `FEXInterpreter` in PATH" ) ) ;
18+ let fex_path = find_in_path ( "FEX" ) . context ( "Failed to check existence of `FEX`" ) ?;
19+ let Some ( fex_path) = fex_path else {
20+ return Err ( anyhow ! ( "Failed to find `FEX` in PATH" ) ) ;
2221 } ;
23- let fex_interpreter_path = fex_interpreter_path
22+ let fex_path = fex_path
2423 . to_str ( )
25- . context ( "Failed to process `FEXInterpreter ` path as it contains invalid UTF-8" ) ?;
24+ . context ( "Failed to process `FEX ` path as it contains invalid UTF-8" ) ?;
2625
2726 let mut file = File :: options ( )
2827 . write ( true )
2928 . open ( "/proc/sys/fs/binfmt_misc/register" )
3029 . context ( "Failed to open binfmt_misc/register for writing" ) ?;
3130
3231 {
33- let rule = FEX_X86_BINFMT_MISC_RULE . replace ( "${FEX_INTERPRETER }" , fex_interpreter_path ) ;
32+ let rule = FEX_X86_BINFMT_MISC_RULE . replace ( "${FEX }" , fex_path ) ;
3433 file. write_all ( rule. as_bytes ( ) )
3534 . context ( "Failed to register `FEX-x86` binfmt_misc rule" ) ?;
3635 }
3736 {
38- let rule = FEX_X86_64_BINFMT_MISC_RULE . replace ( "${FEX_INTERPRETER }" , fex_interpreter_path ) ;
37+ let rule = FEX_X86_64_BINFMT_MISC_RULE . replace ( "${FEX }" , fex_path ) ;
3938 file. write_all ( rule. as_bytes ( ) )
4039 . context ( "Failed to register `FEX-x86_64` binfmt_misc rule" ) ?;
4140 }
0 commit comments