mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
make.sh: Don't try to create a time NS on older kernels
This is not supported on kernels < 5.6. Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
18
make.sh
18
make.sh
@@ -54,9 +54,19 @@ ARCHES=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
HOST_ARCH="${HOSTTYPE}"
|
HOST_ARCH="${HOSTTYPE}"
|
||||||
|
HOST_KERNEL="$(uname -r)"
|
||||||
LC_ALL=POSIX
|
LC_ALL=POSIX
|
||||||
PS1='\u:\w$ '
|
PS1='\u:\w$ '
|
||||||
|
|
||||||
|
HAS_TIME_NAMESPACE="true"
|
||||||
|
|
||||||
|
# Disable time namespaces for older kernels
|
||||||
|
case "${HOST_KERNEL}" in
|
||||||
|
4.*|5.[12345].*)
|
||||||
|
HAS_TIME_NAMESPACE="false"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Are we reading from/writing to a terminal?
|
# Are we reading from/writing to a terminal?
|
||||||
is_terminal() {
|
is_terminal() {
|
||||||
[ -t 0 ] && [ -t 1 ] && [ -t 2 ]
|
[ -t 0 ] && [ -t 1 ] && [ -t 2 ]
|
||||||
@@ -674,9 +684,6 @@ execute() {
|
|||||||
"--pid"
|
"--pid"
|
||||||
"--fork"
|
"--fork"
|
||||||
|
|
||||||
# Create a new time namespace
|
|
||||||
"--time"
|
|
||||||
|
|
||||||
# Create a new UTS namespace
|
# Create a new UTS namespace
|
||||||
"--uts"
|
"--uts"
|
||||||
|
|
||||||
@@ -687,6 +694,11 @@ execute() {
|
|||||||
# If unshare is asked to terminate, terminate all child processes
|
# If unshare is asked to terminate, terminate all child processes
|
||||||
"--kill-child"
|
"--kill-child"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Optionally set up a new time namespace
|
||||||
|
if [ "${HAS_TIME_NAMESPACE}" = "true" ]; then
|
||||||
|
unshare+=( "--time" )
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
|
|||||||
Reference in New Issue
Block a user