Skip to content

Commit

Permalink
handle save_y2logs when content modified when creating tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Mar 8, 2021
1 parent 4c985bb commit 08a662f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/save_y2logs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,14 @@ echo "Saving YaST logs to $TARGET" >&2

[ -n "$COMPRESSION" ] && COMPRESSION="--$COMPRESSION"

tar cf "$TARGET" $COMPRESSION --dereference -C / $LIST -C /var/log $LIST_VAR -C $TMPDIR $LIST_TMP
tar cf "$TARGET" --warning=no-file-changed $COMPRESSION --dereference -C / $LIST -C /var/log $LIST_VAR -C $TMPDIR $LIST_TMP
err=$?

rm -rf $TMPDIR

# tar returns 1 when content of tarball is older then current system. Happen when something still writting to logs or memsampler (bsc#1182710#c2)
[ $err == 1 ] && echo "Warning: logs modified during save. Yast is probably running. Content of tarball can be older then current content." >&2 && err=0

[ $err != 0 ] && echo "FATAL: Error creating archive $TARGET" >&2

exit $err

0 comments on commit 08a662f

Please sign in to comment.