Hello community, here is the log from the commit of package linuxrc for openSUSE:Factory checked in at 2012-12-14 09:42:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/linuxrc (Old) and /work/SRC/openSUSE:Factory/.linuxrc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "linuxrc", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/linuxrc/linuxrc.changes 2012-11-28 11:08:16.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.linuxrc.new/linuxrc.changes 2012-12-14 09:42:19.000000000 +0100 @@ -1,0 +2,5 @@ +Thu Dec 13 10:46:03 CET 2012 - [email protected] + +- get built-in 'extend' command back + +------------------------------------------------------------------- Old: ---- linuxrc-4.1.0.tar.bz2 New: ---- linuxrc-4.1.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ linuxrc.spec ++++++ --- /var/tmp/diff_new_pack.B1Ddl3/_old 2012-12-14 09:42:21.000000000 +0100 +++ /var/tmp/diff_new_pack.B1Ddl3/_new 2012-12-14 09:42:21.000000000 +0100 @@ -24,9 +24,9 @@ Summary: SUSE Installation Program License: GPL-3.0+ Group: System/Boot -Version: 4.1.0 +Version: 4.1.1 Release: 0 -Source: linuxrc-4.1.0.tar.bz2 +Source: linuxrc-4.1.1.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build %description ++++++ linuxrc-4.1.0.tar.bz2 -> linuxrc-4.1.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.1.0/VERSION new/linuxrc-4.1.1/VERSION --- old/linuxrc-4.1.0/VERSION 2012-11-26 13:44:57.000000000 +0100 +++ new/linuxrc-4.1.1/VERSION 2012-12-13 10:45:59.000000000 +0100 @@ -1 +1 @@ -4.1.0 +4.1.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.1.0/changelog new/linuxrc-4.1.1/changelog --- old/linuxrc-4.1.0/changelog 2012-11-26 13:44:58.000000000 +0100 +++ new/linuxrc-4.1.1/changelog 2012-12-13 10:46:01.000000000 +0100 @@ -1,3 +1,7 @@ +2012-12-13: HEAD + - Revert "clean-up: removed built-in extend" + - This reverts commit 2c59f72fee9d308dd791090c898b48bbb7fbbc21. + 2012-11-26: 4.1.0 - make sure WORDS_BIGENDIAN is defined correctly where needed (bnc #755861) - add *.conf to modprobe config files to make them work (bnc #775800) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.1.0/linuxrc.c new/linuxrc-4.1.1/linuxrc.c --- old/linuxrc-4.1.0/linuxrc.c 2012-11-26 13:43:57.000000000 +0100 +++ new/linuxrc-4.1.1/linuxrc.c 2012-12-13 10:42:19.000000000 +0100 @@ -70,6 +70,7 @@ static void lxrc_change_root (void); static void lxrc_reboot (void); static void lxrc_halt (void); +static void lxrc_usr1(int signum); static int lxrc_exit_menu (void); static int lxrc_exit_cb (dia_item_t di); @@ -94,6 +95,7 @@ // { "swapon", util_swapon_main }, { "scsi_rename", scsi_rename_main }, { "lndir", util_lndir_main }, + { "extend", util_extend_main }, }; #endif @@ -662,6 +664,7 @@ siginterrupt(SIGSEGV, 1); siginterrupt(SIGPIPE, 1); lxrc_catch_signal(0); + signal(SIGUSR1, lxrc_usr1); /* reboot (RB_DISABLE_CAD); */ @@ -1303,6 +1306,83 @@ } +void lxrc_usr1(int signum) +{ + static unsigned extend_cnt = 0; + int i, err = 0; + char *s, buf[1024]; + FILE *f; + slist_t *sl = NULL, *sl_task = NULL; + char task = 0, *ext = NULL; + int extend_pid = 0; + + if(!rename("/tmp/extend.job", s = new_download())) { + *buf = 0; + f = fopen(s, "r"); + if(f) { + if(!fgets(buf, sizeof buf, f)) *buf = 0; + if(*buf) { + sl_task = slist_split(' ', buf); + extend_pid = atoi(sl_task->key); + if(sl_task->next) { + task = *sl_task->next->key; + if(sl_task->next->next) ext = sl_task->next->next->key; + } + } + fclose(f); + } + unlink(s); + if((task == 'a' || task == 'r') && ext) { + sl = slist_getentry(config.extend_list, ext); + if(task == 'a' && !sl) { + slist_append_str(&config.extend_list, ext); + } + else if(task == 'r' && sl) { + str_copy(&sl->key, NULL); + } + if(!fork()) { + for(i = 0; i < 256; i++) close(i); + open("/tmp/extend.log", O_RDWR | O_CREAT | O_TRUNC, 0644); + dup(0); + dup(0); + setlinebuf(stderr); + config.download.cnt = 1000 + extend_cnt; + config.mountpoint.cnt = 1000 + extend_cnt; + if(!config.debug) config.debug = 1; + + config.keepinstsysconfig = 1; + + if(task == 'a' && sl) { + fprintf(stderr, "instsys extend: add %s\n%s: already added\n", ext, ext); + err = 0; + } + else if(task == 'r' && !sl) { + fprintf(stderr, "instsys extend: remove %s\n%s: not there\n", ext, ext); + err = 0; + } + else if(task == 'a') { + err = auto2_add_extension(ext); + } + else if(task == 'r') { + err = auto2_remove_extension(ext); + } + f = fopen("/tmp/extend.result", "w"); + if(f) fprintf(f, "%d\n", err); + fclose(f); + if(extend_pid > 0) kill(extend_pid, SIGUSR1); + exit(0); + } + } + } + + slist_free(sl_task); + + extend_cnt += 10; + + signal(SIGUSR1, lxrc_usr1); +} + + int cmp_entry(slist_t *sl0, slist_t *sl1) { return strcmp(sl0->key, sl1->key); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.1.0/util.c new/linuxrc-4.1.1/util.c --- old/linuxrc-4.1.0/util.c 2012-11-26 13:43:57.000000000 +0100 +++ new/linuxrc-4.1.1/util.c 2012-12-13 10:32:04.000000000 +0100 @@ -89,6 +89,7 @@ static char *exclude = NULL; static int rec_level = 0; +static int extend_ready = 0; static void add_flag(slist_t **sl, char *buf, int value, char *name); @@ -108,6 +109,10 @@ static int skip_spaces(unsigned char **str); static int word_size(unsigned char *str, int *width, int *enc_len); +static void util_extend_usr1(int signum); +static int util_extend(char *extension, char task, int verbose); + + void util_redirect_kmsg() { static char newvt[2] = { 11, 4 /* console 4 */ }; @@ -2431,6 +2436,103 @@ } +void util_extend_usr1(int signum) +{ + extend_ready = 1; +} + + +int util_extend(char *extension, char task, int verbose) +{ + FILE *f, *w; + int err = 0; + char buf[1024]; + + extend_ready = 0; + signal(SIGUSR1, util_extend_usr1); + + unlink("/tmp/extend.result"); + f = fopen("/tmp/extend.job", "w"); + if(f) { + fprintf(f, "%d %c %s\n", (int) getpid(), task, extension); + fclose(f); + + if(util_check_exist("/usr/src/packages") || getuid()) config.test = 1; + + if(config.test) { + util_killall("linuxrc", SIGUSR1); + } + else { + if(kill(1, SIGUSR1)) err = 2; + } + + if(!err) { + while(!extend_ready) { sleep(1); } + + if((f = fopen("/tmp/extend.result", "r"))) { + fscanf(f, "%d", &err); + fclose(f); + } + } + } + else { + err = 1; + } + + f = fopen("/tmp/extend.log", "r"); + if(f) { + w = fopen("/var/log/extend", "a"); + while(fgets(buf, sizeof buf, f)) { + if(verbose > 0) printf("%s", buf); + if(w) fprintf(w, "%s", buf); + } + if(w) fclose(w); + fclose(f); + } + + if(verbose >= 0) printf("%s: extend %s\n", extension, err ? "failed" : "ok"); + + return err; +} + + +int util_extend_main(int argc, char **argv) +{ + int err = 0; + char task = 'a'; + struct { unsigned verbose:1; unsigned help:1; } opt = {}; + + argv++; argc--; + + while(argc) { + if(!strcmp(*argv, "-r")) { + task = 'r'; + } + else if(!strcmp(*argv, "-h") || !strcmp(*argv, "--help")) { + opt.help = 1; + } + else if(!strcmp(*argv, "-v")) { + opt.verbose = 1; + } + else { + break; + } + argv++; argc--; + } + + if(!argc || opt.help) { + return fprintf(stderr, "Usage: extend [-v] [-r] extension\nAdd or remove inst-sys extension.\n"), 1; + } + + err = util_extend(*argv, task, opt.verbose); + + // remove it to keep internal list correct + if(err && task == 'a') util_extend(*argv, 'r', -1); + + return err; +} + + /* * returns loop device used */ -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
