Author: lslezak Date: Thu Sep 8 14:41:02 2011 New Revision: 65606 URL: http://svn.opensuse.org/viewcvs/yast?rev=65606&view=rev Log: fixed Service::Finetune() implementation to use chkconfig Modified: branches/tmp/lslezak/yast2/library/runlevel/src/Service.ycp branches/tmp/lslezak/yast2/library/runlevel/src/Systemd.ycp branches/tmp/lslezak/yast2/library/runlevel/testsuite/tests/ServiceFinetune.ycp Modified: branches/tmp/lslezak/yast2/library/runlevel/src/Service.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/yast2/library/runlevel/src/Service.ycp?rev=65606&r1=65605&r2=65606&view=diff ============================================================================== --- branches/tmp/lslezak/yast2/library/runlevel/src/Service.ycp (original) +++ branches/tmp/lslezak/yast2/library/runlevel/src/Service.ycp Thu Sep 8 14:41:02 2011 @@ -241,9 +241,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, ","); - // we must remove it first because insserv start=... adds - // runlevels, not replace runlevels!! + string rls = mergestring ((list<string>)rl, ""); + // we must remove all runlevels and then add the selected if (! serviceDisable (name, true)) { y2error ("Cannot disable %1", name); @@ -253,7 +252,7 @@ // script has already been completely disabled // enable in required runlevels if needed if (rls != "") { - string command = sformat ("/sbin/insserv -f %2/%1,start=%3", name, init_d, rls); + string command = sformat ("/sbin/chkconfig -s -f %1 %2", name, rls); y2milestone ("Calling %1", command); map ret = (map)SCR::Execute (.target.bash_output, command); @@ -266,7 +265,7 @@ // %2 is the stderr output of insserv(8) // %3 is a comma separated list of runlevels error_msg = sformat(_("Unable to enable service %1 in runlevels %2:\n%3"), - name, rls, ret["stderr"]:""); + name, rl, ret["stderr"]:""); y2error (1, error_msg); return false; } Modified: branches/tmp/lslezak/yast2/library/runlevel/src/Systemd.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/yast2/library/runlevel/src/Systemd.ycp?rev=65606&r1=65605&r2=65606&view=diff ============================================================================== --- branches/tmp/lslezak/yast2/library/runlevel/src/Systemd.ycp (original) +++ branches/tmp/lslezak/yast2/library/runlevel/src/Systemd.ycp Thu Sep 8 14:41:02 2011 @@ -41,6 +41,12 @@ string init_cmdline = (string)SCR::Read(.target.string, cmdline_path); y2milestone("Current init program: %1", init_cmdline); + if (init_cmdline == nil) + { + y2error("Cannot check systemd status"); + return nil; + } + boolean ret = substring(init_cmdline, 0, size(systemd_path)) == systemd_path; y2milestone("Systemd detected: %1", ret); Modified: branches/tmp/lslezak/yast2/library/runlevel/testsuite/tests/ServiceFinetune.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/yast2/library/runlevel/testsuite/tests/ServiceFinetune.ycp?rev=65606&r1=65605&r2=65606&view=diff ============================================================================== --- branches/tmp/lslezak/yast2/library/runlevel/testsuite/tests/ServiceFinetune.ycp (original) +++ branches/tmp/lslezak/yast2/library/runlevel/testsuite/tests/ServiceFinetune.ycp Thu Sep 8 14:41:02 2011 @@ -1,5 +1,8 @@ { include "testsuite.ycp"; + + TESTSUITE_INIT ([$[ "target" : $[ "tmpdir": "/tmp" ] ], $[], $[]], nil); + import "Service"; map READ = $[]; @@ -11,12 +14,20 @@ ]; READ = $[ "init" : $[ "scripts" : $[ - "exists" : true, - ] ] ]; - TEST (``(Service::Finetune ("aaa", ["A", "B", "C"])), [ READ, $[], EXEC ], nil); + "exists" : true + ] ], + "target" : $[ + "stat" : $["isreg": true] + ] + ]; + TEST (``(Service::Finetune ("aaa", ["1", "3", "5"])), [ READ, $[], EXEC ], nil); READ = $[ "init" : $[ "scripts" : $[ "exists" : true, - ] ] ]; + ] ], + "target" : $[ + "stat" : $["isreg": true] + ] + ]; TEST (``(Service::Finetune ("aaa", [])), [ READ, $[], EXEC ], nil); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org