Attach image to loopdevice in one command
Fix indentation, remove unused import
use absolute path to apt-get
Use absolute paths everywhere
Use long options wherever possible.
This makes the code a lot easier to understand