Skip to content

Commit

Permalink
[Mellanox] Update the save_file command in generate_dump to handle fo…
Browse files Browse the repository at this point in the history
…lders (#3631)

- What I did
Support saving folders.

- How I did it
Add a check to the save_file command, if the path that was provided is to a folder, use an appropriate method.

- How to verify it
Previously when a folder was given to be saved using this function, an empty file with the folder name would be created.
  • Loading branch information
DavidZagury authored Nov 27, 2024
1 parent 5086a43 commit 3d78cb1
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -1082,18 +1082,24 @@ save_file() {
fi

if $do_gzip; then
gz_path="${gz_path}.gz"
tar_path="${tar_path}.gz"
if $NOOP; then
if [ ! -d "$path" ]; then
gz_path="${gz_path}.gz"
tar_path="${tar_path}.gz"

if $NOOP; then
echo "gzip -c $orig_path > $gz_path"
else
else
gzip -c $orig_path > $gz_path
fi
else
if $NOOP; then
echo "cp $orig_path $gz_path"
fi
else
cp $orig_path $gz_path
gz_path="${gz_path}.tar.gz"
tar_path="${tar_path}.tar.gz"

if $NOOP; then
echo "tar -czvf $gz_path -C $(dirname $orig_path) $(basename $orig_path)"
else
tar -czvf "$gz_path" -C "$(dirname "$orig_path")" "$(basename "$orig_path")"
fi
fi
fi

Expand Down

0 comments on commit 3d78cb1

Please sign in to comment.