Hello community, here is the log from the commit of package linuxrc for openSUSE:Factory checked in at 2017-01-19 10:38: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 2016-12-22 15:55:24.576039206 +0100 +++ /work/SRC/openSUSE:Factory/.linuxrc.new/linuxrc.changes 2017-01-19 10:39:00.374078010 +0100 @@ -1,0 +2,16 @@ +Wed Jan 18 14:27:46 UTC 2017 - snw...@suse.com + +- avoid passing uninitialized value +- make md parser happy +- extend repo documentation +- allow reading of config files from instsys location (/boot/ARCH/) (fate#322283) +- 5.0.97 + +------------------------------------------------------------------- +Fri Jan 13 15:27:44 UTC 2017 - snw...@suse.com + +- document linuxrc's repo handling +- have linuxrc accept plain repomd repo as install source (fate#322286) +- 5.0.96 + +------------------------------------------------------------------- @@ -312 +328 @@ -- s390x: handle kvm virtio devices +- s390x: handle kvm virtio devices (bsc#941122) Old: ---- linuxrc-5.0.95.tar.xz New: ---- linuxrc-5.0.97.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ linuxrc.spec ++++++ --- /var/tmp/diff_new_pack.yXSZz8/_old 2017-01-19 10:39:00.993990568 +0100 +++ /var/tmp/diff_new_pack.yXSZz8/_new 2017-01-19 10:39:00.993990568 +0100 @@ -17,7 +17,7 @@ Name: linuxrc -Version: 5.0.95 +Version: 5.0.97 Release: 0 Summary: SUSE Installation Program License: GPL-3.0+ ++++++ linuxrc-5.0.95.tar.xz -> linuxrc-5.0.97.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.95/VERSION new/linuxrc-5.0.97/VERSION --- old/linuxrc-5.0.95/VERSION 2016-12-21 14:28:43.000000000 +0100 +++ new/linuxrc-5.0.97/VERSION 2017-01-18 15:19:23.000000000 +0100 @@ -1 +1 @@ -5.0.95 +5.0.97 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.95/auto2.c new/linuxrc-5.0.97/auto2.c --- old/linuxrc-5.0.95/auto2.c 2016-12-21 14:28:43.000000000 +0100 +++ new/linuxrc-5.0.97/auto2.c 2017-01-18 15:19:23.000000000 +0100 @@ -863,7 +863,7 @@ void auto2_read_repo_files(url_t *url) { int i; - char *dst = NULL; + char *tmp_file = NULL; static char *default_list[][2] = { { "/media.1/info.txt", "/info.txt" }, { "/license.tar.gz", "/license.tar.gz" }, @@ -873,10 +873,19 @@ }; for(i = 0; i < sizeof default_list / sizeof *default_list; i++) { - url_read_file(url, NULL, default_list[i][0], default_list[i][1], NULL, URL_FLAG_NODIGEST); + // be careful not to replace an existing file unless we successfully got + // a new version + str_copy(&tmp_file, new_download()); + if( + !url_read_file(url, NULL, default_list[i][0], tmp_file, NULL, URL_FLAG_NODIGEST + URL_FLAG_OPTIONAL) && + util_check_exist(tmp_file) + ) { + rename(tmp_file, default_list[i][1]); + log_info("mv %s -> %s\n", tmp_file, default_list[i][1]); + } } - str_copy(&dst, NULL); + str_copy(&tmp_file, NULL); if(!config.autoyast) { if(util_check_exist("/tmp/autoinst.xml")) rename("/tmp/autoinst.xml", "/autoinst.xml"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.95/changelog new/linuxrc-5.0.97/changelog --- old/linuxrc-5.0.95/changelog 2016-12-21 14:28:43.000000000 +0100 +++ new/linuxrc-5.0.97/changelog 2017-01-18 15:19:23.000000000 +0100 @@ -1,3 +1,13 @@ +2017-01-18: 5.0.97 + - avoid passing uninitialized value + - make md parser happy + - extend repo documentation + - allow reading of config files from instsys location (/boot/ARCH/) (fate #322283) + +2017-01-13: 5.0.96 + - document linuxrc's repo handling + - have linuxrc accept plain repomd repo as install source (fate #322286) + 2016-12-21: 5.0.95 - cleanup include list in install.c - add linuxrc.core option to enable core dumps in linuxrc (to debug bsc #1010505) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.95/linuxrc_repo.md new/linuxrc-5.0.97/linuxrc_repo.md --- old/linuxrc-5.0.95/linuxrc_repo.md 1970-01-01 01:00:00.000000000 +0100 +++ new/linuxrc-5.0.97/linuxrc_repo.md 2017-01-18 15:19:23.000000000 +0100 @@ -0,0 +1,183 @@ +#specifying installation repositories in linuxrc + +##1. regular install media + +*(repo meta data are in /suse/setup/descr/)* + +linuxrc identifies this repo by checking for a file '/content' in the +installation repository. The file must have a valid signature +('/content.asc'). linuxrc parses this file for sha* digests (the `HASH` lines). +These digests are used to verify any files linuxrc accesses from the +installation repository. + +To specify the installation repository, use the `install` option: + +```sh +install=ftp://example.com/foo +``` + +linuxrc also loads a file system image containing the installation system +(`YaST`) from the repository. The default location is `boot/<ARCH>/root`. + +In the example above on `x86_64` this would be `ftp://example.com/foo/boot/x86_64/root`.) + +It is possible to specify a different location (e.g. in case the +installation system is not part of the repository) using the `instsys` +option. Either as a separate option or appended to the `install` url: + +```sh +install=ftp://example.com/foo instsys=disk:/bar/root + +# is the same as +install=ftp://example.com/foo?instsys=disk:/bar/root +``` + +`instsys` can be a relative url (a plain file name) which is then interpreted as relative +to the `install`-url: + +```sh +install=ftp://example.com/foo instsys=bar/root + +# is the same as +install=ftp://example.com/foo instsys=ftp://example.com/foo/bar/root +``` + +Note that even though `instsys` can point anywhere, the files downloaded +from there must still match the digests obtained from `/content` from the repository location. + +Note also, that the full path as specified in `content` must appear in the +url. For example, if `content` provides a sha256 digest for `boot/x86_64/root` this will not be applied to +`foo/root`. + + +##2. plain repomd repository + +*(repo meta data are in /repodata/)* + +linuxrc identifies this repo by checking for a file '/repodata/repomd.xml' in +the installation repository. This file's signature is not checked (linuxrc +does not parse this file). + +As there's normally no installation system included in such a repository, +you'll have to pass its location using the `instsys` option. For example, +the openSUSE Tumbleweed repo has repomd data. + +Normally you would use: + +```sh +install=http://download.opensuse.org/tumbleweed/repo/oss +``` + +but you can also use repomd: + +```sh +install=http://download.opensuse.org/tumbleweed/repo/oss/suse instsys=../boot/x86_64/root +``` + +Note that unless you specify also `insecure=1` in the latter case, you'll +get warnings about linuxrc not being able to verify the downloaded images. + +Lets see how to avoid this. + +###2.1. solving the digest problem + +As there's no longer a `content` file, linuxrc needs to get the digests in +some other way. Fortunately it parses `content` just like any other config +file, so you can simply copy it into linuxrc's config directory and add that +to the initrd. + +```sh +mkdir -p /tmp/foo/etc/linuxrc.d +cp content /tmp/foo/etc/linuxrc.d/ +cd /tmp/foo +find . | cpio -o -H newc | xz --check=crc32 -c >>initrd_on_boot_medium +``` + +##3. components linuxrc reads + +linuxrc reads files from two distinct locations: + +1. the installation system ('inst-sys') +2. the installation repository ('repo') + +The repo location is specified with the `install` option. Optionally, the inst-sys location is specified +with the `instsys` option. If it's not given, it is implicitly assumed to be `boot/<ARCH>/root`, relative to the +repo location. + +See the previous sections for examples. + +###3.1. files read from inst-sys location + +linuxrc replaces the last path component from the location url with `config` +to get the url of a config file and tries to read it. + +If the config file is *not* there, linuxrc will continue to read the inst-sys image as originally specified and mount it. + +If the config file was found (the normal case) it is parsed to determine the +components needed for the inst-sys and then the components are loaded. + +A simple config file may look like: + +```sh +# boot/x86_64/config + +root: common root bind +rescue: common rescue + +``` + +Meaning that the `root` image consists of three files `common`, `root`, and `bind` and the `rescue` image of two parts +`common` and `rescue`. So, assuming the standard locations, +linuxrc will load `boot/<ARCH>/common`, `boot/<ARCH>/root`, and `boot/<ARCH>/bind` in the first case and +`boot/<ARCH>/common` and `boot/<ARCH>/rescue` in the second. + +More general the syntax is: + +```sh +part: sub_part1 sub_part2 ... +sub_part1: sub_sub_part11 sub_sub_part12 ... +``` + +You can modify a part specification by: + +1. prefixing it with `?` to mark it optional +2. appending `?list=path_spec1,path_spec2,...` to indicate you need not the +full image but only the files matching any of the path specs (shell glob +syntax) +3. appending `?copy=1` to indicate that this is not an image or archive to mount or unpack but a +plain file to copy to the `/` directory +4. using `<lang>` (verbatim!) as macro to be replaced by the current locale + +With this in mind a more realistic config file example could look like: + +```sh +root: common root bind ?cracklib-dict-full.rpm ?yast2-trans-<lang>.rpm ?configfiles +rescue: common rescue ?cracklib-dict-full.rpm +configfiles: control.xml?copy=1 +yast2-trans-ko.rpm: yast2-trans-ko.rpm un-fonts.rpm?list=*/UnDotum.ttf + +``` + +Here, the inst-sys would consist of `common`, `root`, `bind`, `cracklib-dict-full.rpm` (if it exists), +`yast2-trans-en_US.rpm` (if it exists and assuming current locale is `en_US`), and additionally (if it exists), +`control.xml` is downloaded and stored as `/control.xml`. + +For the Korean locale we'll need also a special font rpm (`un-fonts.rpm`) but only `UnDotum.ttf` from it. + +###3.2. files read from repo location + +In addition to the files described in sections 1. and 2., linuxrc will try to read these files (and store them in `/`): + +- `/media.1/info.txt` +- `/license.tar.gz` +- `/part.info` +- `/control.xml` + +and, if **no** `AutoYaST` option has been given, it will read **and parse** + +- `/autoinst.xml` + +and then add an `AutoYaST` option pointing to the downloaded file. + +Note this happens **after** downloading the files in section 3.1. and may overwrite them. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.95/url.c new/linuxrc-5.0.97/url.c --- old/linuxrc-5.0.95/url.c 2016-12-21 14:28:43.000000000 +0100 +++ new/linuxrc-5.0.97/url.c 2017-01-18 15:19:23.000000000 +0100 @@ -2148,7 +2148,7 @@ */ static int test_is_repo(url_t *url) { - int ok = 0, i, opt, parts, part; + int ok = 0, i, opt, copy, parts, part; char *buf = NULL, *buf2 = NULL, *file_name, *s, *t; char *instsys_config; slist_t *sl, *file_list, *old_file_list; @@ -2162,9 +2162,12 @@ ) return 0; if(!config.keepinstsysconfig) { - config.digests.list = slist_free(config.digests.list); config.digests.failed = 0; + // check for '/content' or '/repodata/repomd.xml' as indication we have a suse repo + // 'content' must be validly signed (we parse it), 'repomd.xml' not (we just check its presence) + // zenworks has a different approach ('settings.txt') - they don't have a repo + strprintf(&buf, "/%s", config.zen ? config.zenconfig : "content"); strprintf(&buf2, "file:%s", buf); @@ -2172,9 +2175,19 @@ url_read_file(url, NULL, buf, buf, NULL, URL_FLAG_NODIGEST + (config.secure ? URL_FLAG_CHECK_SIG : 0) ) - ) return 0; + ) { + if(config.zen) return 0; - if(!config.sig_failed) { + // no content file -> also check for repomd.xml + // note: we don't parse repomd.xml, just check it exists + char *tmp_repomd = "/tmp/repomd.xml"; + int read_failed = url_read_file(url, NULL, "/repodata/repomd.xml", tmp_repomd, NULL, URL_FLAG_NODIGEST); + unlink(tmp_repomd); + + if(read_failed) return 0; + } + + if(!config.sig_failed && util_check_exist(buf)) { file_read_info_file(buf2, config.zen ? kf_cont + kf_cfg : kf_cont); } @@ -2238,6 +2251,7 @@ for(ok = 1, part = 1, sl = config.url.instsys_list; ok && sl; sl = sl->next, part++) { opt = *(s = sl->key) == '?' && s++; + copy = strstr(s, "?copy=1") ? 1 : 0; t = url_config_get_path(s); file_list = url_config_get_file_list(s); @@ -2256,19 +2270,27 @@ if( url->is.mountable && - (util_is_mountable(buf) || !util_check_exist(buf)) && + (copy || util_is_mountable(buf) || !util_check_exist(buf)) && !config.rescue && (!config.download.instsys || util_check_exist(buf) == 'd') ) { if(!util_check_exist(buf) && opt) { - log_info("mount %s -> %s failed (ignored)\n", buf, sl->value); + log_info("%s %s -> %s failed (ignored)\n", copy ? "copy" : "mount", buf, sl->value); } else { - log_info("mount %s -> %s\n", buf, sl->value); - - i = util_mount_ro(buf, sl->value, url->file_list) ? 0 : 1; - ok &= i; - if(!i) log_info("instsys mount failed: %s\n", sl->value); + if(copy) { + char *dst = strrchr(t, '/') ?: t; + log_info("copy %s -> %s\n", buf, dst); + i = !util_cp_main(3, (char *[]) {0, buf, dst}); + ok &= i; + if(!i) log_info("adding %s to instsys failed\n", dst); + } + else { + log_info("mount %s -> %s\n", buf, sl->value); + i = util_mount_ro(buf, sl->value, url->file_list) ? 0 : 1; + ok &= i; + if(!i) log_info("instsys mount failed: %s\n", sl->value); + } } } else { @@ -2288,11 +2310,19 @@ buf2, URL_FLAG_PROGRESS + URL_FLAG_UNZIP + opt * URL_FLAG_OPTIONAL )) { - log_info("mount %s -> %s\n", file_name, sl->value); - - i = util_mount_ro(file_name, sl->value, url->file_list) ? 0 : 1; - ok &= i; - if(!i) log_info("instsys mount failed: %s\n", sl->value); + if(copy) { + char *dst = strrchr(t, '/') ?: t; + log_info("mv %s -> %s\n", file_name, dst); + i = !rename(file_name, dst); + ok &= i; + if(!i) log_info("adding %s to instsys failed\n", dst); + } + else { + log_info("mount %s -> %s\n", file_name, sl->value); + i = util_mount_ro(file_name, sl->value, url->file_list) ? 0 : 1; + ok &= i; + if(!i) log_info("instsys mount failed: %s\n", sl->value); + } } else { log_info("download failed: %s%s\n", sl->value, opt ? " (ignored)" : "");