diff mbox series

[3/3] Drop tools replaced by swupdate-ipc

Message ID 20211028091513.2875447-4-sbabic@denx.de
State Accepted
Headers show
Series Use single tool for IPC | expand

Commit Message

Stefano Babic Oct. 28, 2021, 9:15 a.m. UTC
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 doc/source/conf.py                    |   4 +-
 doc/source/index.rst                  |   3 -
 doc/source/swupdate-hawkbitcfg.rst    |  25 ---
 doc/source/swupdate-sendtohawkbit.rst |  21 --
 doc/source/swupdate-sysrestart.rst    |  23 ---
 tools/Makefile                        |   4 -
 tools/swupdate-gethawkbitstatus.c     |  70 -------
 tools/swupdate-hawkbitcfg.c           | 146 --------------
 tools/swupdate-sendtohawkbit.c        | 106 ----------
 tools/swupdate-sysrestart.c           | 271 --------------------------
 10 files changed, 1 insertion(+), 672 deletions(-)
 delete mode 100644 doc/source/swupdate-hawkbitcfg.rst
 delete mode 100644 doc/source/swupdate-sendtohawkbit.rst
 delete mode 100644 doc/source/swupdate-sysrestart.rst
 delete mode 100644 tools/swupdate-gethawkbitstatus.c
 delete mode 100644 tools/swupdate-hawkbitcfg.c
 delete mode 100644 tools/swupdate-sendtohawkbit.c
 delete mode 100644 tools/swupdate-sysrestart.c
diff mbox series

Patch

diff --git a/doc/source/conf.py b/doc/source/conf.py
index 5b41bf44..d062a04c 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -238,11 +238,9 @@  latex_use_parts = False
 # (source start file, name, description, authors, manual section).
 man_pages = [
         ('index', 'swupdate', u'Swupdate Documentation', [u'Stefano Babic'], 1),
-        ('swupdate-sendtohawkbit', 'sendtohawkbit', u'swupdate-sendtohawkbit tool', '', 1),
+        ('swupdate-ipc', 'ipc', u'SWUpdate IPC tool', '', 1),
         ('swupdate-client', 'client', u'SWUpdate client tool', '', 1),
-        ('swupdate-hawkbitcfg', 'hawkbitcfg', u'SWUpdate hawkBit Configuration tool', '', 1),
         ('swupdate-progress', 'progress', u'SWUpdate progress tool', '', 1),
-        ('swupdate-sysrestart', 'sysrestart', u'SWUpdate sysrestart tool', '', 1),
         ]
 
 
diff --git a/doc/source/index.rst b/doc/source/index.rst
index e20d0824..c07b79ca 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -58,10 +58,7 @@  Utilities and tools
    :maxdepth: 2
 
    swupdate-client.rst
-   swupdate-hawkbitcfg.rst
-   swupdate-sendtohawkbit.rst
    swupdate-progress.rst
-   swupdate-sysrestart.rst
    swupdate-ipc.rst
 
 ############################################
