I tried it now on my ubuntu machine. Thsi should be enough, you don't need the ```--show``` part, it should create needless output:
```
losetup -f #{fname} && vgcreate #{volname} `losetup -j #{fname} | cut -f1 -d:
```