Skip to content

Instantly share code, notes, and snippets.

@klutchell
Last active November 18, 2021 20:59
Show Gist options
  • Save klutchell/2b2d8fabf6820c27e9b8d85458820952 to your computer and use it in GitHub Desktop.
Save klutchell/2b2d8fabf6820c27e9b8d85458820952 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -eux
cleanup() {
sudo umount /mnt/flasher
sudo losetup -d "${loopback_device:-}"
}
trap cleanup EXIT
sudo mkdir -p /mnt/flasher
loopback_device=$(sudo losetup -fP --show "${1}")
sudo mount "${loopback_device}p2" /mnt/flasher
cp -v /mnt/flasher/opt/*.balenaos-img .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment