Вызовы ostree во время работы COSA

This commit is contained in:
Андрей Соколов 2021-06-29 21:43:20 +03:00
parent 5dc0dc60d2
commit 5ad0f93906

338
ostree_in_cosa.md Normal file
View File

@ -0,0 +1,338 @@
# Вызовы ostree во время работы COSA
Создание репозитория
```
[keremet@mycomp tmp]$ ostree init --repo=repo --mode=archive
[keremet@mycomp tmp]$ tree
.
|--repo
| |--objects
| |--extensions
| |--refs
| | |--heads
| | |--mirrors
| | |--remotes
| |--config
| |--tmp
| | |--cache
| `--state
```
Заполнение каталога для коммита
```
[keremet@mycomp tmp]$ mkdir root
[keremet@mycomp tmp]$ cp /usr/bin/lspci root/
```
Создание коммита
```
[keremet@mycomp tmp]$ ostree commit --repo=repo --tree-dir=root -b sokolov1 --owner-uid 0 --owner-gid 0 --no-xattrs --no-bindings --parent=none --mode-ro-executables --timestamp '2021-06-14 16:08:54 +0200'
72e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a
[keremet@mycomp tmp]$ tree
.
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.filez
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | | |--sokolov1
| | |--mirrors
| | |--remotes
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
|--root
| |--lspci
```
Заполнение каталога для корневой файловой системы
```
[keremet@mycomp tmp]$ mkdir rootfs
[keremet@mycomp tmp]$ ostree admin init-fs --modern rootfs
[keremet@mycomp tmp]$ tree
.
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.filez
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | | |--sokolov1
| | |--mirrors
| | |--remotes
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
|--root
| |--lspci
`--rootfs
|--boot
`--ostree
|--repo
| |--objects
| |--extensions
| |--refs
| | |--heads
| | |--mirrors
| | |--remotes
| |--config
| |--tmp
| | |--cache
| `--state
`--deploy
[keremet@mycomp tmp]$ sudo ostree pull-local --repo rootfs/ostree/repo repo 72e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a
[sudo] password for keremet:
0 metadata, 1 content objects imported; 93,5 кБ content written
[keremet@mycomp tmp]$ tree
.
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.filez
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | | |--sokolov1
| | |--mirrors
| | |--remotes
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
|--root
| |--lspci
`--rootfs
|--boot
`--ostree
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.file
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | |--mirrors
| | |--remotes
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
`--deploy
[keremet@mycomp tmp]$ ostree refs --repo rootfs/ostree/repo --create fedora:fedora/x86_64/coreos/stable 72e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a
[keremet@mycomp tmp]$ tree
.
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.filez
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | | |--sokolov1
| | |--mirrors
| | |--remotes
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
|--root
| |--lspci
`--rootfs
|--boot
`--ostree
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.file
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | |--mirrors
| | |--remotes
| | | |--fedora
| | | | |--fedora
| | | | | |--x86_64
| | | | | | |--coreos
| | | | | | | `--stable
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
`--deploy
[keremet@mycomp tmp]$ ostree admin os-init fedora-coreos --sysroot rootfs
ostree/deploy/fedora-coreos initialized as OSTree root
[keremet@mycomp tmp]$ tree
.
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.filez
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | | |--sokolov1
| | |--mirrors
| | |--remotes
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
|--root
| |--lspci
`--rootfs
|--boot
`--ostree
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.file
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | |--mirrors
| | |--remotes
| | | |--fedora
| | | | |--fedora
| | | | | |--x86_64
| | | | | | |--coreos
| | | | | | | `--stable
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
`--deploy
|--fedora-coreos
| |--var
| | |--log
| | |--lib
| | |--tmp
| | |--run -> ../run
| | `--lock -> ../run/lock
[keremet@mycomp tmp]$ sudo ostree admin deploy fedora:fedora/x86_64/coreos/stable --sysroot rootfs --os fedora-coreos --karg-append=mitigations=auto,nosmt --karg-append=console=tty0 --karg-append=console=ttyS0,115200n8 --karg-append=ignition.platform.id=metal '--karg-append=$ignition_firstboot'
[keremet@mycomp tmp]$ tree
.
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.filez
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | | |--sokolov1
| | |--mirrors
| | |--remotes
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
|--root
| |--lspci
`--rootfs
|--boot
`--ostree
|--repo
| |--objects
| | |--8b
| | | `--fa49119003fbe33d8801602f0d7a0ea77221246cabf094f03d18396ff84f26.dirtree
| | |--5c
| | | |--b483a29cd579f45a17b95334b7b3f96b7dff025283e219ba81a9bdede8d9c2.file
| | |--44
| | | |--6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta
| | |--72
| | | |--e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.commit
| |--extensions
| |--refs
| | |--heads
| | |--mirrors
| | |--remotes
| | | |--fedora
| | | | |--fedora
| | | | | |--x86_64
| | | | | | |--coreos
| | | | | | | `--stable
| |--config
| |--tmp
| | |--cache
| |--.lock
| `--state
`--deploy
|--fedora-coreos
| |--var
| | |--log
| | |--lib
| | |--tmp
| | |--run -> ../run
| | `--lock -> ../run/lock
| `--deploy
| |--72e360a09f377e1dc317d9ed29a112f2b5a22d3af12d365916661984c3dae98a.0
| | |--lspci
```