os_info: Parse /etc/os-release first

This commit is contained in:
Andreas Steffen
2021-09-09 22:54:38 +02:00
parent bf91b71f1a
commit d23ca7f345
11 changed files with 184 additions and 87 deletions
+1
View File
@@ -16,3 +16,4 @@ settings-test
thread_analysis
tls_test
timeattack
os_info
+9
View File
@@ -31,6 +31,7 @@ malloc_speed_SOURCES = malloc_speed.c
fetch_SOURCES = fetch.c
dnssec_SOURCES = dnssec.c
timeattack_SOURCES = timeattack.c
id2sql_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
key2keyid_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
keyid2sql_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
@@ -46,6 +47,14 @@ aes_test_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
settings_test_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
timeattack_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la $(RTLIB)
if USE_IMCV
AM_CPPFLAGS += -I$(top_srcdir)/src/libimcv
noinst_PROGRAMS += os_info
os_info_SOURCES = os_info.c
os_info_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la \
$(top_builddir)/src/libimcv/libimcv.la
endif
key2keyid.o : $(top_builddir)/config.status
keyid2sql.o : $(top_builddir)/config.status
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright (C) 2021 Andreas Steffen
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <stdio.h>
#include <library.h>
#include <utils/debug.h>
#include <imc/imc_os_info.h>
/**
* Define debug level
*/
static level_t dbg_level = 1;
static void dbg_os_info(debug_t group, level_t level, char *fmt, ...)
{
if ((level <= dbg_level) || level <= 1)
{
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
va_end(args);
}
}
int main(int argc, char *argv[])
{
imc_os_info_t *os_info;
bool all;
all = argc > 1;
library_init(NULL, "os_info");
atexit(library_deinit);
dbg = dbg_os_info;
os_info = imc_os_info_create(all);
os_info->destroy(os_info);
return 0;
}