I use /etc/profile.local to set bash global function and bash global env var.
My file “system_common_function” is sourced in /etc/profile.local to set global function.
My file “system_common_general_env_var” is sourced in /etc/profile.local to set global variables.
1°) Environment variables from my file system_common_general_env_var
Example with a variable named ‘MY_LIGHT_PURPLE’
user_install@15-5-G731GV:~> echo $MY_LIGHT_PURPLE
Print in light purple : “user_install@15-5-G731GV:~>”
`user_install@15-5-G731GV:~> echo $NOCOLOR
Print in white/black : “user_install@15-5-G731GV:~>”
This is correct.
But from journalctl :
juil. 27 16:49:40 15-5-G731GV startplasma-x11[2616]: org.kde.plasma.libkworkspace: Skipping syncing of environment variable "MY_LIGHT_PURPLE" as value contains unsupported characters
2°) User does not get any of my bash function available :
Example with my function “get_uuid_of_swap” defined in system_common_function
++++++++++++++++++++++++++++++++++++++++++++
get_uuid_of_swap
++++++++++++++++++++++++++++++++++++++++++++
function get_uuid_of_swap () {
local L_FLAG
L_FLAG=$(lsblk -o uuid,mountpoint | grep -w 'SWAP' | cut -d' ' -f1)
if [[ -n "$L_FLAG" ]] ; then
echo "$L_FLAG"
return 0
fi
return "$E_NOT_CONFIGURED"
}
export -f get_uuid_of_swap
user_install@15-5-G731GV:~> get_uuid_of_swap
If 'get_uuid_of_swap' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf get_uuid_of_swap
user_install@15-5-G731GV:~>
This is not expected.
But journalctl show :
juil. 27 16:49:40 15-5-G731GV startplasma-x11[2616]: org.kde.plasma.libkworkspace: Skipping syncing of environment variable “BASH_FUNC_get_uuid_of_swap%%” as name contains unsupported characters
I use this method for very very long times, and it was working at least up to 15.4
Locale is set like that :
user_install@15-5-G731GV:~> locale
LANG=en_US.UTF-8
LC_CTYPE=“en_US.UTF-8”
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE=“en_US.UTF-8”
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES=“en_US.UTF-8”
LC_PAPER=“en_US.UTF-8”
LC_NAME=“en_US.UTF-8”
LC_ADDRESS=“en_US.UTF-8”
LC_TELEPHONE=“en_US.UTF-8”
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION=“en_US.UTF-8”
LC_ALL=
Journalctl when entering /etc/profile.local up to exiting from /etc/profile.local
juil. 27 16:49:39 15-5-G731GV systemd[2603]: Started D-Bus User Message Bus.
juil. 27 16:49:39 15-5-G731GV JCD_ETC_PROFILE_LOCAL[2661]: hBc - /etc/profile.local --- -*-µ-*-µ- BEGIN -*-µ-*-µ-
juil. 27 16:49:39 15-5-G731GV JCD_ETC_PROFILE_LOCAL[2666]: hBc - /etc/profile.local --- [id] uid=1000(user_install) gid=100(users) groups=100(users) -- USER [id -nu] : user_install -- $USER : user_install -- PROFILE_LOG_USER : user_install
juil. 27 16:49:39 15-5-G731GV JCD_ETC_PROFILE_LOCAL[2671]: hBc - /etc/profile.local --- RUNNING REAL MACHINE
juil. 27 16:49:39 15-5-G731GV JCD_ETC_PROFILE_LOCAL[2672]: hBc - /etc/profile.local --- NON-INTERACTIVE
juil. 27 16:49:39 15-5-G731GV JCD_ETC_PROFILE_LOCAL[2674]: hBc - /etc/profile.local --- BACKUP_SYS_SCRIPT_PATH : /backup_sys/000_COMMON
juil. 27 16:49:39 15-5-G731GV JCD_ETC_PROFILE_LOCAL[2677]: hBc - /etc/profile.local --- SOURCING : /backup_sys/000_COMMON/Bin/system_common_function
juil. 27 16:49:39 15-5-G731GV JCD_SYSTEM_COMMON_FUNC[2680]: /backup_sys/000_COMMON/Bin/system_common_function - ^^^ BEGIN ^^^ - USER : user_install
juil. 27 16:49:39 15-5-G731GV JCD_SYSTEM_COMMON_FUNC[2681]: /backup_sys/000_COMMON/Bin/system_common_function - SYSTEM_COMMON_FUNCTION_EXPORT : 1
juil. 27 16:49:39 15-5-G731GV JCD_SYSTEM_COMMON_FUNC[2684]: /backup_sys/000_COMMON/Bin/system_common_function - ^^^ END ^^^ - USER : user_install
juil. 27 16:49:39 15-5-G731GV JCD_ETC_PROFILE_LOCAL[2689]: hBc - /etc/profile.local --- NB system_common_function : 92
juil. 27 16:49:39 15-5-G731GV JCD_ETC_PROFILE_LOCAL[2691]: hBc - /etc/profile.local --- SOURCING : /backup_sys/000_COMMON/Bin/system_common_general_env_var
juil. 27 16:49:39 15-5-G731GV JCD_SYSTEM_COMMON_GEN_ENV[2694]: /backup_sys/000_COMMON/Bin/system_common_general_env_var - BEGIN - USER : user_install
juil. 27 16:49:40 15-5-G731GV JCD_SYSTEM_COMMON_GEN_ENV[2756]: /backup_sys/000_COMMON/Bin/system_common_general_env_var - SYSTEM_COMMON_GENERAL_ENV_VAR_EXPORT : 1
juil. 27 16:49:40 15-5-G731GV JCD_SYSTEM_COMMON_GEN_ENV[2759]: /backup_sys/000_COMMON/Bin/system_common_general_env_var - END - USER : user_install
juil. 27 16:49:40 15-5-G731GV JCD_ETC_PROFILE_LOCAL[2760]: hBc - /etc/profile.local --- -*-µ-*-µ- END -*-µ-*-µ-
juil. 27 16:49:40 15-5-G731GV startplasma-x11[2616]: org.kde.plasma.libkworkspace: Skipping syncing of environment variable "BASH_FUNC_abort_because_test%%" as name contains unsupported characters
juil. 27 16:49:40 15-5-G731GV startplasma-x11[2616]: org.kde.plasma.libkworkspace: Skipping syncing of environment variable "BASH_FUNC_abort_because_test_no_trap%%" as name contains unsupported characters
juil. 27 16:49:40 15-5-G731GV startplasma-x11[2616]: org.kde.plasma.libkworkspace: Skipping syncing of environment variable "BASH_FUNC_abort_by_user%%" as name contains unsupported characters
juil. 27 16:49:40 15-5-G731GV startplasma-x11[2616]: org.kde.plasma.libkworkspace: Skipping syncing of environment variable "BASH_FUNC_activate_all_repo_but_source_debug%%" as name contains unsupported characters
juil. 27 16:49:40 15-5-G731GV startplasma-x11[2616]: org.kde.plasma.libkworkspace: Skipping syncing of environment variable "BASH_FUNC_array_contains_element%%" as name contains unsupported characters
juil. 27 16:49:40 15-5-G731GV startplasma-x11[2616]: org.kde.plasma.libkworkspace: Skipping syncing of environment variable "BASH_FUNC_array_to_file%%" as name contains unsupported characters
juil. 27 16:49:40 15-5-G731GV startplasma-x11[2616]: org.kde.plasma.libkworkspace: Skipping syncing of environment variable "BASH_FUNC_ask_YyNn%%" as name contains unsupported characters
Any help is welcome