From 3281a3d1c357d9d36e85df0e9d80289ed45659d6 Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 20 Nov 2013 10:37:03 +0800 Subject: [PATCH] fix for bug 4404, systemctl import-environment does not work on RHEL 7, should use systemctl set-environment --- xCAT-server/sbin/xcatconfig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index b504063cd..57b03ec70 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -408,12 +408,16 @@ if ($::INITIALINSTALL || $::FORCE || $::UPDATEINSTALL) # TERM is needed for KVM consoles(actually screen command needs TERM) # import the TERM into systemd if ( -d "/usr/lib/systemd/system" ) { - my $cmd = "systemctl import-environment TERM"; + my $term=$ENV{'TERM'}; + if (!$term) { + $term = "vt100"; + } + my $cmd = "systemctl set-environment TERM=$term"; xCAT::Utils->runcmd("$cmd", 0); if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->message('E', "Could not import TERM into systemd."); + xCAT::MsgUtils->message('E', "Could not set TERM into systemd."); } else { - verbose("Imported TERM=$ENV{'TERM'} into systemd."); + verbose("Imported TERM=$term into systemd."); } }