Permalink
Browse files

FreeBSD sed needs a different syntax

  • Loading branch information...
phreaker0 committed Jan 9, 2019
1 parent 8da79dd commit c3e20fdefcd0a61976155831c6b2b23ac7aa035f
Showing with 11 additions and 7 deletions.
  1. +11 −7 tests/common/lib.sh
@@ -60,7 +60,11 @@ function saveSnapshotList {
zfs list -t snapshot -o name -Hr "${POOL_NAME}" | sort > "${RESULT}"

# clear the seconds for comparing
sed -i 's/\(autosnap_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]:[0-9][0-9]:\)[0-9][0-9]_/\100_/g' "${RESULT}"
if [ "$unamestr" == 'FreeBSD' ]; then
sed -i '' 's/\(autosnap_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]:[0-9][0-9]:\)[0-9][0-9]_/\100_/g' "${RESULT}"
else
sed -i 's/\(autosnap_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]:[0-9][0-9]:\)[0-9][0-9]_/\100_/g' "${RESULT}"
fi
}

function verifySnapshotList {
@@ -109,11 +113,11 @@ function verifySnapshotList {
}

function setdate {
TIMESTAMP="$1"
TIMESTAMP="$1"

if [ "$unamestr" == 'FreeBSD' ]; then
date -u -f '%s' "${TIMESTAMP}"
else
date --utc --set "@${TIMESTAMP}"
fi
if [ "$unamestr" == 'FreeBSD' ]; then
date -u -f '%s' "${TIMESTAMP}"
else
date --utc --set "@${TIMESTAMP}"
fi
}

0 comments on commit c3e20fd

Please sign in to comment.