Bugzilla – Attachment 430425 Details for
Bug 664548
systemd adaptation of YaST
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
work in progress to adapt Service.ycp
yast2-base-systemd-fragment.diff (text/plain), 4.25 KB, created by
Martin Vidner
on 2011-05-19 13:41:53 UTC
(
hide
)
Description:
work in progress to adapt Service.ycp
Filename:
MIME Type:
Creator:
Martin Vidner
Created:
2011-05-19 13:41:53 UTC
Size:
4.25 KB
patch
obsolete
>Index: library/runlevel/src/Makefile.am >=================================================================== >--- library/runlevel/src/Makefile.am (revision 64072) >+++ library/runlevel/src/Makefile.am (working copy) >@@ -9,4 +9,5 @@ > EXTRA_DIST = $(agent_SCRIPTS) \ > $(scrconf_DATA) $(module_DATA) > >+YCPCFLAGS = -M ../../types/src -M ../../modules > include $(top_srcdir)/Makefile.am.common >Index: library/runlevel/src/Service.ycp >=================================================================== >--- library/runlevel/src/Service.ycp (revision 64072) >+++ library/runlevel/src/Service.ycp (working copy) >@@ -18,6 +18,8 @@ > module "Service"; > textdomain "base"; > >+import "FileUtils"; >+ > /*** > * Services Manipulation > */ >@@ -44,9 +46,17 @@ > */ > > /** >+ * Program to invoke the service init scripts, or the systemd actions >+ */ >+string invoker = "/sbin/service"; >+/** > * Script location > */ > string init_d = "/etc/init.d"; >+/** >+ * Unit location for systemd >+ */ >+string systemd_d = "/lib/systemd/system"; > > /** > * After a function returns an error, this holds an error message, >@@ -74,7 +84,13 @@ > y2error(1, error_msg); > return false; > } >- if(! (boolean) SCR::Read(.init.scripts.exists, name)) { >+ if (FileUtils::Exists(sformat("%1/%2", init_d,name))) { >+ return true; >+ } >+ else if (FileUtils::Exists(sformat("%1/%2.service", systemd_d,name))) { >+ return true; >+ } >+ else { > // Error message. > // %1 is a name of an init script in /etc/init.d, > // eg. nfsserver >@@ -82,7 +98,6 @@ > y2milestone (1, error_msg); > return false; > } >- return true; > } > > /** >@@ -111,7 +126,7 @@ > */ > global define integer Status (string name) { > if(!checkExists (name)) return -1; >- return (integer) SCR::Execute (.target.bash, sformat ("%2/%1 status", name, init_d), $["TERM":"raw"]); >+ return (integer) SCR::Execute (.target.bash, sformat ("%1 %2 status", invoker, name), $["TERM":"raw"]); > } > > /** >@@ -133,8 +148,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 -d%2 %1", >+ name, force? "f": "")); > if (0 != ret["exit"]:-1) > { > // Error message. >@@ -166,9 +181,10 @@ > return false; > } > map service = Info (name); >+ boolean is_enabled = size (service["start"]:[]) != 0; > if ("disable" == action) > { >- if (size (service["start"]:[]) != 0) >+ if (is_enabled) > { > return serviceDisable (name, false); > } >@@ -176,7 +192,7 @@ > } > if (("default" == action) || ("enable" == action)) > { >- if ("enable" == action && size (service["start"]:[]) != 0) >+ if ("enable" == action && is_enabled) > { > // nothing to do > return true; >@@ -184,8 +200,8 @@ > else > { > map ret = (map)SCR::Execute (.target.bash_output, >- sformat ("/sbin/insserv -d %2/%1", >- name, init_d)); >+ sformat ("/sbin/chkconfig -a %1", >+ name)); > if (0 != ret["exit"]:-1) > { > // Error message. >@@ -262,19 +278,16 @@ > } > > /** >- * Check if service is enabled >+ * Check if service is enabled (in RL 3 or multi-user.target) > * >- * Returns true if any link in /etc/init.d/rc?.d/ exists for this >- * script. If service does not exist, logs an error. >+ * Forwards to chkconfig -c which decides between init and systemd > * > * @param name service name >- * @return true if service is set to run in any runlevel >+ * @return true if service is set to run > */ > global define boolean Enabled (string name) { > if(!checkExists (name)) return false; >- map<string, any> details = (map<string, any>) SCR::Read (.init.scripts.runlevel, name); >- map<string, any> detail = (map<string, any>) details[name]:$[]; >- return size(detail["start"]:[]) != 0; >+ return 0 == SCR::Execute (.target.bash, sformat ("chkconfig -c %1 3", name)); > } > > /** >@@ -285,7 +298,7 @@ > */ > global define integer RunInitScript (string name, string param) { > y2milestone("Running service initscript %1 %2", name, param); >- string command = sformat ("%2/%1 %3", name, init_d, param); >+ string command = sformat ("%1 %2 %3", invoker, name, param); > map<string, any> output=(map<string, any>)SCR::Execute (.target.bash_output, > command, $[ "TERM" : "raw"]); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 664548
: 430425