kdumpctl: follow symlink when checking for modified files
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. Also give a proper error message if the file doesn't exist. Signed-off-by: Kairui Song <kasong@redhat.com> Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
parent
75d9132417
commit
30913fd667
12
kdumpctl
12
kdumpctl
@ -347,11 +347,23 @@ check_files_modified()
|
|||||||
[ $? -ne 0 ] && return 2
|
[ $? -ne 0 ] && return 2
|
||||||
|
|
||||||
for file in $files; do
|
for file in $files; do
|
||||||
|
if [ -e "$file" ]; then
|
||||||
time_stamp=`stat -c "%Y" $file`
|
time_stamp=`stat -c "%Y" $file`
|
||||||
if [ "$time_stamp" -gt "$image_time" ]; then
|
if [ "$time_stamp" -gt "$image_time" ]; then
|
||||||
modified_files="$modified_files $file"
|
modified_files="$modified_files $file"
|
||||||
fi
|
fi
|
||||||
|
if [ -L "$file" ]; then
|
||||||
|
file=$(readlink -m $file)
|
||||||
|
time_stamp=`stat -c "%Y" $file`
|
||||||
|
if [ "$time_stamp" -gt "$image_time" ]; then
|
||||||
|
modified_files="$modified_files $file"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "$file doesn't exist"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$modified_files" ]; then
|
if [ -n "$modified_files" ]; then
|
||||||
echo "Detected change(s) in the following file(s):"
|
echo "Detected change(s) in the following file(s):"
|
||||||
echo -n " "; echo "$modified_files" | sed 's/\s/\n /g'
|
echo -n " "; echo "$modified_files" | sed 's/\s/\n /g'
|
||||||
|
Loading…
Reference in New Issue
Block a user