Hello community, here is the log from the commit of package linuxrc for openSUSE:Factory checked in at 2014-08-11 10:06:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/linuxrc (Old) and /work/SRC/openSUSE:Factory/.linuxrc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "linuxrc" Changes: -------- --- /work/SRC/openSUSE:Factory/linuxrc/linuxrc.changes 2014-08-07 08:07:40.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.linuxrc.new/linuxrc.changes 2014-08-11 10:07:01.000000000 +0200 @@ -1,0 +2,8 @@ +Fri Aug 8 11:15:44 CEST 2014 - [email protected] + +- set WAIT_FOR_INTERFACES (bnc #890643) +- allow global network config options that should go to + /etc/sysconfig/network/config to be set in ifcfg option +- 5.0.11 + +------------------------------------------------------------------- Old: ---- linuxrc-5.0.10.tar.xz New: ---- linuxrc-5.0.11.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ linuxrc.spec ++++++ --- /var/tmp/diff_new_pack.iYtruC/_old 2014-08-11 10:07:02.000000000 +0200 +++ /var/tmp/diff_new_pack.iYtruC/_new 2014-08-11 10:07:02.000000000 +0200 @@ -25,9 +25,9 @@ Summary: SUSE Installation Program License: GPL-3.0+ Group: System/Boot -Version: 5.0.10 +Version: 5.0.11 Release: 0 -Source: linuxrc-5.0.10.tar.xz +Source: linuxrc-5.0.11.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build %description ++++++ linuxrc-5.0.10.tar.xz -> linuxrc-5.0.11.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.10/VERSION new/linuxrc-5.0.11/VERSION --- old/linuxrc-5.0.10/VERSION 2014-08-06 16:19:02.000000000 +0200 +++ new/linuxrc-5.0.11/VERSION 2014-08-08 11:15:33.000000000 +0200 @@ -1 +1 @@ -5.0.10 +5.0.11 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.10/changelog new/linuxrc-5.0.11/changelog --- old/linuxrc-5.0.10/changelog 2014-08-06 16:19:11.000000000 +0200 +++ new/linuxrc-5.0.11/changelog 2014-08-08 11:15:38.000000000 +0200 @@ -1,4 +1,12 @@ -2014-08-06: HEAD +2014-08-08: HEAD + - Merge pull request #20 from openSUSE/sw_0008 + - Enhance linuxrc network code a bit. + - Enhance linuxrc network code a bit. + - set WAIT_FOR_INTERFACES (bnc #890643) + - allow global network config options that should go to + /etc/sysconfig/network/config to be set in ifcfg option + +2014-08-06: 5.0.10 - Merge pull request #19 from openSUSE/sw_0007 - Sw 0007 - add new 'sshd' option to start sshd during install but don't trigger a ssh installation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.10/file.c new/linuxrc-5.0.11/file.c --- old/linuxrc-5.0.10/file.c 2014-08-06 16:18:39.000000000 +0200 +++ new/linuxrc-5.0.11/file.c 2014-08-08 11:15:01.000000000 +0200 @@ -145,8 +145,8 @@ { key_info, "Info", kf_cfg + kf_cmd_early }, { key_proxy, "Proxy", kf_cfg + kf_cmd }, { key_usedhcp, "UseDHCP", kf_cfg + kf_cmd }, - { key_dhcptimeout, "DHCPTimeout", kf_cfg + kf_cmd }, - { key_dhcptimeout, "WickedTimeout", kf_cfg + kf_cmd }, + { key_dhcptimeout, "DHCPTimeout", kf_cfg + kf_cmd_early }, + { key_dhcptimeout, "WickedTimeout", kf_cfg + kf_cmd_early }, { key_tftptimeout, "TFTPTimeout", kf_cfg + kf_cmd }, { key_tmpfs, "_TmpFS", kf_cmd }, { key_netstop, "NetStop", kf_cfg + kf_cmd }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.10/global.h new/linuxrc-5.0.11/global.h --- old/linuxrc-5.0.10/global.h 2014-08-06 16:18:39.000000000 +0200 +++ new/linuxrc-5.0.11/global.h 2014-08-08 11:15:01.000000000 +0200 @@ -637,6 +637,7 @@ slist_t *if_state; /* config state of network interfaces */ slist_t *if_up; /* network interfaces != lo that are 'up' */ char *current; /* interface name for last written ifcfg file */ + slist_t *to_global; /* keys that go to global /etc/sysconfig/network/config */ } ifcfg; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.10/linuxrc.c new/linuxrc-5.0.11/linuxrc.c --- old/linuxrc-5.0.10/linuxrc.c 2014-08-06 16:18:39.000000000 +0200 +++ new/linuxrc-5.0.11/linuxrc.c 2014-08-08 11:15:01.000000000 +0200 @@ -939,6 +939,9 @@ } } + // set up config key list + net_wicked_get_config_keys(); + util_run_script("early_setup"); if(config.plymouth) util_run_script("plymouth_setup"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.10/net.c new/linuxrc-5.0.11/net.c --- old/linuxrc-5.0.10/net.c 2014-08-06 16:18:39.000000000 +0200 +++ new/linuxrc-5.0.11/net.c 2014-08-08 11:15:01.000000000 +0200 @@ -2083,6 +2083,7 @@ slist_t *sl; slist_t *sl_ifcfg = NULL; slist_t *sl_ifroute = NULL; + slist_t *sl_global = NULL; unsigned ptp = 0; // obsolete: use global values @@ -2104,6 +2105,12 @@ ptp |= ifcfg->ptp; + // set wicked timeout + if(config.net.dhcp_timeout_set) { + sl = slist_append_str(&sl_global, "WAIT_FOR_INTERFACES"); + strprintf(&sl->value, "%d", config.net.dhcp_timeout); + } + // 1. maybe dhcp config if(ifcfg->dhcp) { @@ -2186,8 +2193,13 @@ } } - for (sl = ifcfg->flags; sl; sl = sl->next) { - if(!(sl1 = slist_getentry(sl_ifcfg, sl->key))) sl1 = slist_append(&sl_ifcfg, slist_new()); + for(sl = ifcfg->flags; sl; sl = sl->next) { + if(slist_getentry(config.ifcfg.to_global, sl->key)) { + if(!(sl1 = slist_getentry(sl_global, sl->key))) sl1 = slist_append(&sl_global, slist_new()); + } + else { + if(!(sl1 = slist_getentry(sl_ifcfg, sl->key))) sl1 = slist_append(&sl_ifcfg, slist_new()); + } str_copy(&sl1->key, sl->key); str_copy(&sl1->value, sl->value); } @@ -2248,40 +2260,58 @@ // 4. set nameserver and search list if(!is_dhcp) { - if(ns || domain) { - fprintf(stderr, "adjusting network/config:\n"); - if(ns) fprintf(stderr, " NETCONFIG_DNS_STATIC_SERVERS=\"%s\"\n", ns); - if(domain) fprintf(stderr, " NETCONFIG_DNS_STATIC_SEARCHLIST=\"%s\"\n", domain); - - if((fp = fopen("/etc/sysconfig/network/config", "r"))) { - if((fp2 = fopen("/etc/sysconfig/network/config.tmp", "w"))) { - char buf[1024]; - - while(fgets(buf, sizeof buf, fp)) { - if( - domain && - !strncmp(buf, "NETCONFIG_DNS_STATIC_SEARCHLIST=", sizeof "NETCONFIG_DNS_STATIC_SEARCHLIST=" - 1) - ) { - fprintf(fp2, "NETCONFIG_DNS_STATIC_SEARCHLIST=\"%s\"\n", domain); - } - else if( - ns && - !strncmp(buf, "NETCONFIG_DNS_STATIC_SERVERS=", sizeof "NETCONFIG_DNS_STATIC_SERVERS=" - 1) - ) { - fprintf(fp2, "NETCONFIG_DNS_STATIC_SERVERS=\"%s\"\n", ns); - } - else { - fputs(buf, fp2); + // if user has set NETCONFIG_* via flags, keep it + + if(ns && !slist_getentry(sl_global, "NETCONFIG_DNS_STATIC_SERVERS")) { + sl = slist_append_str(&sl_global, "NETCONFIG_DNS_STATIC_SERVERS"); + str_copy(&sl->value, ns); + } + + if(domain && !slist_getentry(sl_global, "NETCONFIG_DNS_STATIC_SEARCHLIST")) { + sl = slist_append_str(&sl_global, "NETCONFIG_DNS_STATIC_SEARCHLIST"); + str_copy(&sl->value, domain); + } + } + + // 5. update global network config + + if(sl_global) { + fprintf(stderr, "adjusting network/config:\n"); + + // it's easier below if we append the '=' to the keys + for(sl = sl_global; sl; sl = sl->next) { + strprintf(&sl->key, "%s=", sl->key); + } + + if((fp = fopen("/etc/sysconfig/network/config", "r"))) { + char buf[4096]; + + // we allow open to fail and check fp2 for NULL later + fp2 = fopen("/etc/sysconfig/network/config.tmp", "w"); + + while(fgets(buf, sizeof buf, fp)) { + if(*buf && *buf != '#' && !isspace(*buf)) { + for(sl = sl_global; sl; sl = sl->next) { + if(!strncmp(buf, sl->key, strlen(sl->key))) { + fprintf(stderr, " %s\"%s\"\n", sl->key, sl->value); + if(fp2) fprintf(fp2, "%s\"%s\"\n", sl->key, sl->value); + *buf = 0; + break; } } - - fclose(fp2); } + if(*buf && fp2) fputs(buf, fp2); + } - fclose(fp); + fclose(fp); + if(fp2) { + fclose(fp2); rename("/etc/sysconfig/network/config.tmp", "/etc/sysconfig/network/config"); } + else { + fprintf(stderr, "warning: /etc/sysconfig/network/config not updated\n"); + } } } @@ -2290,6 +2320,7 @@ str_copy(&domain, NULL); str_copy(&vlan, NULL); + slist_free(sl_global); slist_free(sl_ifcfg); slist_free(sl_ifroute); @@ -2669,3 +2700,41 @@ } +/* + * Read network config template and remember keys mentioned there. + * + * This list is used to decide whether to put network config options into + * per interface files ifcfg-* or the global .../config. + */ +void net_wicked_get_config_keys() +{ + file_t *f0, *f1, *f; + slist_t *sl0 = NULL; + + f0 = file_read_file("/etc/sysconfig/network/ifcfg.template", kf_none); + f1 = file_read_file("/etc/sysconfig/network/config", kf_none); + + for(f = f0; f; f = f->next) { + if(*f->key_str && *f->key_str != '#') slist_append_str(&sl0, f->key_str); + } + + /* + * There are keys that can go either into ifcfg-* or config. + * We go for ifcfg-* in these cases. + */ + for(f = f1; f; f = f->next) { + if( + *f->key_str && + *f->key_str != '#' && + !slist_getentry(sl0, f->key_str) + ) { + slist_append_str(&config.ifcfg.to_global, f->key_str); + } + } + + slist_free(sl0); + + file_free_file(f1); + file_free_file(f0); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.10/net.h new/linuxrc-5.0.11/net.h --- old/linuxrc-5.0.10/net.h 2014-07-25 18:13:49.000000000 +0200 +++ new/linuxrc-5.0.11/net.h 2014-08-08 11:15:01.000000000 +0200 @@ -32,3 +32,4 @@ int netmask_to_prefix(char *netmask); int net_config_needed(int really); unsigned check_ptp(char *ifname); +void net_wicked_get_config_keys(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.10/util.c new/linuxrc-5.0.11/util.c --- old/linuxrc-5.0.10/util.c 2014-08-06 16:18:39.000000000 +0200 +++ new/linuxrc-5.0.11/util.c 2014-08-08 11:15:01.000000000 +0200 @@ -1301,6 +1301,16 @@ slist_free(sl_ifcfg); } + if(config.ifcfg.to_global) { + strcpy(buf, "values to store in global network config file:"); + slist_append_str(&sl0, buf); + for(sl = config.ifcfg.to_global; sl; sl = sl->next) { + if(!sl->key) continue; + sprintf(buf, " %s", sl->key); + slist_append_str(&sl0, buf); + } + } + if(config.cdid) { sprintf(buf, "cdrom id = %s", config.cdid); slist_append_str(&sl0, buf); -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
