On Thu, Jul 17, 2008 at 02:23:17PM +0800, Zhao Shujing wrote:
Hi,
The YaST for (RH)EL5 is finished. As I have said before, I would share the patches here. This is the patch of yast2-2.13.104. The patches of the other packages that have been ported will be sent later.
Pearly Zhao
Sorry for taking so long. My comments are below. I will continue with the other patch set this week.
diff -ur old/REDHAT/SOURCES/yast2/library/agents/cfg_sysctl.scr REDHAT/SOURCES/yast2-2.13.104/library/agents/cfg_sysctl.scr --- old/REDHAT/SOURCES/yast2/library/agents/cfg_sysctl.scr 2006-06-29 02:47:16.000000000 -0400 +++ REDHAT/SOURCES/yast2-2.13.104/library/agents/cfg_sysctl.scr 2008-01-11 14:13:24.000000000 -0500 @@ -1,26 +1,38 @@ /** * File: cfg_sysctl.scr - * Summary: Agent for reading/writing /etc/sysconfig/sysctl + * Summary: Agent for reading/writing /etc/sysctl.conf * Author: Michal Svec <msvec@suse.cz> - * Access: read / write + * Modified: Wenji Huang <wenji.huang@oracle.com> + * Access: read * * Example: * Dir(.sysconfig.sysctl) - * (["IP_FORWARD", ...]) - ** - * Read(.sysconfig.sysctl.IP_FORWARD) - * ("yes") - ** - * Write(.sysconfig.sysctl.IP_FORWARD, "no") - * (true) * - * $Id: cfg_sysctl.scr 13440 2004-01-23 15:13:46Z msvec $ + * $Id: cfg_sysctl.scr,v 1.1 2004/01/23 15:13:46 msvec Exp $ * - * Read/Sets the values defined in <tt>/etc/sysconfig/sysctl</tt> + * Read the values defined in <tt>/etc/sysctl.conf</tt> * in an easy manner. */ .sysconfig.sysctl
I think the change to cfg_sysctl.scr is wrong: SUSE's /etc/sysconfig/sysctl has entries like IP_DYNIP="yes" IP_TCP_SYNCOOKIES="yes" which is quite different from the file format of /etc/sysctl.conf, which SUSE also has. I suggest that you add a new SCR path, say .etc.sysctl_conf (in etc_sysctl_conf.scr)
-`ag_ini( - `SysConfigFile("/etc/sysconfig/sysctl") +`ag_anyagent( + `Description ( + (`Run("sed -e 's/#.*//g' -e '/^[ \t]*$/d' /etc/sysctl.conf|cat +")), // real file name + "\n", // Comment + true, // read-only + (`List ( + `Tuple ( + `Optional(`Whitespace()), + `name (`String("^\t =")), + `Optional(`Whitespace()), + `Separator ("="), + `Optional(`Whitespace()), + `value (`String("^\t \n")), + `Optional(`Whitespace()) + ), + "\n" + )) + ) ) + Only in old/REDHAT/SOURCES/yast2/library: cron diff -ur old/REDHAT/SOURCES/yast2/library/Makefile.am REDHAT/SOURCES/yast2-2.13.104/library/Makefile.am --- old/REDHAT/SOURCES/yast2/library/Makefile.am 2007-01-05 09:21:26.000000000 -0500 +++ REDHAT/SOURCES/yast2-2.13.104/library/Makefile.am 2008-03-13 12:33:43.000000000 -0400 @@ -1,3 +1,3 @@ # Makefile.am for yast2/library
-SUBDIRS = agents types modules runlevel sequencer xml commandline wizard control cwm log system packages cron desktop network gpg +SUBDIRS = agents types modules runlevel sequencer xml commandline wizard control cwm log system packages desktop network gpg
Why omit cron?
diff -ur old/REDHAT/SOURCES/yast2/library/Makefile.in REDHAT/SOURCES/yast2-2.13.104/library/Makefile.in --- old/REDHAT/SOURCES/yast2/library/Makefile.in 2007-04-11 04:51:27.000000000 -0400 +++ REDHAT/SOURCES/yast2-2.13.104/library/Makefile.in 2008-03-13 12:33:49.000000000 -0400 @@ -169,7 +169,7 @@ ydatadir = @ydatadir@ yncludedir = @yncludedir@ ystartupdir = @ystartupdir@ -SUBDIRS = agents types modules runlevel sequencer xml commandline wizard control cwm log system packages cron desktop network gpg +SUBDIRS = agents types modules runlevel sequencer xml commandline wizard control cwm log system packages desktop network gpg all: all-recursive
.SUFFIXES: diff -ur old/REDHAT/SOURCES/yast2/library/network/agents/network.scr REDHAT/SOURCES/yast2-2.13.104/library/network/agents/network.scr --- old/REDHAT/SOURCES/yast2/library/network/agents/network.scr 2006-06-29 02:47:22.000000000 -0400 +++ REDHAT/SOURCES/yast2-2.13.104/library/network/agents/network.scr 2008-01-11 14:14:06.000000000 -0500 @@ -2,6 +2,7 @@ * File: network.scr * Summary: Agent for /etc/sysconfig/network/ifcfg-* * Author: Michal Svec <msvec@suse.cz> + * Modified: Wenji Huang <wenji.huang@oracle.com> * Access: read / write * See: sysconfig.rpm * @@ -11,15 +12,15 @@ * VAR2="val 2 #blah" # comment2 * VAR3='val3 x #blah2' # comment3 * - * $Id: network.scr 20267 2004-11-10 09:45:26Z mvidner $ + * $Id: network.scr,v 1.9 2003/12/06 20:51:23 msvec Exp $ * - * <p>Reads/writes <tt>/etc/sysconfig/network/ifcfg-*</tt>. For more details + * <p>Reads/writes <tt>/etc/sysconfig/network-scripts/ifcfg-*</tt>. For more details * see its own documentation.</p> */ .network
`ag_ini( - `IniAgent( [ "/etc/sysconfig/network/ifcfg-*" ], + `IniAgent( [ "/etc/sysconfig/network-scripts/ifcfg-*" ], $[ /* values at the top level, allow comments after value */ "options" : [ "global_values", "comments_last" ], @@ -36,7 +37,7 @@ ], /* matching rules */ "rewrite" : [ - [ "/etc/sysconfig/network/ifcfg-(.*)", "/etc/sysconfig/network/ifcfg-%s" ], + [ "/etc/sysconfig/network-scripts/ifcfg-(.*)", "/etc/sysconfig/network-scripts/ifcfg-%s" ], ], ] ))
I made this a ./configure check, revision 49978.
diff -ur old/REDHAT/SOURCES/yast2/library/runlevel/src/ag_initscripts REDHAT/SOURCES/yast2-2.13.104/library/runlevel/src/ag_initscripts --- old/REDHAT/SOURCES/yast2/library/runlevel/src/ag_initscripts 2006-06-29 02:47:26.000000000 -0400 +++ REDHAT/SOURCES/yast2-2.13.104/library/runlevel/src/ag_initscripts 2008-03-26 15:20:43.000000000 -0400 @@ -5,6 +5,7 @@ # Summary: Agent for reading initscripts info # Authors: Martin Vidner <mvidner@suse.cz> # Petr Blahos <pblahos@suse.cz> +# Modified: Zhao Shujing <pearly.zhao@oracle.com> # # $Id: ag_initscripts 28325 2006-02-23 12:11:10Z mvidner $ # @@ -74,7 +75,7 @@ [ -r "$1" ] && awk ' BEGIN { in_comment = 0; in_descr = 0; skip_file = 0; first_time = 1; - header_printed = 0; + header_printed = 0; line = 0; } first_time { first_time = 0; @@ -83,6 +84,8 @@ FILENAME ~ /\.swp$/ || FILENAME ~ /\.core$/ || FILENAME ~ /~$/ || FILENAME ~ /boot\.klog/ || FILENAME ~ /^Makefile/ || + FILENAME ~ /funtions/ || + FILENAME ~ /killall/ || # why was this here?? # bug 34775: dont skip boot.hotplug-beta, boot.restore_permissions # FILENAME ~ /\.[^0-9$.#_\-\\*]*[0-9$.#_\-\\*]/ @@ -94,6 +97,11 @@ } } END { + if (skipfile != 1) + { + gsub (/"/, "\\\"", description); + print " \"description\": \""description" \","; + } if (header_printed) print "],"; } @@ -101,6 +109,52 @@ nextfile; } { in_continue = 1; } + /^# *chkconfig:/{
I'll have to have a closer look at this. Some init scripts have comment blocks for both LSB and chkconfig
+ in_continue = 0; + in_descr = 0; + + printf " \"defstart\" : [ "; + if( $3 =="-") printf ("\"-\" ") ; + else { + for (i = 1; i<=length($3) ; i++) printf ("\"%s\", ", substr($3, i, 1)) ; + } + print "],"; + printf " \"defstop\" : [ "; + for (k=0; k<=6; k++) + if (!match($3,k)) + printf ("\"%s\", ", k) ; + + #printf ("\"%s\"", substr($3, i, 1)); + print "],"; + + } + /^#\ *description:/ { + in_continue = 0; + description = $3; + line = NR; + if ($NF == "\\"){ + descr = 1; + for (i = 4; i< NF; i++) description = description " " $i; + } + else { + descr = 0; + for (i = 4; i<=NF; i++) description = description " " $i; + } + } + descr && (/^#\ \ / || /^#\t/) && NR == line + 1 { + in_continue = 0; + line = line + 1; + if ($NF == "\\"){ + descr = 1; + for (i = 2; i< NF; i++) description = description " " $i; + } + else { + descr = 0; + for (i = 2; i<=NF; i++) description = description " " $i; + } + + } + /^### BEGIN INIT INFO/ { in_continue = 0; in_descr = 0; @@ -217,7 +271,7 @@
# Read (.runlevels) read_runlevels () { - find $INITD -name "*$1" | awk -F / ' + find /etc/ -name "*$1" 2>/dev/null | awk -F / ' BEGIN { SUBSEP = ":"; } $4 ~ /^rc.\.d$/ && $5 ~ /^[SK][0-9][0-9]/ { script = substr ($5, 4); @@ -321,7 +375,7 @@
'Read (.runlevel_list)') echo -n "[ \"B\", " - awk '/^[^#]..*\/etc\/init\.d\/rc / { print "\"" $2 "\"," }' /etc/inittab + awk '/^[^#]..*\/etc\/rc\.d\/rc / { print "\"" $2 "\"," }' /etc/inittab echo "]" ;;
diff -ur old/REDHAT/SOURCES/yast2/library/runlevel/src/Service.ycp REDHAT/SOURCES/yast2-2.13.104/library/runlevel/src/Service.ycp --- old/REDHAT/SOURCES/yast2/library/runlevel/src/Service.ycp 2006-06-29 02:47:26.000000000 -0400 +++ REDHAT/SOURCES/yast2-2.13.104/library/runlevel/src/Service.ycp 2008-03-31 11:55:35.000000000 -0400 @@ -6,6 +6,7 @@ * Petr Blahos <pblahos@suse.cz> * Michal Svec <msvec@suse.cz> * Lukas Ocilka <locilka@suse.cz> + * Modified: Zhao Shujing <pearly.zhao@oracle.com> * Flags: Stable * * $Id: Service.ycp 31242 2006-06-01 12:59:16Z locilka $ @@ -133,8 +134,8 @@ */ define boolean serviceDisable (string name, boolean force) { map ret = (map)SCR::Execute (.target.bash_output, - sformat ("/sbin/insserv -r%3 %2/%1", - name, init_d, force? "f": "")); + sformat ("/sbin/chkconfig --del %1", + name)); if (0 != ret["exit"]:-1) { // Error message. @@ -183,8 +184,8 @@ else { map ret = (map)SCR::Execute (.target.bash_output, - sformat ("/sbin/insserv -d %2/%1", - name, init_d)); + sformat ("/sbin/chkconfig --add %1", + name)); if (0 != ret["exit"]:-1) { // Error message. @@ -223,7 +224,8 @@ // and calls us only once for each modified service. // In general we cannot do it with dependencies in a single pass.
- string rls = mergestring ((list<string>)rl, ","); + list<string> ls = splitstring((string)rl[0]:"", ","); + string rls = mergestring (ls, "");
Hmm, changing the calling convention from Finetune("sendmail", ["2", "3"]) to Finetune("sendmail", ["2,3"]) does not seem like a good idea.
// we must remove it first because insserv start=... adds // runlevels, not replace runlevels!! if (! serviceDisable (name, true)) @@ -234,8 +236,8 @@ if (rls != "") { map ret = (map)SCR::Execute (.target.bash_output, - sformat ("/sbin/insserv -f %2/%1,start=%3", - name, init_d, rls)); + sformat ("/sbin/chkconfig --level %2 %1 on", + name, rls)); if (0 != ret["exit"]:-1) { // Error message. diff -ur old/REDHAT/SOURCES/yast2/library/runlevel/testsuite/tests/ServiceAdjust.out REDHAT/SOURCES/yast2-2.13.104/library/runlevel/testsuite/tests/ServiceAdjust.out --- old/REDHAT/SOURCES/yast2/library/runlevel/testsuite/tests/ServiceAdjust.out 2006-06-29 02:47:26.000000000 -0400 +++ REDHAT/SOURCES/yast2-2.13.104/library/runlevel/testsuite/tests/ServiceAdjust.out 2008-01-11 14:19:35.000000000 -0500 @@ -5,7 +5,7 @@ Read .init.scripts.exists "aaa" true Read .init.scripts.runlevel "aaa" $["aaa":$["start":["0", "1", "3"], "stop":["4", "5", "6"]]] Read .init.scripts.comment "aaa" $["aaa":$["defstart":["0", "1", "3"], "defstop":["4", "5", "6"]]] -Execute .target.bash_output "/sbin/insserv -r /etc/init.d/aaa" $["exit":0, "stderr":"", "stdout":""] +Execute .target.bash_output "/sbin/chkconfig --del aaa" $["exit":0, "stderr":"", "stdout":""] Return true Read .init.scripts.exists "aaa" true Read .init.scripts.exists "aaa" true @@ -16,7 +16,7 @@ Read .init.scripts.exists "aaa" true Read .init.scripts.runlevel "aaa" $["aaa":$["start":[], "stop":[]]] Read .init.scripts.comment "aaa" $["aaa":$["defstart":["0", "1", "3"], "defstop":["4", "5", "6"]]] -Execute .target.bash_output "/sbin/insserv -d /etc/init.d/aaa" $["exit":0, "stderr":"", "stdout":""] +Execute .target.bash_output "/sbin/chkconfig --add aaa" $["exit":0, "stderr":"", "stdout":""] Return true Read .init.scripts.exists "aaa" true Read .init.scripts.exists "aaa" true @@ -27,11 +27,11 @@ Read .init.scripts.exists "aaa" true Read .init.scripts.runlevel "aaa" $["aaa":$["start":["1"], "stop":[]]] Read .init.scripts.comment "aaa" $["aaa":$["defstart":["0", "1", "3"], "defstop":["4", "5", "6"]]] -Execute .target.bash_output "/sbin/insserv -d /etc/init.d/aaa" $["exit":0, "stderr":"", "stdout":""] +Execute .target.bash_output "/sbin/chkconfig --add aaa" $["exit":0, "stderr":"", "stdout":""] Return true Read .init.scripts.exists "aaa" true Read .init.scripts.exists "aaa" true Read .init.scripts.runlevel "aaa" $["aaa":$["start":["0", "1", "3"], "stop":[]]] Read .init.scripts.comment "aaa" $["aaa":$["defstart":["0", "1", "3"], "defstop":["4", "5", "6"]]] -Execute .target.bash_output "/sbin/insserv -d /etc/init.d/aaa" $["exit":0, "stderr":"", "stdout":""] +Execute .target.bash_output "/sbin/chkconfig --add aaa" $["exit":0, "stderr":"", "stdout":""] Return true diff -ur old/REDHAT/SOURCES/yast2/library/runlevel/testsuite/tests/ServiceFinetune.out REDHAT/SOURCES/yast2-2.13.104/library/runlevel/testsuite/tests/ServiceFinetune.out --- old/REDHAT/SOURCES/yast2/library/runlevel/testsuite/tests/ServiceFinetune.out 2006-06-29 02:47:26.000000000 -0400 +++ REDHAT/SOURCES/yast2-2.13.104/library/runlevel/testsuite/tests/ServiceFinetune.out 2008-03-31 12:13:50.000000000 -0400 @@ -1,7 +1,7 @@ Read .init.scripts.exists "aaa" true -Execute .target.bash_output "/sbin/insserv -rf /etc/init.d/aaa" $["exit":0, "stderr":"", "stdout":""] -Execute .target.bash_output "/sbin/insserv -f /etc/init.d/aaa,start=A,B,C" $["exit":0, "stderr":"", "stdout":""] +Execute .target.bash_output "/sbin/chkconfig --del aaa" $["exit":0, "stderr":"", "stdout":""] +Execute .target.bash_output "/sbin/chkconfig --level A aaa on" $["exit":0, "stderr":"", "stdout":""] Return true Read .init.scripts.exists "aaa" true -Execute .target.bash_output "/sbin/insserv -rf /etc/init.d/aaa" $["exit":0, "stderr":"", "stdout":""] +Execute .target.bash_output "/sbin/chkconfig --del aaa" $["exit":0, "stderr":"", "stdout":""] Return true diff -ur old/REDHAT/SOURCES/yast2/scripts/yast2 REDHAT/SOURCES/yast2-2.13.104/scripts/yast2 --- old/REDHAT/SOURCES/yast2/scripts/yast2 2007-04-11 04:16:18.000000000 -0400 +++ REDHAT/SOURCES/yast2-2.13.104/scripts/yast2 2007-12-13 16:02:56.000000000 -0500 @@ -95,7 +95,7 @@ shift fi
-case "`/usr/bin/basename $0`" in +case "`/bin/basename $0`" in YaST|yast|yast1|zast) unset DISPLAY ;;
`basename $0` will do just fine, committed. -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org