live: Don't output "services restart" for pure package additions

If all we're doing is layering new packages, no need to tell
the admin that things may need restarting.
This commit is contained in:
Colin Walters 2021-03-11 22:07:21 +00:00
parent 8ec0a3db12
commit 2187ef0f45
2 changed files with 11 additions and 6 deletions

View File

@ -52,12 +52,12 @@ fn get_args_variant(sysroot: &ostree::Sysroot, opts: &Opts) -> Result<glib::Vari
}
pub(crate) fn applylive_entrypoint(args: &Vec<String>) -> Result<()> {
let opts = Opts::from_iter(args.iter());
let opts = &Opts::from_iter(args.iter());
let client = &mut crate::client::ClientConnection::new()?;
let sysroot = &ostree::Sysroot::new_default();
sysroot.load(gio::NONE_CANCELLABLE)?;
let args = get_args_variant(sysroot, &opts)?;
let args = get_args_variant(sysroot, opts)?;
let params = crate::variant_utils::new_variant_tuple(&[args]);
let reply = &client.get_os_ex_proxy().call_sync(
@ -97,8 +97,12 @@ fn finish(sysroot: &ostree::Sysroot) -> Result<()> {
};
pkgdiff.print();
crate::ffi::output_message(
"Successfully updated running filesystem tree; some services may need to be restarted.",
);
if pkgdiff.n_removed() == 0 && pkgdiff.n_modified() == 0 {
crate::ffi::output_message("Successfully updated running filesystem tree.");
} else {
crate::ffi::output_message(
"Successfully updated running filesystem tree; some services may need to be restarted.",
);
}
Ok(())
}

View File

@ -96,7 +96,8 @@ rm -rf /etc/testpkg-etc \
echo myconfig > /etc/testpkg-etc-other.conf
grep myconfig /etc/testpkg-etc-other.conf
rpm-ostree install -A testpkg-etc testdaemon
rpm-ostree install -A testpkg-etc testdaemon | tee out.txt
assert_file_has_content_literal out.txt 'Successfully updated running filesystem tree.'
rpm -q bar test{pkg-etc,daemon} > rpmq.txt
assert_file_has_content rpmq.txt bar-1.0-1 test{pkg-etc,daemon}-1.0-1
cat /etc/testpkg-etc.conf > testpkg-etc.conf