-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switchroot: Document a bit more, add demo shell implementation
This could help others who want to integrate with other init systems/initramfs. Commit-message-by: Colin Walters <[email protected]> Closes: #784 Approved by: cgwalters
- Loading branch information
1 parent
49a525f
commit dea2025
Showing
2 changed files
with
40 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
# This demonstration script is an implementation in shell | ||
# similar to ostree-prepare-root.c. For a bit more information, | ||
# see adapting-existing.md. | ||
|
||
## 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 |