]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/systemctl/systemctl-preset-all.c
ed117e077c713d644df6f6d3e7406466d071a9d8
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
4 #include "bus-locator.h"
5 #include "systemctl-daemon-reload.h"
6 #include "systemctl-preset-all.h"
7 #include "systemctl-util.h"
10 int verb_preset_all(int argc
, char *argv
[], void *userdata
) {
11 InstallChange
*changes
= NULL
;
15 if (install_client_side()) {
16 r
= unit_file_preset_all(arg_runtime_scope
, unit_file_flags_from_args(), arg_root
, arg_preset_mode
, &changes
, &n_changes
);
17 install_changes_dump(r
, "preset", changes
, n_changes
, arg_quiet
);
22 _cleanup_(sd_bus_error_free
) sd_bus_error error
= SD_BUS_ERROR_NULL
;
23 _cleanup_(sd_bus_message_unrefp
) sd_bus_message
*reply
= NULL
;
26 r
= acquire_bus(BUS_MANAGER
, &bus
);
30 polkit_agent_open_maybe();
39 unit_file_preset_mode_to_string(arg_preset_mode
),
43 return log_error_errno(r
, "Failed to preset all units: %s", bus_error_message(&error
, r
));
45 r
= bus_deserialize_and_dump_unit_file_changes(reply
, arg_quiet
, &changes
, &n_changes
);
54 r
= daemon_reload(ACTION_RELOAD
, /* graceful= */ false);
60 install_changes_free(changes
, n_changes
);