pkg: fedora: Use stat to sort by file creation time

This commit is contained in:
Dorian Stoll 2023-06-14 17:47:20 +02:00
parent 39d0d5ec60
commit 45d6f32422
No known key found for this signature in database
GPG key ID: F1DACD02C619442A

View file

@ -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