Hello community, here is the log from the commit of package linuxrc for openSUSE:Factory checked in at 2015-10-14 16:41:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2015-10-02 09:23:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.linuxrc.new/linuxrc.changes 2015-10-14 16:41:51.000000000 +0200 @@ -1,0 +2,13 @@ +Thu Oct 8 09:01:25 UTC 2015 - snwint@suse.com + +- ensure ifcfg options don't get lost (bsc#948774) +- 5.0.60 + +------------------------------------------------------------------- +Fri Oct 2 13:56:26 UTC 2015 - snwint@suse.com + +- put udev modprobe rules file into /run so it doesn't get copied into the + final system (bsc#947807) +- 5.0.59 + +------------------------------------------------------------------- Old: ---- linuxrc-5.0.58.tar.xz New: ---- linuxrc-5.0.60.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ linuxrc.spec ++++++ --- /var/tmp/diff_new_pack.ehSywm/_old 2015-10-14 16:41:52.000000000 +0200 +++ /var/tmp/diff_new_pack.ehSywm/_new 2015-10-14 16:41:52.000000000 +0200 @@ -25,7 +25,7 @@ Summary: SUSE Installation Program License: GPL-3.0+ Group: System/Boot -Version: 5.0.58 +Version: 5.0.60 Release: 0 Source: %{name}-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ linuxrc-5.0.58.tar.xz -> linuxrc-5.0.60.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.58/VERSION new/linuxrc-5.0.60/VERSION --- old/linuxrc-5.0.58/VERSION 2015-09-29 11:12:58.000000000 +0200 +++ new/linuxrc-5.0.60/VERSION 2015-10-08 11:00:39.000000000 +0200 @@ -1 +1 @@ -5.0.58 +5.0.60 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.58/changelog new/linuxrc-5.0.60/changelog --- old/linuxrc-5.0.58/changelog 2015-09-29 11:12:58.000000000 +0200 +++ new/linuxrc-5.0.60/changelog 2015-10-08 11:00:39.000000000 +0200 @@ -1,3 +1,10 @@ +2015-10-07: 5.0.60 + - ensure ifcfg options don't get lost (bsc #948774) + +2015-10-02: 5.0.59 + - put udev modprobe rules file into /run so it doesn't get copied into the + final system (bsc #947807) + 2015-09-28: 5.0.58 - Add documentation about how the project is sent to the distribution diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.58/linuxrc.c new/linuxrc-5.0.60/linuxrc.c --- old/linuxrc-5.0.58/linuxrc.c 2015-09-29 11:12:58.000000000 +0200 +++ new/linuxrc-5.0.60/linuxrc.c 2015-10-08 11:00:39.000000000 +0200 @@ -886,10 +886,16 @@ util_redirect_kmsg(); + LXRC_WAIT + util_setup_udevrules(); if(!config.udev_mods) { - system("cp /usr/lib/udev/80-drivers.rules.no_modprobe /etc/udev/rules.d/80-drivers.rules"); + mkdir("/run/udev", 0755); + mkdir("/run/udev/rules.d", 0755); + + system("cp /usr/lib/udev/80-drivers.rules.no_modprobe /run/udev/rules.d/80-drivers.rules"); + LXRC_WAIT } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.58/net.c new/linuxrc-5.0.60/net.c --- old/linuxrc-5.0.58/net.c 2015-09-29 11:12:58.000000000 +0200 +++ new/linuxrc-5.0.60/net.c 2015-10-08 11:00:39.000000000 +0200 @@ -76,6 +76,7 @@ static int net_get_ip(char *text, char **ip, int with_prefix); static int net_check_ip(char *buf, int multi, int with_prefix); static int compare_subnet(char *ip1, char *ip2, unsigned prefix); +static void get_and_copy_ifcfg_flags(ifcfg_t *ifcfg, char *device); /* @@ -251,6 +252,9 @@ } config.ifcfg.manual->dhcp = 0; + + get_and_copy_ifcfg_flags(config.ifcfg.manual, config.ifcfg.manual->device); + ifcfg_write(config.ifcfg.manual->device, config.ifcfg.manual, 0); net_wicked_up(config.ifcfg.manual->device); @@ -1123,6 +1127,8 @@ config.ifcfg.manual->device = s; } + get_and_copy_ifcfg_flags(config.ifcfg.manual, config.ifcfg.manual->device); + net_wicked_dhcp(); return config.net.dhcp_active ? 0 : 1; @@ -1180,6 +1186,8 @@ strprintf(&ifcfg->type, "dhcp%s", type); + ifcfg->flags = config.ifcfg.manual->flags; + ifcfg_write(device, ifcfg, 0); free(ifcfg->type); @@ -2970,3 +2978,56 @@ return ok; } + +/* + * If there's an 'ifcfg' boot option matching 'device', copy any flags + * specified there. + * + * This is used to supply config.ifcfg.manual with ifcfg flags. + */ +void get_and_copy_ifcfg_flags(ifcfg_t *ifcfg, char *device) +{ + ifcfg_t *tmp; + + if(!ifcfg || !device) return; + + ifcfg->flags = slist_free(ifcfg->flags); + + if(config.debug >= 2) fprintf(stderr, "ifcfg flags, before(%s):\n%s", device, ifcfg_print(ifcfg)); + + // 1st try, direct match + for(tmp = config.ifcfg.all; tmp; tmp = tmp->next) { + if(tmp->pattern || !tmp->device) continue; + if(config.debug >= 2) fprintf(stderr, "direct:\n%s", ifcfg_print(tmp)); + if(!strcmp(tmp->device, device)) break; + } + + // 2nd try, tmp->device contains pattern or mac addr + if(!tmp) { + char *mac = interface_to_mac(device); + + for(tmp = config.ifcfg.all; tmp; tmp = tmp->next) { + if(!tmp->pattern || !tmp->device) continue; + if(config.debug >= 2) fprintf(stderr, "pattern:\n%s", ifcfg_print(tmp)); + if(match_netdevice(device, mac, tmp->device)) break; + } + + free(mac); + } + + // match, copy flags + if(tmp) { + slist_t *sl; + + for(sl = tmp->flags; sl; sl = sl->next) { + slist_t *sl1 = slist_append_str(&ifcfg->flags, sl->key); + str_copy(&sl1->value, sl->value); + } + + if(config.debug >= 2) fprintf(stderr, "ifcfg flags, matched:\n%s", ifcfg_print(ifcfg)); + } + else { + if(config.debug >= 2) fprintf(stderr, "ifcfg flags, no match\n"); + } +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.58/util.c new/linuxrc-5.0.60/util.c --- old/linuxrc-5.0.58/util.c 2015-09-29 11:12:58.000000000 +0200 +++ new/linuxrc-5.0.60/util.c 2015-10-08 11:00:39.000000000 +0200 @@ -4440,7 +4440,32 @@ /* - * Interal function, use mac_to_interface(). + * Get mac address from network interface name. + * + * return value must be freed + */ +char *interface_to_mac(char *device) +{ + char *buf = NULL; + + if(!device) return NULL; + + strprintf(&buf, "/sys/class/net/%s/address", device); + + char *addr = util_get_attr(buf); + + if(!strcmp(addr, "00:00:00:00:00:00")) *addr = 0; + + if(config.debug) fprintf(stderr, "if_to_mac: %s = %s\n", device, addr); + + str_copy(&buf, addr ?: NULL); + + return buf; +} + + +/* + * Internal function, use mac_to_interface(). * * return value must be freed */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.58/util.h new/linuxrc-5.0.60/util.h --- old/linuxrc-5.0.58/util.h 2015-09-29 11:12:58.000000000 +0200 +++ new/linuxrc-5.0.60/util.h 2015-10-08 11:00:39.000000000 +0200 @@ -144,6 +144,7 @@ int fcoe_check(void); int iscsi_check(void); +char *interface_to_mac(char *device); char *mac_to_interface(char *mac, int *max_offset); void util_run_script(char *name);