diff --git a/doc/source/swupdate-hawkbitcfg.rst b/doc/source/swupdate-hawkbitcfg.rst
deleted file mode 100644
index 0a356612..00000000
--- a/doc/source/swupdate-hawkbitcfg.rst
+++ /dev/null
@@ -1,25 +0,0 @@ 
-.. SPDX-FileCopyrightText: 2013-2021 Stefano Babic <sbabic@denx.de>
-.. SPDX-License-Identifier: GPL-2.0-only
-
-swupdate-hawkbitcfg
-===================
-
-swupdate-hawkbitcfg is a small tool that tries to connect to a running instance
-of SWUpdate and configures hawkBit's parameter.
-
-SYNOPSIS
---------
-
-swupdate-hawkbitcfg [option]
-
-DESCRIPTION
------------
-
--h
-        help
--p
-        allows one to set the polling time (in seconds)
--e
-        enable suricatta mode
--d
-        disable suricatta mode
diff --git a/doc/source/swupdate-sendtohawkbit.rst b/doc/source/swupdate-sendtohawkbit.rst
deleted file mode 100644
index 03159e84..00000000
--- a/doc/source/swupdate-sendtohawkbit.rst
+++ /dev/null
@@ -1,21 +0,0 @@ 
-.. SPDX-FileCopyrightText: 2013-2021 Stefano Babic <sbabic@denx.de>
-.. SPDX-License-Identifier: GPL-2.0-only
-
-swupdate-sendtohawkbit
-======================
-
-swupdate-sendtohawkbit is a small tool that tries to connect to a running
-instance of SWUpdate and uses it as proxy to send data to the hawkBit Server.
-A typical use case is acknowledgement for activation by an application or
-operator after a new software has been installed. The tool can forward the
-result for the activation to the hawkBit server.
-
-SYNOPSIS
---------
-
-swupdate-sendtohawkbit <action id> <status> <finished> <execution> <detail 1> <detail 2> ..
-
-DESCRIPTION
------------
-
-See hawkBit API to get more information on the parameters.
diff --git a/doc/source/swupdate-sysrestart.rst b/doc/source/swupdate-sysrestart.rst
deleted file mode 100644
index 7148d37c..00000000
--- a/doc/source/swupdate-sysrestart.rst
+++ /dev/null
@@ -1,23 +0,0 @@ 
-.. SPDX-FileCopyrightText: 2013-2021 Stefano Babic <sbabic@denx.de>
-.. SPDX-License-Identifier: GPL-2.0-only
-
-swupdate-sysrestart
-===================
-
-swupdate-sysrestart is a restart controller. It checks the update status
-and in case of success, it reboots all devices that were updated.
-
-SYNOPSIS
---------
-
-swupdate-sysrestart [option]
-
-DESCRIPTION
------------
-
--r
-        optionally reboot the target after a successful update
--w
-        waits for a SWUpdate connection instead of exit with error
--s <path>
-        path to progress IPC socket
diff --git a/tools/Makefile b/tools/Makefile
index 5e43f91d..2dd6717f 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -10,11 +10,7 @@ 
 
 lib-y += \
 	 swupdate-client.o \
-	 swupdate-gethawkbitstatus.o \
 	 swupdate-progress.o \
-	 swupdate-hawkbitcfg.o \
-	 swupdate-sendtohawkbit.o \
-	 swupdate-sysrestart.o \
 	 swupdate-ipc.o
 
 # # Uncomment the next lines to integrate the compiling/linking of
