Skip to content

Instantly share code, notes, and snippets.

@drewmoseley
Created April 1, 2022 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewmoseley/f988eb7511be3fc00a001483b740bd09 to your computer and use it in GitHub Desktop.
Save drewmoseley/f988eb7511be3fc00a001483b740bd09 to your computer and use it in GitHub Desktop.
# ostree CLI
man ostree
ostree --help
# create ostree repo
ostree --repo=repo init
tree -a
# add a file
mkdir -p rootfs && echo Hello > rootfs/hello.txt
# commit to the repo
ostree --repo=repo commit --branch=v1 --subject="image v1" rootfs/
tree -a repo/
# inspecting the repo
cat repo/refs/heads/v1
ostree --repo=repo show --raw <COMMIT>
ostree --repo=repo show --raw <DIRTREE>
ostree --repo=repo show --raw <DIRMETA>
ostree --repo=repo show --raw <FILE>
cat repo/objects/<FILE>
# listing a commit content
ostree --repo=repo ls v1
# checkout
rm -Rf rootfs/ && ls
ostree --repo=repo checkout v1 rootfs/ && tree rootfs
# same inode!
ls -li rootfs/hello.txt
ls -li repo/objects/<FILE_HASH>
# adding a full filesystem tree
rm -rf rootfs && mkdir rootfs && cd rootfs && tar xfv ~/workspace/talks/20210525-yocto-summit/ostree/rootfs.tar && cd ..
ostree --repo=repo commit --branch=v1 --subject="image v2" rootfs/
echo test=1 > rootfs/etc/conf.txt
ostree --repo=repo commit --branch=v1 --subject="image v3" rootfs/
# history
ostree --repo=repo refs
ostree --repo=repo log v1
# comparing
ostree --repo=repo diff commit2 commit3
# talk about other commands
ostree --help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment