]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/systemctl/systemctl-preset-all.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
4 #include "bus-locator.h"
5 #include "systemctl-daemon-reload.h"
6 #include "systemctl-preset-all.h"
7 #include "systemctl-util.h"
10 int preset_all(int argc
, char *argv
[], void *userdata
) {
11 UnitFileChange
*changes
= NULL
;
15 if (install_client_side()) {
16 r
= unit_file_preset_all(arg_scope
, unit_file_flags_from_args(), arg_root
, arg_preset_mode
, &changes
, &n_changes
);
17 unit_file_dump_changes(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(argc
, argv
, userdata
);
58 unit_file_changes_free(changes
, n_changes
);