diff --git a/tools/swupdate-gethawkbitstatus.c b/tools/swupdate-gethawkbitstatus.c
deleted file mode 100644
index cd480ed5..00000000
--- a/tools/swupdate-gethawkbitstatus.c
+++ /dev/null
@@ -1,70 +0,0 @@ 
-/*
- * Copyright (C) 2021 Weidmueller Interface GmbH & Co. KG
- * Roland Gaudig <roland.gaudig@weidmueller.com>
- *
- * SPDX-License-Identifier:     GPL-2.0-only
- */
-
-/*
- * This is a small example how to retrieve the hawkBit server status
- * from surricata.
- */
-
-#include <stdio.h>
-
-#if defined(CONFIG_JSON)
-#include <json-c/json.h>
-
-#include <network_ipc.h>
-
-int main(int __attribute__ ((__unused__)) argc,
-	 char __attribute__ ((__unused__)) *argv[])
-{
-	ipc_message msg;
-	struct json_object *parsed_json;
-	struct json_object *server;
-	struct json_object *status;
-	struct json_object *time;
-
-	msg.type = SWUPDATE_SUBPROCESS;
-	msg.data.procmsg.source = SOURCE_SURICATTA;
-	msg.data.procmsg.cmd = CMD_GET_STATUS;
-
-	msg.data.procmsg.buf[0] = '\0';
-	msg.data.procmsg.len = 0;
-	msg.data.procmsg.timeout = 10; /* Wait 10 s for Suricatta response */
-
-	int rc = ipc_send_cmd(&msg);
-
-	if (rc) {
-		fprintf(stderr, "Error: ipc_send_cmd failed\n");
-		exit(1);
-	}
-
-	if (msg.type == ACK) {
-		parsed_json = json_tokener_parse(msg.data.procmsg.buf);
-		json_object_object_get_ex(parsed_json, "server", &server);
-		json_object_object_get_ex(server, "status", &status);
-		json_object_object_get_ex(server, "time", &time);
-
-		printf("status: %d, time: %s\n",
-		       json_object_get_int(status),
-		       json_object_get_string(time));
-		exit(0);
-	} else {
-		printf("Error: suricatta did respond with NACK.\n");
-		exit(1);
-	}
-}
-#else
-#include <stdlib.h>
-
-#warning "swupdate-gethawkbitstatus needs json-c, replaced with dummy"
-
-int main(int __attribute__((__unused__)) argc,
-	 char __attribute__((__unused__)) **argv)
-{
-	fprintf(stderr, "json-c not available, exiting..\n");
-	exit(1);
-}
-#endif
diff --git a/tools/swupdate-hawkbitcfg.c b/tools/swupdate-hawkbitcfg.c
deleted file mode 100644
index c390ec72..00000000
--- a/tools/swupdate-hawkbitcfg.c
+++ /dev/null
@@ -1,146 +0,0 @@ 
-/*
- * (C) Copyright 2017
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
- *
- * SPDX-License-Identifier:     GPL-2.0-only
- */
-
-/*
- * This is a simple example how to send a command to
- * a SWUpdate's subprocess. It sends a "feedback"
- * to the suricatta module and waits for the answer.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <getopt.h>
-#include "network_ipc.h"
-
-static struct option long_options[] = {
-	{"help", no_argument, NULL, 'h'},
-	{"polling-time", required_argument, NULL, 'p'},
-	{"enable", no_argument, NULL, 'e'},
-	{"disable", no_argument, NULL, 'd'},
-	{"trigger", no_argument, NULL, 't'},
-	{NULL, 0, NULL, 0}
-};
-
-static void usage(char *programname)
-{
-	fprintf(stdout, "%s (compiled %s)\n", programname, __DATE__);
-	fprintf(stdout, "Usage %s [OPTION]\n",
-			programname);
-	fprintf(stdout,
-		" -p, --polling-time      : Set polling time (0=from server) to ask the backend server\n"
-		" -e, --enable            : Enable polling of backend server\n"
-		" -d, --disable           : Disable polling of backend server\n"
-		" -t, --trigger           : Poll backend server immediately\n"
-		" -h, --help              : print this help and exit\n"
-		);
-}
-
-static void send_msg(ipc_message *msg)
-{
-	int rc;
-
-	fprintf(stdout, "Sending: '%s'", msg->data.procmsg.buf);
-	rc = ipc_send_cmd(msg);
-
-	fprintf(stdout, " returned %d\n", rc);
-	if (rc == 0) {
-		fprintf(stdout, "Server returns %s\n",
-				(msg->type == ACK) ? "ACK" : "NACK");
-		if (msg->data.procmsg.len > 0) {
-			fprintf(stdout, "Returned message: %s\n",
-					msg->data.procmsg.buf);
-		}
-	}
-}
-
-/*
- * Simple example, it does nothing but calling the library
- */
-int main(int argc, char *argv[]) {
-	ipc_message msg;
-	size_t size;
-	char *buf;
-	int c;
-	unsigned long polling_time;
-	bool enable = false;
-	int opt_e = 0;
-	int opt_p = 0;
-	int opt_t = 0;
-
-	if (argc < 2) {
-		usage(argv[0]);
-		exit(1);
-	}
-
-	memset(&msg, 0, sizeof(msg));
-	msg.data.procmsg.source = SOURCE_SURICATTA;
-	msg.type = SWUPDATE_SUBPROCESS;
-
-	size = sizeof(msg.data.procmsg.buf);
-	buf = msg.data.procmsg.buf;
-
-	/* Process options with getopt */
-	while ((c = getopt_long(argc, argv, "p:edh",
-				long_options, NULL)) != EOF) {
-		switch (c) {
-		case 'p':
-			opt_p = 1;
-			msg.data.procmsg.cmd = CMD_CONFIG;
-			polling_time = strtoul(optarg, NULL, 10);
-			break;
-		case 'e':
-		case 'd':
-			msg.data.procmsg.cmd = CMD_ENABLE;
-			opt_e = 1;
-			enable = (c == 'e');
-			break;
-		case 't':
-			msg.data.procmsg.cmd = CMD_ENABLE;
-			opt_t = 1;
-			break;
-		case 'h':
-			usage(argv[0]);
-			exit(0);
-			break;
-		default:
-			usage(argv[0]);
-			exit(1);
-			break;
-		}
-	}
-
-	/*
-	 * Build a json string with the command line parameters
-	 * do not check anything, let SWUpdate
-	 * doing the checks
-	 * An error or a NACK is returned in
-	 * case of failure
-	 */
-	if (opt_p) {
-		snprintf(buf, size, "{ \"polling\" : \"%lu\"}", polling_time);
-		msg.data.procmsg.len = strnlen(buf, size);
-		send_msg(&msg);
-	}
-	if (opt_e) {
-		snprintf(buf, size, "{ \"enable\" : %s}", enable ? "true" : "false");
-		msg.data.procmsg.len = strnlen(buf, size);
-		send_msg(&msg);
-	}
-	if (opt_t) {
-		snprintf(buf, size, "{ \"trigger\" : true}");
-		msg.data.procmsg.len = strnlen(buf, size);
-		send_msg(&msg);
-	}
-
-	exit(0);
-}
diff --git a/tools/swupdate-sendtohawkbit.c b/tools/swupdate-sendtohawkbit.c
deleted file mode 100644
index 763e5b35..00000000
--- a/tools/swupdate-sendtohawkbit.c
+++ /dev/null
@@ -1,106 +0,0 @@ 
-/*
- * (C) Copyright 2017
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
- *
- * SPDX-License-Identifier:     GPL-2.0-only
- */
-
-/*
- * This is a simple example how to send a command to
- * a SWUpdate's subprocess. It sends a "feedback"
- * to the suricatta module and waits for the answer.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "network_ipc.h"
-
-static void usage(char *program) {
-	printf("%s <action id> <status> <finished> <execution> <detail 1> <detail 2> ..\n", program);
-}
-
-int fd;
-int verbose = 1;
-
-/*
- * Simple example, it does nothing but calling the library
- */
-int main(int argc, char *argv[]) {
-	int rc, written, i;
-	ipc_message msg;
-	size_t size;
-	char *buf;
-
-	if (argc < 3) {
-		usage(argv[0]);
-		exit(1);
-	}
-
-	memset(&msg, 0, sizeof(msg));
-	msg.data.procmsg.source = SOURCE_SURICATTA;
-	msg.data.procmsg.cmd = CMD_ACTIVATION;
-	msg.type = SWUPDATE_SUBPROCESS;
-
-	size = sizeof(msg.data.procmsg.buf);
-	buf = msg.data.procmsg.buf;
-
-	/*
-	 * Build a json string with the command line parameters
-	 * do not check anything, let SWUpdate
-	 * doing the checks
-	 * An error or a NACK is returned in
-	 * case of failure
-	 */
-	for (i = 1; i < argc; i++) {
-		switch (i) {
-		case 1:
-			written = snprintf(buf, size, "{ \"id\" : \"%lu\"", strtoul(argv[i], NULL, 10));
-			break;
-		case 2:
-			written = snprintf(buf, size, ", \"status\" : \"%s\"", argv[i]);
-			break;
-		case 3:
-			written = snprintf(buf, size, ",\"finished\" : \"%s\"", argv[i]);
-			break;
-		case 4:
-			written = snprintf(buf, size, ",\"execution\" : \"%s\"", argv[i]);
-			break;
-		case 5:
-			written = snprintf(buf, size, ",\"details\" : [ \"%s\"", argv[i]);
-			break;
-		default:
-			written = snprintf(buf, size, ",\"%s\"", argv[i]);
-			break;
-		}
-
-		buf += written;
-		size -= written;
-
-		if (size <= 0)
-			break;
-	}
-
-	if (i > 5)
-		(void)snprintf(buf, size, "]}");
-	else
-		(void)snprintf(buf, size, "}");
-
-	fprintf(stdout, "Sending: '%s'", msg.data.procmsg.buf);
-	msg.data.procmsg.len = strnlen(msg.data.procmsg.buf, sizeof(msg.data.procmsg.buf));
-
-	rc = ipc_send_cmd(&msg);
-
-	fprintf(stdout, " returned %d\n", rc);
-	if (!rc)
-		fprintf(stdout, "Server returns %s\n",
-				(msg.type == ACK) ? "ACK" : "NACK");
-
-	exit(0);
-}
-
diff --git a/tools/swupdate-sysrestart.c b/tools/swupdate-sysrestart.c
deleted file mode 100644
index 078da4bd..00000000
--- a/tools/swupdate-sysrestart.c
+++ /dev/null
@@ -1,271 +0,0 @@ 
-/*
- * (C) Copyright 2016
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
- *
- * SPDX-License-Identifier:     GPL-2.0-only
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/un.h>
-#include <sys/select.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <pthread.h>
-#include <getopt.h>
-#include <ifaddrs.h>
-#include <netdb.h>
-
-#if defined(CONFIG_CURL)
-#include <curl/curl.h>
-#include <progress_ipc.h>
-
-#define MAX_DEVS 100
-#define PATTERN "REMOTE:"
-
-
-/* Store the ip addresses of device to be rebooted */
-static char ipaddrs[MAX_DEVS][NI_MAXHOST];
-
-static bool is_ipaddress(char *ipaddr)
-{
-    struct sockaddr_in sa;
-    int result = inet_pton(AF_INET, ipaddr, &(sa.sin_addr));
-    return result == 1;
-}
-
-static struct option long_options[] = {
-	{"help", no_argument, NULL, 'h'},
-	{"wait", no_argument, NULL, 'w'},
-	{"socket", required_argument, NULL, 's'},
-	{NULL, 0, NULL, 0}
-};
-
-static void usage(char *programname)
-{
-	fprintf(stdout, "%s (compiled %s)\n", programname, __DATE__);
-	fprintf(stdout, "Usage %s [OPTION]\n",
-			programname);
-	fprintf(stdout,
-		" -w, --wait              : wait for a connection with SWUpdate\n"
-		" -s, --socket <path>     : path to progress IPC socket\n"
-		" -h, --help              : print this help and exit\n"
-		);
-}
-
-static void restart_system(unsigned int ndevs)
-{
-	int dev;
-	CURL *curl_handle;	/* CURL handle */
-	char url[NI_MAXHOST + 20];
-	CURLcode curlrc;
-	struct ifaddrs *ifaddr, *ifa;
-	char local[NI_MAXHOST];
-
-	/*
-	 * Drop local ip address from the list to avoid that
-	 * this board reboots before sending all messages
-	 * A local reboot will be done by calling reboot()
-	 */
-	if (getifaddrs(&ifaddr) != -1) {
-		for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
-			if ((ifa->ifa_addr == NULL) || (ifa->ifa_addr->sa_family != AF_INET))
-				continue;
-			if (getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in),
-				local, NI_MAXHOST, NULL, 0, NI_NUMERICHOST))
-					continue;
-
-				for (dev = 0; dev < ndevs; dev++) {
-					if (!strcmp(local, ipaddrs[dev])) {
-						printf("LOCAL IP : %s %s\n", local, ipaddrs[dev]);
-						ipaddrs[dev][0] = '\0';
-					}
-				}
-		}
-	}
-
-	freeifaddrs(ifaddr);
-
-	for (dev = 0; dev < ndevs; dev++) {
-		if (!strlen(ipaddrs[dev]))
-			continue;
-
-		curl_handle = curl_easy_init();
-		/* something very bad, it should never happen */
-		if (!curl_handle)
-			exit(2);
-		snprintf(url, sizeof(url), "http://%s:8080/restart", ipaddrs[dev]);
-		if ((curl_easy_setopt(curl_handle, CURLOPT_POST, 1L) != CURLE_OK) ||
-			/* get verbose debug output please */
-			(curl_easy_setopt(curl_handle, CURLOPT_VERBOSE,
-				1L) != CURLE_OK) ||
-			(curl_easy_setopt(curl_handle, CURLOPT_URL,
-				url) != CURLE_OK) ||
-			(curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS,
-				"swupdate=reboot") != CURLE_OK) ||
-			(curl_easy_setopt(curl_handle, CURLOPT_USERAGENT,
-			"libcurl-agent/1.0") != CURLE_OK)) {
-				fprintf(stderr, "Error setting curl options\n");
-				exit(2);
-		}
-
-		fprintf(stdout, "Rebooting %s\n", url);
-
-		curlrc = curl_easy_perform(curl_handle);
-		if (curlrc != CURLE_OK && curlrc != CURLE_GOT_NOTHING) {
-			fprintf(stderr, "Cannot reboot %s, try the next one, error(%d) : %s\n",
-				ipaddrs[dev], curlrc, curl_easy_strerror(curlrc));
-		}
-		curl_easy_cleanup(curl_handle);
-	}
-}
-
-int main(int argc, char **argv)
-{
-	int connfd;
-	struct progress_msg msg;
-	int opt_w = 0;
-	int c;
-	int ret;
-	int ndevs = 0;
-
-	RECOVERY_STATUS	status = IDLE;		/* Update Status (Running, Failure) */
-
-	/* Process options with getopt */
-	while ((c = getopt_long(argc, argv, "whs:",
-				long_options, NULL)) != EOF) {
-		switch (c) {
-		case 'w':
-			opt_w = 1;
-			break;
-		case 's':
-			SOCKET_PROGRESS_PATH = strdup(optarg);
-			break;
-		case 'h':
-			usage(argv[0]);
-			exit(0);
-			break;
-		default:
-			usage(argv[0]);
-			exit(1);
-			break;
-		}
-	}
-
-	/* initialize CURL */
-	ret = curl_global_init(CURL_GLOBAL_DEFAULT);
-	if (ret != CURLE_OK) {
-		fprintf(stderr, "CURL cannot be initialized, exiting..\n");
-		exit(1);
-	}
-
-	connfd = -1;
-	while (1) {
-		if (connfd < 0) {
-			connfd = progress_ipc_connect(opt_w);
-		}
-
-		/*
-		 * if still fails, try later
-		 */
-		if (connfd < 0) {
-			sleep(1);
-			continue;
-		}
-
-		if (progress_ipc_receive(&connfd, &msg) <= 0) {
-			continue;
-		}
-
-		/*
-		 * Something happens, show the info
-		 */
-		if ((status == IDLE) && (msg.status != IDLE)) {
-			fprintf(stdout, "\nUpdate started !\n");
-			fprintf(stdout, "Interface: ");
-			switch (msg.source) {
-			case SOURCE_UNKNOWN:
-				fprintf(stdout, "UNKNOWN\n\n");
-				break;
-			case SOURCE_WEBSERVER:
-				fprintf(stdout, "WEBSERVER\n\n");
-				break;
-			case SOURCE_SURICATTA:
-				fprintf(stdout, "BACKEND\n\n");
-				break;
-			case SOURCE_DOWNLOADER:
-				fprintf(stdout, "DOWNLOADER\n\n");
-				break;
-			case SOURCE_LOCAL:
-				fprintf(stdout, "LOCAL\n\n");
-				break;
-			}
-
-		}
-
-		if (msg.infolen > 0) {
-			/*
-			 * check that msg is NULL terminated
-			 */
-			if (msg.infolen > sizeof(msg.info) - 1) {
-				msg.infolen = sizeof(msg.info) - 1;
-			}
-			msg.info[msg.infolen] = '\0';
-			char *ipaddr = strstr(msg.info, PATTERN);
-			char *end;
-			if (ipaddr && (strlen(ipaddr) > strlen(PATTERN))) {
-				ipaddr += strlen(PATTERN);
-				end = strchr(ipaddr, '}');
-				if (end)
-					*end = '\0';
-				if (is_ipaddress(ipaddr)) {
-					memset(ipaddrs[ndevs], 0, NI_MAXHOST);
-					strncpy(ipaddrs[ndevs], ipaddr, sizeof(ipaddrs[ndevs]));
-					fprintf(stdout, "Remote device:%s\n", ipaddr);
-					ndevs++;
-				}
-			} else
-				fprintf(stdout, "INFO : %s\n", msg.info);
-		}
-
-		switch (msg.status) {
-		case SUCCESS:
-			fprintf(stdout, "Ready to reboot !\n");
-			restart_system(ndevs);
-			sleep(5);
-
-			if (system("reboot") < 0) { /* It should never happen */
-				fprintf(stdout, "Please reset the board.\n");
-			}
-			break;
-		case FAILURE:
-			ndevs = 0;
-			break;
-		case DONE:
-			fprintf(stdout, "\nDONE.\n");
-			break;
-		default:
-			break;
-		}
-
-		status = msg.status;
-	}
-}
-#else
-#warning "swupdate-sysrestart needs libcurl, replaced with dummy"
-
-int main(int __attribute__((__unused__)) argc, char __attribute__((__unused__)) **argv)
-{
-	fprintf(stderr, "Curl not available, exiting..\n");
-	exit(1);
-}
-#endif