Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmpfiles: Copy /usr/share/factory/var to /var #3103

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/boot/ostree-tmpfiles.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
d /run/ostree 0755 root root -
# https://github.com/ostreedev/ostree/issues/393
R! /var/tmp/ostree-unlock-ovl.*
# Automatically propagate all /var content from /usr/share/factory/var;
# the ostree-container stack is being changed to do this, and we want to
# encourage ostree use cases in general to follow this pattern.
C+! /var - - - - -
8 changes: 4 additions & 4 deletions src/libostree/ostree-sysroot-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3039,10 +3039,10 @@ lint_deployment_fs (OstreeSysroot *self, OstreeDeployment *deployment, int deplo
if (dent == NULL)
break;

fprintf (
stderr,
"note: Deploying commit %s which contains content in /var/%s that will be ignored.\n",
ostree_deployment_get_csum (deployment), dent->d_name);
fprintf (stderr,
"note: Deploying commit %s which contains content in /var/%s that should be in "
"/usr/share/factory/var\n",
ostree_deployment_get_csum (deployment), dent->d_name);
}

return TRUE;
Expand Down
29 changes: 29 additions & 0 deletions tests/kolainst/destructive/var-tmpfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -xeuo pipefail

. ${KOLA_EXT_DATA}/libinsttest.sh

require_writable_sysroot
prepare_tmpdir

case "${AUTOPKGTEST_REBOOT_MARK:-}" in
"")
factory_var=rootfs/usr/share/factory/var
mkdir -p ${factory_var}
cd "${factory_var}"
mkdir -p home/someuser
echo bashrc > home/someuser/.bashrc
chown -R 1000:1000 home/someuser
mkdir -m 01777 -p tmp
cd -
ostree commit -b testlint --no-bindings --selinux-policy-from-base --tree=ref="${host_refspec}" --consume --tree=dir=rootfs
ostree admin deploy testlint 2>err.txt
assert_not_file_has_content err.txt 'contains content in /var'

/tmp/autopkgtest-reboot "2"
;;
2)
assert_file_has_content /home/someuser/.bashrc bashrc
;;
*) fatal "Unexpected AUTOPKGTEST_REBOOT_MARK=${AUTOPKGTEST_REBOOT_MARK}" ;;
esac
Loading