Hello community, here is the log from the commit of package netcontrol for openSUSE:Factory checked in at 2013-01-29 11:19:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/netcontrol (Old) and /work/SRC/openSUSE:Factory/.netcontrol.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "netcontrol", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/netcontrol/netcontrol.changes 2012-07-03 14:26:00.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.netcontrol.new/netcontrol.changes 2013-01-29 11:19:15.000000000 +0100 @@ -1,0 +2,10 @@ +Fri Jan 25 09:39:55 UTC 2013 - [email protected] + +- version 0.2.7 +- Fixed a bridge variable initialization in try_bridge +- Use --enable-network-service on openSUSE >= 12.3 (bnc#798348) +- Check the network.service alias link instead of NETWORKMANAGER + variable in /etc/sysconfig/network/config, when requested by + the --enable-network-service configure option. + +------------------------------------------------------------------- Old: ---- netcontrol-0.2.6.tar.bz2 New: ---- netcontrol-0.2.7.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ netcontrol.spec ++++++ --- /var/tmp/diff_new_pack.LbBVH1/_old 2013-01-29 11:19:16.000000000 +0100 +++ /var/tmp/diff_new_pack.LbBVH1/_new 2013-01-29 11:19:16.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package netcontrol # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: netcontrol -Version: 0.2.6 +Version: 0.2.7 Release: 0 Summary: A network configuration library License: LGPL-2.1+ @@ -38,6 +38,11 @@ BuildRequires: libnl-devel %endif BuildRequires: pkg-config +%if 0%{?suse_version} >= 1230 +Requires: sysconfig >= 0.80.0 +%else +Requires: sysconfig >= 0.71.0 +%endif %description A interim network configuration library, currently implementing the @@ -92,6 +97,9 @@ %build export CFLAGS="-W -Wall $RPM_OPT_FLAGS" %configure \ +%if 0%{?suse_version} >= 1230 + --enable-network-service \ +%endif --disable-static make %{?_smp_mflags} ++++++ netcontrol-0.2.6.tar.bz2 -> netcontrol-0.2.7.tar.bz2 ++++++ ++++ 6660 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/netcontrol-0.2.6/configure.ac new/netcontrol-0.2.7/configure.ac --- old/netcontrol-0.2.6/configure.ac 2012-07-03 13:14:14.000000000 +0200 +++ new/netcontrol-0.2.7/configure.ac 2013-01-25 10:44:59.000000000 +0100 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.63]) -AC_INIT([netcontrol], [0.2.6], [[email protected]], [], +AC_INIT([netcontrol], [0.2.7], [[email protected]], [], [http://www.suse.de/~mt/git/netcontrol.git/]) AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip]) AC_CONFIG_SRCDIR([src/nctest.c]) @@ -10,7 +10,7 @@ AC_PREFIX_DEFAULT(/usr) AC_SUBST([VERSION_API], [${VERSION%.*}]) -AC_SUBST([LIBNETCONTROL_VERSION_INFO], [2:0:2]) +AC_SUBST([LIBNETCONTROL_VERSION_INFO], [2:7:2]) AC_USE_SYSTEM_EXTENSIONS @@ -29,6 +29,14 @@ ]) PKG_CHECK_MODULES([LIBNL], [libnl-1]) +AC_ARG_ENABLE(network-service, + [AS_HELP_STRING([--enable-network-service], + [Check systemd network.service alias link])]) +if test "X$enable_network_service" = "Xyes" ; then + AC_DEFINE([__NETCONTROL_USE_SERVICE_ALIAS], [1], + [Check network.service alias instead of NETWORKMANAGER variable]) +fi + # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([arpa/inet.h limits.h netinet/in.h stddef.h stdlib.h]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/netcontrol-0.2.6/missing new/netcontrol-0.2.7/missing --- old/netcontrol-0.2.6/missing 2012-07-03 13:17:27.000000000 +0200 +++ new/netcontrol-0.2.7/missing 2013-01-25 10:45:47.000000000 +0100 @@ -1,10 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2009-04-28.21; # UTC +scriptversion=2012-01-06.18; # UTC -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard <[email protected]>, 1996. # This program is free software; you can redistribute it and/or modify @@ -26,7 +25,7 @@ # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" + echo 1>&2 "Try '$0 --help' for more information" exit 1 fi @@ -34,7 +33,7 @@ sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' -# In the cases where this matters, `missing' is being run in the +# In the cases where this matters, 'missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac @@ -65,7 +64,7 @@ echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: @@ -74,21 +73,20 @@ --run try to run the given command, and emulate it if it fails Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' + aclocal touch file 'aclocal.m4' + autoconf touch file 'configure' + autoheader touch file 'config.h.in' autom4te touch the output file, or create a stub one - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c + automake touch all 'Makefile.in' files + bison create 'y.tab.[ch]', if possible, from existing .[ch] + flex create 'lex.yy.c', if possible, from existing .c help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c + lex create 'lex.yy.c', if possible, from existing .c makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] + yacc create 'y.tab.[ch]', if possible, from existing .[ch] -Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and -\`g' are ignored when checking the name. +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. Send bug reports to <[email protected]>." exit $? @@ -100,8 +98,8 @@ ;; -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" + echo 1>&2 "$0: Unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; @@ -122,22 +120,13 @@ # Not GNU programs, they don't have --version. ;; - tar*) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether + # running '$TOOL --version' or '$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi @@ -149,27 +138,27 @@ case $program in aclocal*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from +WARNING: '$1' is $msg. You should only need it if + you modified 'acinclude.m4' or '${configure_ac}'. You might want + to install the Automake and Perl packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU +WARNING: '$1' is $msg. You should only need it if + you modified '${configure_ac}'. You might want to install the + Autoconf and GNU m4 packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them +WARNING: '$1' is $msg. You should only need it if + you modified 'acconfig.h' or '${configure_ac}'. You might want + to install the Autoconf and GNU m4 packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" @@ -186,9 +175,9 @@ automake*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. +WARNING: '$1' is $msg. You should only need it if + you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'. + You might want to install the Automake and Perl packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | @@ -197,10 +186,10 @@ autom4te*) echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. +WARNING: '$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU + You can get '$1' as part of Autoconf from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` @@ -220,13 +209,13 @@ bison*|yacc*) echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package +WARNING: '$1' $msg. You should only need it if + you modified a '.y' file. You may need the Bison package in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." + Bison from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` @@ -250,13 +239,13 @@ lex*|flex*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package +WARNING: '$1' is $msg. You should only need it if + you modified a '.l' file. You may need the Flex package in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." + Flex from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` @@ -273,10 +262,10 @@ help2man*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if +WARNING: '$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." + Help2man package in order for those modifications to take + effect. You can get Help2man from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` @@ -291,12 +280,12 @@ makeinfo*) echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file +WARNING: '$1' is $msg. You should only need it if + you modified a '.texi' or '.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." + call might also be the consequence of using a buggy 'make' (AIX, + DU, IRIX). You might want to install the Texinfo package or + the GNU make package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` @@ -318,49 +307,14 @@ touch $file ;; - tar*) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - *) echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. +WARNING: '$1' is needed, and is $msg. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, + proper tools for further handling them. Check the 'README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." + some other package would contain this missing '$1' program." exit 1 ;; esac diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/netcontrol-0.2.6/netcontrol.changes new/netcontrol-0.2.7/netcontrol.changes --- old/netcontrol-0.2.6/netcontrol.changes 2012-07-03 13:15:52.000000000 +0200 +++ new/netcontrol-0.2.7/netcontrol.changes 2013-01-25 10:44:59.000000000 +0100 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Fri Jan 25 09:39:55 UTC 2013 - [email protected] + +- version 0.2.7 +- Fixed a bridge variable initialization in try_bridge +- Use --enable-network-service on openSUSE >= 12.3 (bnc#798348) +- Check the network.service alias link instead of NETWORKMANAGER + variable in /etc/sysconfig/network/config, when requested by + the --enable-network-service configure option. + +------------------------------------------------------------------- Tue Jul 3 11:15:47 UTC 2012 - [email protected] - version 0.2.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/netcontrol-0.2.6/netcontrol.spec new/netcontrol-0.2.7/netcontrol.spec --- old/netcontrol-0.2.6/netcontrol.spec 2012-07-03 13:17:32.000000000 +0200 +++ new/netcontrol-0.2.7/netcontrol.spec 2013-01-25 10:45:51.000000000 +0100 @@ -16,7 +16,7 @@ # Name: netcontrol -Version: 0.2.6 +Version: 0.2.7 Release: 0 Summary: A network configuration library License: LGPL-2.1+ @@ -37,6 +37,11 @@ BuildRequires: libnl-devel %endif BuildRequires: pkg-config +%if 0%{?suse_version} >= 1230 +Requires: sysconfig >= 0.80.0 +%else +Requires: sysconfig >= 0.71.0 +%endif %description A interim network configuration library, currently implementing the @@ -91,6 +96,9 @@ %build export CFLAGS="-W -Wall $RPM_OPT_FLAGS" %configure \ +%if 0%{?suse_version} >= 1230 + --enable-network-service \ +%endif --disable-static make %{?_smp_mflags} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/netcontrol-0.2.6/netcontrol.spec.in new/netcontrol-0.2.7/netcontrol.spec.in --- old/netcontrol-0.2.6/netcontrol.spec.in 2012-07-03 13:12:40.000000000 +0200 +++ new/netcontrol-0.2.7/netcontrol.spec.in 2013-01-25 10:05:58.000000000 +0100 @@ -37,6 +37,11 @@ BuildRequires: libnl-devel %endif BuildRequires: pkg-config +%if 0%{?suse_version} >= 1230 +Requires: sysconfig >= 0.80.0 +%else +Requires: sysconfig >= 0.71.0 +%endif %description A interim network configuration library, currently implementing the @@ -91,6 +96,9 @@ %build export CFLAGS="-W -Wall $RPM_OPT_FLAGS" %configure \ +%if 0%{?suse_version} >= 1230 + --enable-network-service \ +%endif --disable-static make %{?_smp_mflags} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/netcontrol-0.2.6/src/backend-suse.c new/netcontrol-0.2.7/src/backend-suse.c --- old/netcontrol-0.2.6/src/backend-suse.c 2012-07-03 12:57:05.000000000 +0200 +++ new/netcontrol-0.2.7/src/backend-suse.c 2013-01-25 10:44:59.000000000 +0100 @@ -67,6 +67,7 @@ static int __nc_suse_config_interface_start(nc_handle_t *, nc_interface_t *); static int __nc_suse_config_interface_stop(nc_handle_t *, nc_interface_t *); static void __nc_suse_config_close(nc_handle_t *); +static int __nc_suse_config_get_network_service(nc_handle_t *nh, char **service); typedef struct { nc_handle_t base; @@ -552,25 +553,24 @@ return -1; } +static int /* bool */ +__netcontrol_enabled(nc_handle_t *nh) +{ + char *service = NULL; + int enabled = 0; + + if( __nc_suse_config_get_network_service(nh, &service) == 0) { + if (service && strcmp(service, "network.service") == 0) + enabled = 1; + nc_string_free(&service); + } + return enabled; +} + nc_handle_t * nc__suse_config_init(const char *root_dir) { - char path[PATH_MAX + 1] = {'\0'}; nc_config_handle_t *nh; - nc_sysconfig_t *sc; - nc_var_t *v; - - snprintf(path, sizeof(path), "%s%s/%s", (root_dir ? root_dir : ""), - _SYSCONFIG_NETWORK_DIR, _CONFIG_GLOBAL); - sc = nc_sysconfig_read(path); - if(sc) { - v = nc_sysconfig_get(sc, "NETWORKMANAGER"); - if(v && nc_string_eq(v->value, "yes")) { - nc_sysconfig_free(sc); - return NULL; - } - nc_sysconfig_free(sc); - } nh = calloc(1, sizeof(*nh)); if(nh) { @@ -581,6 +581,11 @@ } } nh->base.op = &nc__suse_config_ops; + if (!__netcontrol_enabled(&nh->base)) { + nc_string_free(&nh->root); + free(nh); + return NULL; + } return &nh->base; } return NULL; @@ -1083,7 +1088,7 @@ static int try_bridge(nc_handle_t *nh, nc_interface_t *ifp, nc_sysconfig_t *sc) { - nc_bridge_t *bridge; + nc_bridge_t *bridge = NULL; nc_var_t * v; char *value = NULL, *token; @@ -5262,3 +5267,120 @@ return code; } } + +static int +__nc_suse_config_get_network_service(nc_handle_t *nh, char **service) +{ + nc_config_handle_t * ch = __to_config_handle(nh); +#if defined(__NETCONTROL_USE_SERVICE_ALIAS) + nc_string_array_t args = NC_STRING_ARRAY_INIT; + const char * info; + int status = -1; + int code = -1; + char buf[BUFSIZ]; + char * ptr; + nc_cmd_pipe_t cmd; + + nc_string_free(service); + if(ch->root) { + nc_error_detail_fmt(nh, + "Stop not supported when root_directory is set"); + return -1; + } + + info = "systemctl --no-pager -p Id show network.service"; + if(nc_file_exists("/usr/bin/systemctl")) + nc_string_array_append(&args, "/usr/bin/systemctl"); + else + nc_string_array_append(&args, "/bin/systemctl"); + nc_string_array_append(&args, "--no-pager"); + nc_string_array_append(&args, "-p"); + nc_string_array_append(&args, "Id"); + nc_string_array_append(&args, "show"); + nc_string_array_append(&args, "network.service"); + if(args.count != 6) { + nc_string_array_destroy(&args); + nc_error_detail_fmt(nh, + "Unable to construct '%s' command argument list", + info); + return -1; + } + + memset(&cmd, 0, sizeof(cmd)); + cmd.exec = __child_ifaction_exec; + cmd.args = &args; + if(nc_cmd_pipe_exec(&cmd) == -1) { + nc_string_array_destroy(&args); + nc_error("Unable to execute '%s'", info); + return -1; + } + + if(cmd.file) { + memset(buf, 0, sizeof(buf)); + while(fgets(buf, sizeof(buf)-1, cmd.file)) { + buf[strcspn(buf, "\r\n")] = '\0'; + + nc_trace("%s: %s", info, buf); + if (*service != NULL) + continue; + + ptr = nc_string_strip_spaces(buf); + if (nc_string_prefix_eq("Id=", ptr)) { + ptr += nc_string_len("Id="); + + if(nc_string_dup(service, ptr)) + break; + } + } + fclose(cmd.file); + } + nc_string_array_destroy(&args); + + if(nc_cmd_pipe_wait(&cmd, &status, 0) == -1) { + nc_error("waitpid failure: %m"); + return -1; + } + + if(!nc_string_len(*service)) { + nc_error("Unable to read output of '%s'", info); + return -1; + } + + if(WIFEXITED(status)) { + code = WEXITSTATUS(status); + nc_info("Command '%s' returned with exit code: %d", + info, code); + } else { + code = -1; + nc_error("Command '%s' terminated abormally: %d [%m]", + info, status); + } + + if (code == 0 && nc_string_len(*service)) + return 0; + + nc_string_free(service); + return code > 0 ? code : -1; +#else + char path[PATH_MAX + 1] = {'\0'}; + nc_sysconfig_t *sc; + nc_var_t *v; + + snprintf(path, sizeof(path), "%s%s/%s", (ch->root ? ch->root : ""), + _SYSCONFIG_NETWORK_DIR, _CONFIG_GLOBAL); + + sc = nc_sysconfig_read(path); + if(sc) { + v = nc_sysconfig_get(sc, "NETWORKMANAGER"); + if(v && nc_string_eq(v->value, "yes")) { + nc_sysconfig_free(sc); + return nc_string_dup(service, "NetworkManager.service"); + } else { + nc_sysconfig_free(sc); + return nc_string_dup(service, "network.service"); + } + } + return -1; +#endif +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/netcontrol-0.2.6/src/config.h.in new/netcontrol-0.2.7/src/config.h.in --- old/netcontrol-0.2.6/src/config.h.in 2012-07-03 13:17:27.000000000 +0200 +++ new/netcontrol-0.2.7/src/config.h.in 2013-01-25 10:45:47.000000000 +0100 @@ -156,6 +156,9 @@ /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE +/* Check network.service alias instead of NETWORKMANAGER variable */ +#undef __NETCONTROL_USE_SERVICE_ALIAS + /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
