Hi Kairui, On 05/06/19 at 03:17pm, Kairui Song wrote:
Previously only the symlink's timestamp is used for checking if file are modified, this will not trigger a rebuild if the symlink target it modified.
So check both symlink timestamp and symlink target timestamp, rebuild the initramfs on both symlink changed and target changed.
Do we have to check both symlink and the target file? I can not think of why we need check the timestamp of the symlink. If useless then we just check the target file then the code will be simpler.
Signed-off-by: Kairui Song kasong@redhat.com
kdumpctl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 3f80ba4..3f36903 100755 --- a/kdumpctl +++ b/kdumpctl @@ -338,11 +338,19 @@ check_files_modified() [ $? -ne 0 ] && return 2
for file in $files; do
time_stamp=`stat -c "%Y" $file`
if [ "$time_stamp" -gt "$image_time" ]; then
modified_files="$modified_files $file"
fi
while [ -e "$file" ]; do
time_stamp=`stat -c "%Y" $file`
if [ "$time_stamp" -gt "$image_time" ]; then
modified_files="$modified_files $file"
fi
if [ -L "$file" ]; then
file=$(readlink -m $file)
else
break
fi
donedone
- if [ -n "$modified_files" ]; then echo "Detected change(s) in the following file(s):" echo -n " "; echo "$modified_files" | sed 's/\s/\n /g'
-- 2.20.1