File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,7 @@ login() {
286286 local make_host_tmp_shared=true # its better to run with shared tmp
287287 local root_fs_path=" "
288288 local login_user=" root"
289+ local run_script=" "
289290 local -a custom_fs_bindings
290291 local path=$DEFAULT_FS_INSTALL_DIR
291292
@@ -376,6 +377,9 @@ login() {
376377 --no-kill-on-exit)
377378 no_kill_on_exit=true; shift
378379 ;;
380+ --run-script)
381+ run_script=$2 ; shift 2
382+ ;;
379383 -* )
380384 echo " Unknown option: $1 "
381385 exit 1
@@ -422,6 +426,20 @@ login() {
422426 for i in " $@ " ; do
423427 shell_command_args+=(" '$i '" )
424428 done
429+
430+ # run_script
431+ if [ -n " $run_script " ]; then
432+ if [ -f " $run_script " ]; then
433+ LOG " login() => run-script defined: ignoring command line arguments"
434+ chmod +x " $run_script "
435+ cp " $run_script " " ${root_fs_path} /tmp/"
436+ run_script=" /tmp/$( basename " $run_script " ) "
437+ shell_command_args=(" /tmp/$run_script " )
438+ else
439+ ELOG " ERROR: run-script '$run_script ' not found!"
440+ exit 1
441+ fi
442+ fi
425443
426444 if stat " ${root_fs_path} /bin/su" > /dev/null 2>&1 ; then
427445 set -- " /bin/su" " -l" " $login_user " " -c" " ${shell_command_args[*]} "
You can’t perform that action at this time.
0 commit comments