Skip to content

Instantly share code, notes, and snippets.

@jcvenegas
Created March 5, 2018 20:29
Show Gist options
  • Save jcvenegas/ed889943a5aea3fc42d7b6c4f3bc1a45 to your computer and use it in GitHub Desktop.
Save jcvenegas/ed889943a5aea3fc42d7b6c4f3bc1a45 to your computer and use it in GitHub Desktop.
Get agent version from Clear Contaienrs
#!/bin/bash
set -e
img=""
loop=""
cleanup() {
if [ -n "$img" ];then
sudo umount /mnt || true
fi
if [ -n "$loop" ];then
sudo losetup -d ${loop} || true
fi
}
trap cleanup EXIT
img=$(cc-runtime cc-env | grep 'Path = ".*.img"' | cut -d '"' -f 2)
loop=$(sudo losetup -fP --show $img)
sudo mount ${loop}p1 /mnt/
/mnt/bin/cc-agent 2>&1 | grep '"version":'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment