Skip to content

Commit

Permalink
Fixes #17770 - Preserve timestamps for collected files.
Browse files Browse the repository at this point in the history
Uses `touch -r` to use the source file/dir as a reference and
replicate timestamps over to the file collected inside
foreman-debug archive.
  • Loading branch information
gnurag authored and lzap committed Apr 20, 2017
1 parent f881e95 commit c0e6e3d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions script/foreman-debug
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,20 @@ add_file() {
case $MIME in
application/x-gzip)
zcat "$FILE" | sed -r "$FILTER" > "$DIR$FILE.txt"
touch -c -r "$FILE" "$DIR$FILE.txt"
;;
application/x-bzip2)
bzcat "$FILE" | sed -r "$FILTER" > "$DIR$FILE.txt"
touch -c -r "$FILE" "$DIR$FILE.txt"
;;
application/x-xz)
xzcat "$FILE" | sed -r "$FILTER" > "$DIR$FILE.txt"
touch -c -r "$FILE" "$DIR$FILE.txt"
;;
text/plain | application/xml)
sed -r "$FILTER" "$FILE" > "$DIR$FILE"
[ $PRINTPASS -eq 1 ] && grep -H "+FILTERED+" "$DIR$FILE"
touch -c -r "$FILE" "$DIR$FILE"
;;
*)
echo "Skipping file $FILE: unknown MIME type $MIME" >> "$DIR/skipped_files"
Expand Down Expand Up @@ -125,6 +129,7 @@ add_files() {
add_file $FILE
SUMSIZE=$(($((SUMSIZE))+$((SIZE))))
fi
touch -c -r "$SUBDIR" "$DIR$SUBDIR"
done
}

Expand Down

0 comments on commit c0e6e3d

Please sign in to comment.