forked from coreos/rpm-ostree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support RPMs installing in
/opt
and /usr/local
This solves the `/opt` problem by using the new state overlay concept in OSTree: an overlay filesystem is mounted on top of `/usr/lib/opt` and the upper dir is automatically "rebased" whenever new content comes in. Concretely, this means that app state is carried forward, all while allowing the (OSTree-managed) package contents to be updated. We also solve the `/usr/local` problem the same way. The app state issue isn't really present there, but `/usr/local` has traditionally been system state. We want to keep supporting dropping files there all while also supporting shipping OSTree-owned content. See also: ostreedev/ostree#3113 Fixes: coreos#233
- Loading branch information
Showing
4 changed files
with
127 additions
and
6 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
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,44 @@ | ||
#!/bin/bash | ||
set -xeuo pipefail | ||
|
||
dn=$(cd "$(dirname "$0")" && pwd) | ||
# shellcheck source=libcomposetest.sh | ||
. "${dn}/libcomposetest.sh" | ||
|
||
# Add a local rpm-md repo so we can mutate local test packages | ||
treefile_append "repos" '["test-repo"]' | ||
|
||
# An RPM that installs in /opt | ||
build_rpm test-opt \ | ||
install "mkdir -p %{buildroot}/opt/megacorp/bin | ||
install %{name} %{buildroot}/opt/megacorp/bin" \ | ||
files "/opt/megacorp" | ||
|
||
# An RPM that installs in /usr/local | ||
build_rpm test-usr-local \ | ||
install "mkdir -p %{buildroot}/usr/local/bin | ||
install %{name} %{buildroot}/usr/local/bin" \ | ||
files "/usr/local/bin/%{name}" | ||
|
||
echo gpgcheck=0 >> yumrepo.repo | ||
ln "$PWD/yumrepo.repo" config/yumrepo.repo | ||
|
||
# the top-level manifest doesn't have any packages, so just set it | ||
treefile_append "packages" '["test-opt", "test-usr-local"]' | ||
|
||
# enable state overlays | ||
treefile_set "opt-usrlocal-overlays" 'True' | ||
|
||
runcompose | ||
|
||
ostree --repo="${repo}" ls -R "${treeref}" /usr/lib/opt > opt.txt | ||
assert_file_has_content opt.txt "/usr/lib/opt/megacorp/bin/test-opt" | ||
|
||
ostree --repo="${repo}" ls -R "${treeref}" /usr/local > usr-local.txt | ||
assert_file_has_content usr-local.txt "/usr/local/bin/test-usr-local" | ||
|
||
ostree --repo="${repo}" ls -R "${treeref}" /usr/lib/systemd/system/local-fs.target.requires > local-fs.txt | ||
assert_file_has_content local-fs.txt "ostree-state-overlay@usr-lib-opt.service" | ||
assert_file_has_content local-fs.txt "ostree-state-overlay@usr-local.service" | ||
|
||
echo "ok /opt and /usr/local RPMs" |