Move internal labeling helper to ostree

This way it can more easily be reused by Anaconda:
https://git.gnome.org/browse/ostree/commit/?id=e11de9357cea643b45a2e5e3f94d33dbd84d9ca3
This commit is contained in:
Colin Walters 2014-03-13 08:52:51 -04:00
parent d4972ede5d
commit 2e97051d74
3 changed files with 11 additions and 23 deletions

View File

@ -27,12 +27,7 @@ rpm-ostree-autobuilder: src/autobuilder/rpm-ostree-autobuilder.in Makefile
EXTRA_DIST += src/autobuilder/rpm-ostree-autobuilder.in
autobuilder_privlibdir=$(libdir)/$(PACKAGE)-autobuilder
autobuilder_privlib_PROGRAMS = rpm-ostree-relabeling-helper
rpm_ostree_relabeling_helper_SOURCES = src/rpm-ostree-relabeling-helper.c
rpm_ostree_relabeling_helper_CFLAGS = $(AM_CFLAGS) $(PKGDEP_RPMOSTREE_CFLAGS)
rpm_ostree_relabeling_helper_LDADD = $(AM_LDFLAGS) $(PKGDEP_RPMOSTREE_LIBS)
autobuilder_privlib_PROGRAMS += rpm-ostree-autobuilder-builtin-console
autobuilder_privlib_PROGRAMS = rpm-ostree-autobuilder-builtin-console
rpm_ostree_autobuilder_builtin_console_SOURCES = src/autobuilder/rpm-ostree-autobuilder-builtin-console.c
rpm_ostree_autobuilder_builtin_console_CFLAGS = $(AM_CFLAGS) $(PKGDEP_RPMOSTREE_CFLAGS)
rpm_ostree_autobuilder_builtin_console_LDADD = $(AM_LDFLAGS) $(PKGDEP_RPMOSTREE_LIBS) -lreadline

View File

@ -397,17 +397,18 @@ function pullDeploy(mntdir, srcrepo, osname, target, revision, originRepoUrl, ca
let tmpOrigin = Gio.File.new_for_path('origin.tmp');
tmpOrigin.replace_contents(originData, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, cancellable);
adminCmd.push('deploy');
let deployCmd = adminCmd.concat([]);
deployCmd.push('deploy');
let rootArg = 'root=UUID=' + ROOT_UUID;
adminCmd.push('--karg=' + rootArg);
deployCmd.push('--karg=' + rootArg);
for (let i = 0; i < params.addKernelArgs.length; i++)
adminCmd.push('--karg=' + params.addKernelArgs[i]);
deployCmd.push('--karg=' + params.addKernelArgs[i]);
adminCmd.push.apply(adminCmd, ['--os=' + osname, '--origin-file=' + tmpOrigin.get_path(), revOrTarget]);
deployCmd.push.apply(deployCmd, ['--os=' + osname, '--origin-file=' + tmpOrigin.get_path(), revOrTarget]);
ProcUtil.runSync(adminCmd, cancellable,
ProcUtil.runSync(deployCmd, cancellable,
{logInitiation: true, env: adminEnv});
let sysroot = OSTree.Sysroot.new(mntdir);
@ -423,11 +424,8 @@ UUID=' + SWAP_UUID + ' swap swap defaults 0 0\n';
fstabPath.replace_contents(defaultFstab, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, cancellable);
print("Labeling deployment root");
let libdir = Gio.File.new_for_path(GLib.getenv('OSTBUILD_LIBDIR'));
ProcUtil.runSync([libdir.get_child('rpm-ostree-relabeling-helper').get_path(),
newDeploymentDirectory.get_path(),
newDeploymentDirectory.get_path(),
""],
let relabelCmd = adminCmd.concat(['selinux-ensure-labeled', newDeploymentDirectory.get_path(), ""]);
ProcUtil.runSync(relabelCmd,
cancellable,
{ logInitiation: true });
};

View File

@ -80,13 +80,8 @@ const TaskEnsureDiskCaches = new Lang.Class({
LibQA.pullDeploy(mntdir, this.repo, osname, ref, revision, originRepoUrl,
cancellable, { addKernelArgs: addKernelArgs });
print("Doing initial labeling");
let sysroot = OSTree.Sysroot.new(mntdir);
sysroot.load(null);
let deployments = sysroot.get_deployments();
let newDeployment = deployments[0];
let newDeploymentDirectory = sysroot.get_deployment_directory(newDeployment);
ProcUtil.runSync([this.libdir.get_child('rpm-ostree-relabeling-helper').get_path(),
newDeploymentDirectory.get_path(),
ProcUtil.runSync(['ostree', 'admin', '--sysroot=' + mntdir.get_path(),
'selinux-ensure-labeled',
mntdir.get_path(),
""],
cancellable,