Browse Source

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

Dorian Stoll 2 năm trước cách đây
mục cha
commit
45d6f32422

+ 2 - 2
pkg/fedora/kernel-surface/files/linux-surface-default-kernel.sh

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