selftests/powerpc: Use date instead of EPOCHSECONDS in mitigation-patching.sh

The EPOCHSECONDS environment variable was added in bash 5.0 (released
2019).  Some distributions of the "stable" and "long-term" variety ship
older versions of bash than this, so swap to using the date command
instead.

"%s" was added to coreutils `date` in 1993 so we should be good, but who
knows, it is a GNU extension and not part of the POSIX spec for `date`.

Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211025102436.19177-1-ruscur@russell.cc
This commit is contained in:
Russell Currey 2021-10-25 20:24:36 +10:00 коммит произвёл Michael Ellerman
Родитель 4a5cb51f3d
Коммит cb662608e5
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -13,7 +13,7 @@ function do_one
orig=$(cat "$mitigation")
start=$EPOCHSECONDS
start=$(date +%s)
now=$start
while [[ $((now-start)) -lt "$TIMEOUT" ]]
@ -21,7 +21,7 @@ function do_one
echo 0 > "$mitigation"
echo 1 > "$mitigation"
now=$EPOCHSECONDS
now=$(date +%s)
done
echo "$orig" > "$mitigation"