Config :
leap_15.2 beta
laptop asus rog strix
config script running on real system or on a virtualbox vm Version 6.1.8 r137981 (Qt5.9.7) as well.
Using NetworkManager
The script run from usb stick on a system just after fresh install.
The script begin to source two files for setting some env variables value, and acquire some particular functions.
The script is started with sudo to be able to write data in some system files.
I have a problem with a virtualbox function which must be run as the user owning the virtualbox VM.
I use this command :
GET_MAC_ADRESS_FROM_VBOX_FILE is the name of an exported function defined in a file sourced by the main running script.
‘Leap_15.2_APP_1’ is the name of the VM.
The problem arise because every things sourced at the beginning are not accessible when ‘sudo runuser -l user_install …’ execution.
A bit beside your question, why are you still running the beta release where the real version is already available for some time. I assume nobody else will now still have a test version of 15.2, Which makes discussing, in the assumption that all partners use the same thing, will be difficult.
Programs like sudo, runuser et al take the name of an executable, at most a shell command. But they can’t take a function available only to the parent process (how could they understand?). You might rewrite the command, sourcing the function again, then calling the function. Pass it as a command to bash. Or write a separate bash script. You can prepend env vars to the script command if needed.
Here a test program saying if a string is hexa or not.
The called function does nor care who is calling.
The function is defined in the file sourced at the beginning of execution as said in my question
BASH_FUNC_abort_because_test%%=() { unset A_MSG;
BASH_FUNC_activate_all_repo_but_source_debug%%=() { local L_SUSE_VER;
BASH_FUNC_array_contains_element%%=() { local e;
BASH_FUNC_array_to_file%%=() { NB_PARAM=$#;
BASH_FUNC_ask_YyNn%%=() { local L_REPLY="";
BASH_FUNC_ask_YyNn_timeout%%=() { local L_REPLY="";
BASH_FUNC_ask_YyRr%%=() { local L_REPLY="";
BASH_FUNC_ask_YyYy%%=() { local L_REPLY="";
BASH_FUNC_ask_YyYy_timeout%%=() { local L_REPLY="";
BASH_FUNC_config_at_next_reboot%%=() { local L_REPLY="";
...........................
........................
BASH_FUNC_get_subpath_front%%=() { set +x;
BASH_FUNC_get_subpath_tail%%=() { A_PATH="$1";
**BASH_FUNC_is_hexa%%=() { local -i L_RET_CODE2;**
BASH_FUNC_is_running_in_vm%%=() { local -i MY_FLAG=0;
BASH_FUNC_main_repositories_exists%%=() { local -i NB=0;
................................
...............................
BASH_FUNC_message_informal%%=() { local -a L_ARRAY;
BASH_FUNC_message_success%%=() { local -a L_ARRAY;
BASH_FUNC_message_warning%%=() { local -a L_ARRAY;
BASH_FUNC_my_bash_eval%%=() { local L_SOME_CMD="xxxxxxxxxxxxxxxxxx";
BASH_FUNC_my_bash_eval_find%%=() { local L_SOME_CMD="xxxxxxxxxxxxxxxxxx";
BASH_FUNC_my_bash_eval_rsync%%=() { local L_SOME_CMD="xxxxxxxxxxxxxxxxxx";
BASH_FUNC_my_get_salt%%=() { date --date "$1" +%s%N
BASH_FUNC_my_rename_ext%%=() { function my_rename_ext_suite1 ()
BASH_FUNC_ok_to_do_task%%=() { local -i L_RET_CODE L_RUN_NO_STOP L_TIMEOUT;
BASH_FUNC_print_array_full%%=() { local -i L_NB_ELEMENT;
BASH_FUNC_print_array_if_debug_on%%=() { local -i L_DEBUG=0;
BASH_FUNC_print_asso_array%%=() { L_ARRAY_NAME="$1";
BASH_FUNC_print_if_debug_on%%=() { local -i L_DEBUG;
BASH_FUNC_read_dummy_operator_input%%=() { local L_TEMP;
BASH_FUNC_read_dummy_operator_input_timeout%%=() { local L_TEMP;
BASH_FUNC_read_log_on_screen%%=() { local L_REPLY="";
.....................
....................
BASH_FUNC_update_param_config_file%%=() { L_DEBUG=0;
BASH_FUNC_yes_or_not%%=() { local L_REPLY="";
BASH_FUNC_yes_or_not_confirm%%=() { local -i RETURN_CODE=1;
RET_CODE=112
RET_CODE=112 is an error because ‘01234566789ABCDEF__’ is not hexa