diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-05-31 12:31:59 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-05-31 12:31:59 +0300 |
commit | 2878881412e0f73c5f98ca4fe728ba8deca9087f (patch) | |
tree | 9045a24c5e378d8d1cae048b7114e818853f9467 | |
parent | 329677cc4c971308b4bdea2736f9c0c834f70b1b (diff) | |
download | beam-2878881412e0f73c5f98ca4fe728ba8deca9087f.tar.gz beam-2878881412e0f73c5f98ca4fe728ba8deca9087f.tar.bz2 |
Improve mountpoint detection in s3.
* lib/beam/s3.sh (s3_getmpoint): Some kernels print device name
instead of the actual mount file.
(s3_unmount): Honor dry_run.
-rw-r--r-- | lib/beam/s3.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/beam/s3.sh b/lib/beam/s3.sh index 5f7235c..b365a54 100644 --- a/lib/beam/s3.sh +++ b/lib/beam/s3.sh @@ -69,7 +69,12 @@ s3_getmpoint() mount -tfuse.s3backer | awk '/https?:\/\/'$backup_bucket_name'/ { print $3 }';; s3) - mount | grep "^${backup_mp_s3backer}/file" | awk '{ print $3 }';; + s=$(mount | grep "^${backup_mp_s3backer}/file" | awk '{ print $3 }') + if [ -z "$s" ]; then + # Some kernels print device name instead of the actual mount file: + s=$(mount | grep "^/dev/loop[0-9] on ${backup_mp_s3}" | awk '{ print $3 }') + fi + echo $s;; *) abent 1 "invalid usage of getmpoint" esac @@ -80,6 +85,6 @@ s3_unmount() for id in s3 backer do mpoint=$(s3_getmpoint $id) - test -n "$mpoint" && umount $mpoint + test -n "$mpoint" && $dry_run umount $mpoint done } |