pkg: fedora: Use stat to sort by file creation time
This commit is contained in:
parent
39d0d5ec60
commit
45d6f32422
|
@ -2,13 +2,13 @@
|
|||
set -euo pipefail
|
||||
|
||||
# get list of surface kernels with timestamp
|
||||
kernels=$(find /boot -maxdepth 1 -name "vmlinuz-*.surface.*" -printf '%B@\t%p\n')
|
||||
kernels=$(find /boot -maxdepth 1 -name "vmlinuz-*.surface.*" -exec sh -c 'stat -c "%W %n" {}' \;)
|
||||
|
||||
# sort by timestamp
|
||||
kernels=$(echo "${kernels}" | sort -n)
|
||||
|
||||
# get latest kernel (last line) and extract path
|
||||
kernel=$(echo "${kernels}" | tail -n1 | cut -f2)
|
||||
kernel=$(echo "${kernels}" | tail -n1 | cut -d' ' -f2)
|
||||
|
||||
echo $kernel
|
||||
|
||||
|
|
Loading…
Reference in a new issue