sysroot: Handle deleting directories in /etc

We need to use the full shutil_rm_rf() in order to actually delete
complete directories.

Test suite code based on a patch from Sjoerd Simons <sjored@luon.net>

https://bugzilla.gnome.org/show_bug.cgi?id=710097
This commit is contained in:
Colin Walters 2013-10-15 14:11:43 -04:00
parent 3b700ccb50
commit b2a98f4ca3
3 changed files with 4 additions and 1 deletions

View File

@ -161,7 +161,7 @@ merge_etc_changes (GFile *orig_etc,
g_assert (path); g_assert (path);
target_file = g_file_resolve_relative_path (new_etc, path); target_file = g_file_resolve_relative_path (new_etc, path);
if (!ot_gfile_ensure_unlinked (target_file, cancellable, error)) if (!gs_shutil_rm_rf (target_file, cancellable, error))
goto out; goto out;
} }

View File

@ -218,6 +218,8 @@ EOF
echo "a config file" > usr/etc/aconfigfile echo "a config file" > usr/etc/aconfigfile
mkdir -p usr/etc/NetworkManager mkdir -p usr/etc/NetworkManager
echo "a default daemon file" > usr/etc/NetworkManager/nm.conf echo "a default daemon file" > usr/etc/NetworkManager/nm.conf
mkdir -p usr/etc/testdirectory
echo "a default daemon file" > usr/etc/testdirectory/test
ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Build" ostree --repo=${test_tmpdir}/testos-repo commit -b testos/buildmaster/x86_64-runtime -s "Build"

View File

@ -101,6 +101,7 @@ ostree admin --sysroot=sysroot status
echo "ok fourth deploy (retain)" echo "ok fourth deploy (retain)"
echo "a new local config file" > sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-config-file echo "a new local config file" > sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-config-file
rm -r sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/testdirectory
rm sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile rm sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-symlink ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-symlink
ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime