2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 01:56:39 +00:00

Fix EL9 chroot detection

EL9 shows the following message:
Running in chroot, ignoring command ...

Previously this was:
Running in chroot, ignoring request ...

Truncate regex to detect both.
This commit is contained in:
Markus Hilger 2023-02-03 02:25:09 +01:00
parent 9d3c7fabf7
commit ac75c245e6

View File

@ -430,7 +430,7 @@ function startservice {
local retmsg
retmsg=`$cmd 2>&1`
retval=$?
[ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring request.*" >/dev/null 2>&1) && retval=1
[ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring .*" >/dev/null 2>&1) && retval=1
return $retval
}
@ -474,7 +474,7 @@ function stopservice {
local retmsg
retmsg=`$cmd 2>&1`
retval=$?
[ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring request.*" >/dev/null 2>&1) && retval=1
[ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring .*" >/dev/null 2>&1) && retval=1
return $retval
}
@ -522,7 +522,7 @@ function restartservice {
#In the chrooted env, the system management commands(start/stop/restart) will be ignored and the return code is 0
#need to return the proper code in the chrooted scenario
[ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring request.*" >/dev/null 2>&1) && retval=1
[ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring .*" >/dev/null 2>&1) && retval=1
return $retval
}