2021-07-05 06:50:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
r_log "archive" "Test bzip/bzcat/bunzip"
|
|
|
|
FILE=/var/tmp/bziptest.txt
|
2023-11-14 00:14:57 +00:00
|
|
|
trap '/bin/rm -f ${FILE}' EXIT
|
2021-07-05 06:50:25 +00:00
|
|
|
|
|
|
|
cat > "$FILE" <<EOF
|
|
|
|
testing text
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# bzip it up
|
|
|
|
/bin/bzip2 "$FILE"
|
|
|
|
/bin/rm -f "$FILE"
|
|
|
|
|
|
|
|
# Checking bzcat
|
|
|
|
if ! bzcat "${FILE}.bz2" | grep -q "testing text"; then
|
|
|
|
r_log "archive" "bzcat has failed"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# bunzip it down
|
|
|
|
/bin/bunzip2 "${FILE}.bz2"
|
|
|
|
|
|
|
|
# check file contents again
|
|
|
|
grep -q 'testing text' "${FILE}"
|
|
|
|
|
|
|
|
r_checkExitStatus $?
|