Hello community, here is the log from the commit of package linuxrc for openSUSE:Factory checked in at 2017-05-04 08:53:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/linuxrc (Old) and /work/SRC/openSUSE:Factory/.linuxrc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "linuxrc" Thu May 4 08:53:25 2017 rev:239 rq:491834 version:5.0.102 Changes: -------- --- /work/SRC/openSUSE:Factory/linuxrc/linuxrc.changes 2017-04-18 13:47:35.590292251 +0200 +++ /work/SRC/openSUSE:Factory/.linuxrc.new/linuxrc.changes 2017-05-04 08:53:34.415998534 +0200 @@ -1,0 +2,15 @@ +Fri Apr 28 12:12:04 UTC 2017 - [email protected] + +- read license.tar.gz from repomd repositories (fate#322286) +- merge gh#openSUSE/linuxrc#139 +- some small fixes +- 5.0.102 + +-------------------------------------------------------------------- +Tue Apr 25 14:22:17 UTC 2017 - [email protected] + +- merge gh#openSUSE/linuxrc#138 +- enhance linuxrc documentation +- 5.0.101 + +-------------------------------------------------------------------- Old: ---- linuxrc-5.0.100.tar.xz New: ---- linuxrc-5.0.102.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ linuxrc.spec ++++++ --- /var/tmp/diff_new_pack.aWtjIL/_old 2017-05-04 08:53:37.323588480 +0200 +++ /var/tmp/diff_new_pack.aWtjIL/_new 2017-05-04 08:53:37.327587916 +0200 @@ -17,7 +17,7 @@ Name: linuxrc -Version: 5.0.100 +Version: 5.0.102 Release: 0 Summary: SUSE Installation Program License: GPL-3.0+ @@ -49,6 +49,6 @@ %{_sbindir}/linuxrc %{_bindir}/mkpsfu %{_datadir}/linuxrc -%doc COPYING *.html *.md *.txt +%doc COPYING *.html *.md *.txt *.png %changelog ++++++ linuxrc-5.0.100.tar.xz -> linuxrc-5.0.102.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/README.md new/linuxrc-5.0.102/README.md --- old/linuxrc-5.0.100/README.md 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/README.md 2017-04-28 14:12:04.000000000 +0200 @@ -1,10 +1,57 @@ -This is the early part of the SUSE installation process, before -[YaST](https://en.opensuse.org/Portal:YaST) runs. +# linuxrc -See <https://en.opensuse.org/SDB:Linuxrc>. +linuxrc is run as the first part of the SUSE installation process, right +after the linux kernel has been loaded - before +the installer [YaST](https://en.opensuse.org/Portal:YaST) runs. -## Requirements -Building linuxrc will require some additional dependencies. +Its task is to setup the installation environment, download the installer YaST, and start the installation. +Normally it does everything automatically and you don't see anything of linuxrc except for some status messages. + +But there is also a manual mode where it presents you with a set of menus to setup the installation environment +and start the installation. + +You can activate this mode by booting with the boot option `manual=1`. + +There are actually two variants. One is a curses-like interface that looks like this: + + + +The other is much simpler for line-oriented terminals. It is enabled with the option `linemode=1` and looks like this: + +``` +>>> linuxrc 5.0.99 (Kernel 4.10.8-1-default) <<< + +Main Menu + +0) <-- Back <-- +1) Start Installation +2) Settings +3) Expert +4) Exit or Reboot + +> 1 + +Start Installation + +0) <-- Back <-- +1) Installation +2) Upgrade +3) Rescue System +4) Boot Installed System +5) Network Setup + +> +``` + +Both variants are functionally identical. You can use the one that suits you best, + +As you've noticed, linuxrc can be controlled using a number of boot options. Quite a big number, actually. + +In fact, linuxrc's functionality is fully covered by boot options. See [SBD:Linuxrc](https://en.opensuse.org/SDB:Linuxrc) +for reference. + +## Build Requirements +Compiling linuxrc will require some additional dependencies. For example on openSUSE/SUSE distributions run: ```sh @@ -12,29 +59,64 @@ ``` ## Debugging -### Run on Installed System -Linuxrc can run on installed system. It runs in testmode that make debugging easier. -Parameters are passed as common parametrs like: `linuxrc linemode=0 manual=1 linuxrc.debug=1` +### Running on a normal system + +Linuxrc can be run on a normal system. It detects this and runs in a test mode, trying not to disrupt your system too much. +For instance, it will not configure your network and be very careful not to take over your system in any way.. -### Useful Shortcuts +This also means you cannot test everything this way (for example the network setup code). -* ctrl+c then 'q' - exit linuxrc +When you run linuxrc on a normal system, parameters are passed as commandline parameters, for example: -* ctrl+c then 'c' - change config +```sh +linuxrc linemode=0 manual=1 linuxrc.debug=1 +``` -* ctrl+c then 'i' - show info detected by linuxrc +When running it the first time you might notice that there's no obvious way to exit linuxrc. So, here are a few tips: -* ctrl+c then 's' - start shell +> ### Useful Shortcuts +> +> **In Window-Mode** (`linemode=0`) +> +> * ctrl+c then 'q' - exit linuxrc +> * ctrl+c then 'c' - change config +> * ctrl+c then 'i' - show info detected by linuxrc +> * ctrl+c then 's' - start shell +> +> **In Line-Mode** (`linemode=1`) +> +> * There's a hidden menu available. You can reach it by entering the letter `x` (instead of a number) from any menu. +> This menu looks like this: +> +> ``` +> Linuxrc extras +> +> 0) <-- Back <-- +> 1) Show config +> 2) Change config +> 3) Start shell +> 4) Run command +> 5) Quit linuxrc +> +> > +> ``` ### Logging -Linuxrc logs to /var/log/linuxrc.log. + +linuxrc logs to /var/log/linuxrc.log. To capture a log with maximum verbosity, including the source code location of the logging call, use these linuxrc params: -`linuxrc.debug=4,trace`. -Linuxrc will also try to log (less verbose) to /dev/tty3. You can redirect this to another location if you need. +```sh +linuxrc.debug=4,trace +``` + +linuxrc will also try to log (less verbose) to /dev/tty3. You can redirect this to another location if you need. For example, on a serial console it might be helpful to log to the current console: -`linuxrc.log=/dev/console`. + +``` +linuxrc.log=/dev/console +``` ## Testing the Installation @@ -60,6 +142,7 @@ cp linuxrc /tmp/initrd/init mksusecd --initrd /tmp/initrd --create $OUTPUT_ISO $INPUT ``` + Forgetting about the correct shared libraries usually leads to crashes and backtraces printed on the terminal. When compiling linuxrc on a system different from the one in the input iso, make sure that shared libraries are passed with matching versions; typically you'll need libreadline.so and libhd.so but your mileage may vary. In the following example, linuxrc was compiled on Leap 42.1 to build against Tumbleweed; the versions of the two libraries were not matching on the two versions of openSUSE so the correct versions (including symlinks) were attached with `mksusecd` using the following folder structure: @@ -82,6 +165,17 @@ You may also use `mksusecd --micro` in case you only want to test Stage 1 and not a full install. +## Further Reading + +The general documentation from a user's perspective is in the openSUSE SDB: [SBD:Linuxrc](https://en.opensuse.org/SDB:Linuxrc). + +More technical aspects for developers are here: + +- [repository handling](linuxrc_repo.md) +- [hostname setting](linuxrc_hostname.md) +- [interface to YaST](linuxrc_yast_interface.txt) (via `/etc/install.inf`) +- [defining URL schemas](user_defined_url_schemes.txt) (via shell scripts) + ## openSUSE Development The package is automatically submitted from the `master` branch to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/VERSION new/linuxrc-5.0.102/VERSION --- old/linuxrc-5.0.100/VERSION 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/VERSION 2017-04-28 14:12:04.000000000 +0200 @@ -1 +1 @@ -5.0.100 +5.0.102 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/auto2.c new/linuxrc-5.0.102/auto2.c --- old/linuxrc-5.0.100/auto2.c 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/auto2.c 2017-04-28 14:12:04.000000000 +0200 @@ -37,6 +37,7 @@ static int driver_is_active(hd_t *hd); static void auto2_progress(char *pos, char *msg); static void auto2_read_repo_files(url_t *url); +static void auto2_read_repomd_files(url_t *url); static char *auto2_splash_name(void); static void auto2_kexec(url_t *url); @@ -601,7 +602,10 @@ } /* get some files for lazy yast */ - if(!err) auto2_read_repo_files(config.url.install); + if(!err) { + if(config.repomd) auto2_read_repomd_files(config.url.install); + auto2_read_repo_files(config.url.install); + } if(err) { log_info("no %s repository found\n", config.product); @@ -904,6 +908,41 @@ } +/* + * Get various files from repo-md repositrory for yast's convenience. + * + * Well, atm it's just license.tar.gz. + */ +void auto2_read_repomd_files(url_t *url) +{ + int i; + char *tmp_file = NULL; + static char *default_list[][2] = { + { "license", "/license.tar.gz" }, + }; + + for(i = 0; i < sizeof default_list / sizeof *default_list; i++) { + // be careful not to replace an existing file unless we successfully got + // a new version + + // get real file name + slist_t *sl = slist_getentry(config.repomd_data, default_list[i][0]); + if(!sl) continue; + + str_copy(&tmp_file, new_download()); + if( + !url_read_file(url, NULL, sl->value, tmp_file, NULL, URL_FLAG_NODIGEST) && + 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(&tmp_file, NULL); +} + + /* * Return splash file name (or NULL if not appropriate). */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/changelog new/linuxrc-5.0.102/changelog --- old/linuxrc-5.0.100/changelog 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/changelog 2017-04-28 14:12:04.000000000 +0200 @@ -1,3 +1,10 @@ +2017-04-28: 5.0.102 + - some small fixes + - read license.tar.gz from repomd repositories (fate #322286) + +2017-04-25: 5.0.101 + - enhance linuxrc documentation + 2017-04-13: 5.0.100 - fix segfault when loading installer (bsc #1033441) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/file.c new/linuxrc-5.0.102/file.c --- old/linuxrc-5.0.100/file.c 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/file.c 2017-04-28 14:12:04.000000000 +0200 @@ -2546,31 +2546,29 @@ } -slist_t *file_parse_xmllike(char *name, char *tag) +/* + * *Very* limited xml parsing. + * + * Returns a list of elements; 'key' is the (complete) attribute info + * belonging to the element, 'value' is the element content. + * + * Elements without attribute cannot be matched. + * + * buf: buffer to parse + * tag: elements name to look for + */ +slist_t *file_parse_xmllike_buf(char *buf, char *tag) { slist_t *sl, *sl0 = NULL; - FILE *f; - char *buf = NULL, *tag_start = NULL, *tag_end = NULL; + char *tag_start = NULL, *tag_end = NULL; char *attr = NULL, *data = NULL; - int buf_size = 0, buf_ptr = 0, i; + int i; char *ptr, *s0, *s1; - if(!tag) return sl0; - - if(!(f = fopen(name, "r"))) return sl0; - - do { - buf = realloc(buf, buf_size += 0x1000); - i = fread(buf + buf_ptr, 1, buf_size - buf_ptr - 1, f); - buf_ptr += i; - } - while(buf_ptr == buf_size - 1); - - buf[buf_ptr] = 0; - - fclose(f); + if(!tag || !buf || !*buf) return sl0; - if(!(buf_size = buf_ptr)) return sl0; + // we're going to modify the buffer + buf = strdup(buf); strprintf(&tag_start, "<%s ", tag); strprintf(&tag_end, "</%s>", tag); @@ -2618,3 +2616,81 @@ return sl0; } + +/* + * Very limited xml parsing. + * + * Returns a list of elements; cf. file_parse_xmllike_buf(). + * + * name: name of file to read + * tag: elements name to look for + */ +slist_t *file_parse_xmllike(char *name, char *tag) +{ + slist_t *sl0 = NULL; + FILE *f; + char *buf = NULL; + int buf_size = 0, buf_ptr = 0, i; + + if(!tag) return sl0; + + if(!(f = fopen(name, "r"))) return sl0; + + do { + buf = realloc(buf, buf_size += 0x1000); + i = fread(buf + buf_ptr, 1, buf_size - buf_ptr - 1, f); + buf_ptr += i; + } + while(buf_ptr == buf_size - 1); + + buf[buf_ptr] = 0; + + fclose(f); + + sl0 = file_parse_xmllike_buf(buf, tag); + + free(buf); + + return sl0; +} + + +/* + * Parse repomd data. + * + * - add file digest info to config.digests.list + * - associate 'types' to file names (e.g. 'license' -> 'XXX-license.tar.gz' + * (stored in config.repomd_data) + */ +void file_parse_repomd(char *file) +{ + slist_t *repo, *sl, *sl_chk, *sl_digest, *sl_data; + char buf_digest[256], buf_type[256], buf_loc[256], *s; + + repo = file_parse_xmllike(file, "data"); + + for(sl = repo; sl; sl = sl->next) { + if(sscanf(sl->key, "type=\"%255[^\"]\"", buf_type) == 1) { + if((sl_chk = file_parse_xmllike_buf(sl->value, "checksum"))) { + if(sscanf(sl_chk->key, "type=\"%255[^\"]\"", buf_digest) == 1) { + if( + (s = strstr(sl->value, "<location href=")) && + sscanf(s, "<location href=\"%255[^\"]\"", buf_loc) == 1 + ) { + sl_digest = slist_append(&config.digests.list, slist_new()); + strprintf(&sl_digest->key, "%s %s", buf_digest, sl_chk->value); + str_copy(&sl_digest->value, buf_loc); + + sl_data = slist_append_str(&config.repomd_data, buf_type); + str_copy(&sl_data->value, buf_loc); + } + } + } + + slist_free(sl_chk); + } + } + + slist_free(repo); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/file.h new/linuxrc-5.0.102/file.h --- old/linuxrc-5.0.100/file.h 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/file.h 2017-04-28 14:12:04.000000000 +0200 @@ -105,4 +105,5 @@ void file_do_info(file_t *f0, file_key_flag_t flags); void get_ide_options(void); slist_t *file_parse_xmllike(char *name, char *tag); +void file_parse_repomd(char *file); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/global.h new/linuxrc-5.0.102/global.h --- old/linuxrc-5.0.100/global.h 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/global.h 2017-04-28 14:12:04.000000000 +0200 @@ -445,6 +445,7 @@ unsigned upgrade:1; /**< upgrade or fresh install */ unsigned systemboot:1; /**< boot installed system */ unsigned extend_running:1; /**< currently running an 'extend' job */ + unsigned repomd:1; /**< install repo is repo-md */ struct { unsigned check:1; /**< check for braille displays and start brld if found */ char *dev; /**< braille device */ @@ -518,6 +519,7 @@ unsigned self_update:1; /**< enables YaST self-update feature */ char *core; /**< linuxrc code dump destination (core dumps disabled if unset) */ unsigned core_setup:1; /**< linuxrc core dumps have been configured */ + slist_t *repomd_data; /**< parsed repomd.xml info */ struct { unsigned md5:1; /**< support md5 */ Binary files old/linuxrc-5.0.100/linuxrc.png and new/linuxrc-5.0.102/linuxrc.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/linuxrc_hostname.md new/linuxrc-5.0.102/linuxrc_hostname.md --- old/linuxrc-5.0.100/linuxrc_hostname.md 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/linuxrc_hostname.md 2017-04-28 14:12:04.000000000 +0200 @@ -1,4 +1,4 @@ -#hostname setting in installation/rescue system +# hostname setting in installation/rescue system There are 3 cases: @@ -11,7 +11,7 @@ linuxrc defaults to `install`, which may be overridden by dhcp (2) or user (3). (3) takes precedence over (2). -##installation system +## installation system When yast is started, the value from (3) is passed to yast via `/etc/install.inf::Hostname` and ends up in `/etc/hostname` of the installed system. @@ -22,7 +22,7 @@ There is no `/etc/hostname` file in the installation environment. -##rescue system +## rescue system linuxrc changes the hostname to `rescue`, which may be overridden by user (3). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/linuxrc_repo.md new/linuxrc-5.0.102/linuxrc_repo.md --- old/linuxrc-5.0.100/linuxrc_repo.md 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/linuxrc_repo.md 2017-04-28 14:12:04.000000000 +0200 @@ -1,6 +1,6 @@ -#specifying installation repositories in linuxrc +# specifying installation repositories in linuxrc -##1. regular install media +## 1. regular install media *(repo meta data are in /suse/setup/descr/)* @@ -50,7 +50,7 @@ `foo/root`. -##2. plain repomd repository +## 2. plain repomd repository *(repo meta data are in /repodata/)* @@ -79,7 +79,7 @@ Lets see how to avoid this. -###2.1. solving the digest problem +### 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 @@ -93,7 +93,7 @@ find . | cpio -o -H newc | xz --check=crc32 -c >>initrd_on_boot_medium ``` -##3. components linuxrc reads +## 3. components linuxrc reads linuxrc reads files from two distinct locations: @@ -106,7 +106,7 @@ See the previous sections for examples. -###3.1. files read from inst-sys location +### 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. @@ -164,7 +164,7 @@ 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 +### 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 `/`): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/url.c new/linuxrc-5.0.102/url.c --- old/linuxrc-5.0.100/url.c 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/url.c 2017-04-28 14:12:04.000000000 +0200 @@ -2173,6 +2173,9 @@ strprintf(&buf, "/%s", config.zen ? config.zenconfig : "content"); strprintf(&buf2, "file:%s", buf); + config.repomd = 0; + config.repomd_data = slist_free(config.repomd_data); + if( url_read_file(url, NULL, buf, buf, NULL, URL_FLAG_NODIGEST + (config.secure ? URL_FLAG_CHECK_SIG : 0) @@ -2180,13 +2183,17 @@ ) { if(config.zen) return 0; - // 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); + // no content file -> download repomd.xml + int read_failed = url_read_file( + url, NULL, "/repodata/repomd.xml", "/repomd.xml", NULL, + URL_FLAG_NODIGEST + (config.secure ? URL_FLAG_CHECK_SIG : 0) + ); if(read_failed) return 0; + + config.repomd = 1; + + file_parse_repomd("/repomd.xml"); } if(!config.sig_failed && util_check_exist(buf)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.100/util.c new/linuxrc-5.0.102/util.c --- old/linuxrc-5.0.100/util.c 2017-04-13 11:39:07.000000000 +0200 +++ new/linuxrc-5.0.102/util.c 2017-04-28 14:12:04.000000000 +0200 @@ -1203,6 +1203,7 @@ add_flag(&sl0, buf, config.upgrade, "upgrade"); add_flag(&sl0, buf, config.net.sethostname, "hostname"); add_flag(&sl0, buf, config.self_update, "self_update"); + add_flag(&sl0, buf, config.repomd, "repomd"); if(*buf) slist_append_str(&sl0, buf); if(config.self_update_url) { @@ -1582,11 +1583,20 @@ } } + if(config.repomd_data) { + strcpy(buf, "repomd-data:"); + slist_append_str(&sl0, buf); + for(sl = config.repomd_data; sl; sl = sl->next) { + sprintf(buf, " %s: %s", sl->key, sl->value); + slist_append_str(&sl0, buf); + } + } + if(config.digests.list) { strcpy(buf, "digests:"); slist_append_str(&sl0, buf); for(sl = config.digests.list; sl; sl = sl->next) { - sprintf(buf, " %s %s", sl->key, sl->value); + sprintf(buf, " %s: %s", sl->key, sl->value); slist_append_str(&sl0, buf); } }
