4 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include <libgdbus/dbus-systemd.h>
23 #include "shared/log.h"
25 #define SYSTEMD_DBUS_METHOD_SYSTEM_STATE "SystemState"
26 #define SYSTEMD_STATE_RUNNING "running"
27 #define SYSTEMD_STATE_DEGRADED "degraded"
29 int check_system_boot_finished(void)
34 GVariant *reply = NULL;
36 reply = systemd_get_manager_property(SYSTEMD_DBUS_METHOD_SYSTEM_STATE);
38 _E("Failed to get system state: No reply");
41 if (!dh_get_param_from_var(reply, "s", &state)) {
42 _E("Failed to get system state(%s)", g_variant_get_type_string(reply));
46 _I("System state=%s", state);
48 len = strlen(state) + 1;
49 if (!strncmp(state, SYSTEMD_STATE_RUNNING, len) ||
50 !strncmp(state, SYSTEMD_STATE_DEGRADED, len))
57 g_variant_unref(reply);