olsrd: find_most_recent_plugin_libary() fix sorting

This commit is contained in:
Bastian Bittorf 2017-02-24 15:12:19 +01:00
parent 2430426c62
commit 2a5a5e1837
1 changed files with 3 additions and 2 deletions

View File

@ -473,16 +473,17 @@ olsrd_write_hna6() {
find_most_recent_plugin_libary() find_most_recent_plugin_libary()
{ {
local library="$1" # e.g. 'olsrd_dyn_gw' or 'olsrd_txtinfo.so.1.1' local library="$1" # e.g. 'olsrd_dyn_gw' or 'olsrd_txtinfo.so.1.1'
local file unixtime local file file_fullpath unixtime
for file in "/lib/$library"* "/usr/lib/$library"* "/usr/local/lib/$library"*; do { for file in "/lib/$library"* "/usr/lib/$library"* "/usr/local/lib/$library"*; do {
[ -f "$file" ] && { [ -f "$file" ] && {
file_fullpath="$file"
file="$( basename "$file" )" file="$( basename "$file" )"
# make sure that we do not select # make sure that we do not select
# 'olsrd_dyn_gw_plain.so.0.4' if user wants # 'olsrd_dyn_gw_plain.so.0.4' if user wants
# 'olsrd_dyn_gw.so.0.5' -> compare part before 1st dot # 'olsrd_dyn_gw.so.0.5' -> compare part before 1st dot
[ "${library%%.*}" = "${file%%.*}" ] && { [ "${library%%.*}" = "${file%%.*}" ] && {
unixtime="$( date +%s -r "$file" )" unixtime="$( date +%s -r "$file_fullpath" )"
echo "$unixtime $file" echo "$unixtime $file"
} }
} }