[yast-commit] r38260 - in /trunk/tv: package/yast2-tv.changes src/Tv.ycp
Author: lslezak Date: Mon Jun 4 10:53:24 2007 New Revision: 38260 URL: http://svn.opensuse.org/viewcvs/yast?rev=38260&view=rev Log: - check whether lirc service and /etc/sysconfig/lirc are available when reading/writing the configuration (#211901) Modified: trunk/tv/package/yast2-tv.changes trunk/tv/src/Tv.ycp Modified: trunk/tv/package/yast2-tv.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/tv/package/yast2-tv.changes?rev=38260&r1=38259&r2=38260&view=diff ============================================================================== --- trunk/tv/package/yast2-tv.changes (original) +++ trunk/tv/package/yast2-tv.changes Mon Jun 4 10:53:24 2007 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Jun 4 10:51:02 CEST 2007 - lslezak@suse.cz + +- check whether lirc service and /etc/sysconfig/lirc are available + when reading/writing the configuration (#211901) + +------------------------------------------------------------------- Fri May 25 13:30:04 CEST 2007 - jsrain@suse.cz - removed outdated translations from .desktop-files (#271209) Modified: trunk/tv/src/Tv.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/tv/src/Tv.ycp?rev=38260&r1=38259&r2=38260&view=diff ============================================================================== --- trunk/tv/src/Tv.ycp (original) +++ trunk/tv/src/Tv.ycp Mon Jun 4 10:53:24 2007 @@ -2883,8 +2883,10 @@ cards_with_ir_kbd_gpio = (map) SCR::Read (.target.yast2, "tv_cards-lirc_gpio.ycp"); - use_irc = Service::Status ("lirc") == 0; - irc_module = (string) SCR::Read (.sysconfig.lirc.LIRC_MODULE); + + use_irc = (Service::Info("lirc") != $[]) ? (Service::Status ("lirc") == 0) : false; + + irc_module = (SCR::Read(.target.size, "/etc/sysconfig/lirc") >= 0) ? (string) SCR::Read (.sysconfig.lirc.LIRC_MODULE) : ""; if (irc_module == nil) irc_module = ""; if (SCR::Read (.target.size, "/etc/lircd.conf") != -1) @@ -2896,10 +2898,17 @@ irc_config = "/usr/share/lirc/remotes/linux-input-layer-lircd.conf"; } - map out = (map) SCR::Execute (.target.bash_output, - "/usr/bin/find /usr/share/lirc/remotes/ -name *lircd*"); - remotes = sort (splitstring (out["stdout"]:"", "\n")); - // FIXME choose from remotes + if (SCR::Read(.target.size, "/usr/share/lirc") >= 0) + { + map out = (map) SCR::Execute (.target.bash_output, + "/usr/bin/find /usr/share/lirc/remotes/ -name *lircd*"); + remotes = sort (splitstring (out["stdout"]:"", "\n")); + // FIXME choose from remotes + } + else + { + remotes = []; + } return `next; } @@ -2910,9 +2919,16 @@ */ global define any WriteIRC () ``{ - // 1. sysconfig values - SCR::Write (.sysconfig.lirc.LIRC_MODULE, irc_module); - SCR::Write (.sysconfig.lirc, nil); + if (SCR::Read(.target.size, "/etc/sysconfig/lirc") >= 0) + { + // write sysconfig values + SCR::Write (.sysconfig.lirc.LIRC_MODULE, irc_module); + SCR::Write (.sysconfig.lirc, nil); + } + else + { + y2warning("/etc/syconfig/lirc doesn't exist, writing the configuration has been skipped"); + } y2milestone("config file: %1", irc_config); @@ -2933,20 +2949,31 @@ y2milestone("config file: %1 copied to /etc/lircd.conf",irc_config); } - // adjust runlevels: - Service::Adjust ("lirc", "enable"); - // start the service - if (Service::Status ("lirc") == 0) - Service::RunInitScript ("lirc", "restart"); + // does the service exist? + if (Service::Info("lirc") != $[]) + { + // adjust runlevels: + Service::Adjust ("lirc", "enable"); + // start the service + if (Service::Status ("lirc") == 0) + Service::RunInitScript ("lirc", "restart"); + else + Service::RunInitScript ("lirc", "start"); + } else - Service::RunInitScript ("lirc", "start"); + { + y2error("Service 'lirc' doesn't exist!"); + } } else { - // adjust runlevels: - Service::Adjust ("lirc", "disable"); - // stop the service - Service::RunInitScript ("lirc", "stop"); + if (Service::Info("lirc") != $[]) + { + // adjust runlevels: + Service::Adjust ("lirc", "disable"); + // stop the service + Service::RunInitScript ("lirc", "stop"); + } } return `next; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org