mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Fix to always prioritize module config over hardcoded shell flavors
This commit is contained in:
@@ -124,17 +124,6 @@ if ($shinit) {
|
||||
}
|
||||
}
|
||||
|
||||
# User config environmental variables
|
||||
if ($config{'flavors_envs'}) {
|
||||
# Admin added to the module config custom
|
||||
# environmental variables, load them now
|
||||
my @flavors_envs = split(/\t+/, $config{'flavors_envs'});
|
||||
foreach my $flavors_env (@flavors_envs) {
|
||||
my ($k, $v) = split(/=/, $flavors_env, 2);
|
||||
$ENV{$k} = $v;
|
||||
}
|
||||
}
|
||||
|
||||
# Add additional shell envs from internal
|
||||
# shell flavors if defined for the
|
||||
# current user shell
|
||||
@@ -148,6 +137,18 @@ if ($shinit && $shinit->{'envs'}) {
|
||||
}
|
||||
}
|
||||
|
||||
# User defined environmental variables
|
||||
# (in module config) to set
|
||||
if ($config{'flavors_envs'}) {
|
||||
# Admin added to the module config custom
|
||||
# environmental variables, load them now
|
||||
my @flavors_envs = split(/\t+/, $config{'flavors_envs'});
|
||||
foreach my $flavors_env (@flavors_envs) {
|
||||
my ($k, $v) = split(/=/, $flavors_env, 2);
|
||||
$ENV{$k} = $v;
|
||||
}
|
||||
}
|
||||
|
||||
# Set terminal
|
||||
$ENV{'TERM'} = 'xterm-256color';
|
||||
$ENV{'HOME'} = $uinfo[7];
|
||||
@@ -163,17 +164,6 @@ if (!$pid) {
|
||||
}
|
||||
print STDERR "shell process is $pid\n";
|
||||
|
||||
# User config commands to run on shell login
|
||||
if ($config{'flavors_cmds'}) {
|
||||
# Admin added to the module config custom
|
||||
# commands to run on shell login, run now
|
||||
my @flavors_cmds = split(/\t+/, $config{'flavors_cmds'});
|
||||
foreach my $flavors_cmd (@flavors_cmds) {
|
||||
my $cmd = " $flavors_cmd\r";
|
||||
syswrite($shellfh, $cmd, length($cmd));
|
||||
}
|
||||
}
|
||||
|
||||
# Run additional shell commands from internal
|
||||
# shell flavors, if defined for the current
|
||||
# user shell to run after initial login
|
||||
@@ -188,6 +178,18 @@ if ($shinit && $shinit->{'cmds'}) {
|
||||
}
|
||||
}
|
||||
|
||||
# User defined commands (in module
|
||||
# config) to run on shell login
|
||||
if ($config{'flavors_cmds'}) {
|
||||
# Admin added to the module config custom
|
||||
# commands to run on shell login, run now
|
||||
my @flavors_cmds = split(/\t+/, $config{'flavors_cmds'});
|
||||
foreach my $flavors_cmd (@flavors_cmds) {
|
||||
my $cmd = " $flavors_cmd\r";
|
||||
syswrite($shellfh, $cmd, length($cmd));
|
||||
}
|
||||
}
|
||||
|
||||
# Detach from controlling terminal
|
||||
if (fork()) {
|
||||
exit(0);
|
||||
|
||||
Reference in New Issue
Block a user