Skip to content
Snippets Groups Projects
Commit cc2abc4d authored by Denis Pynkin's avatar Denis Pynkin
Browse files

Add support of ostree to initramfs


Add new overlay for 'ostree' feature.
Allow to boot ostree-based OS deployment according to boot
parameter 'ostree=....'. Additional parameter 'os=...' may be used
to indicate OS name ("apertis" by default).

Signed-off-by: default avatarDenis Pynkin <denis.pynkin@collabora.com>

Differential Revision: https://phabricator.apertis.org/D7576
parent 8434f682
Branches T4489
No related tags found
No related merge requests found
#!/bin/sh -e
# Original version of 'switchroot.sh' from ostree upstream:
# https://github.com/ostreedev/ostree/blob/master/src/switchroot/switchroot.sh
sysroot=$rootmnt
os=${os:=apertis}
## the ostree boot parameter is avaialbe during the init
env | grep ostree
# ostree=/ostree/boot.1/.../.../0
## bind mount the ostree deployment to prepare it for move
mount --bind $sysroot$ostree $sysroot$ostree
## bind mount read-only /usr
mount --bind $sysroot$ostree/usr $sysroot$ostree/usr
mount --bind -o remount,ro $sysroot$ostree/usr $sysroot$ostree/usr
## bind mount the physical root
mount --bind $sysroot $sysroot$ostree/sysroot
## bind mount the var directory which is preserved between deployments
mount --bind $sysroot/ostree/deploy/$os/var $sysroot$ostree/var
## make sure target directories are present within var
cd $sysroot$ostree/var
mkdir -p roothome mnt opt home
cd -
## move the deployment to the sysroot
mount --move $sysroot$ostree $sysroot
## after these the init system should start the switch root process
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment