Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=973f81db6159c118ae89eafe6632b41b0d0c6303

commit 973f81db6159c118ae89eafe6632b41b0d0c6303
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Sun Dec 19 14:18:48 2010 +0100

*added systemd support for time configuration

diff --git a/frugal-mono-tools/ConfSystem.cs b/frugal-mono-tools/ConfSystem.cs
index 4f51363..276a6a1 100644
--- a/frugal-mono-tools/ConfSystem.cs
+++ b/frugal-mono-tools/ConfSystem.cs
@@ -32,6 +32,7 @@ namespace frugalmonotools
const string cch_time=@"/etc/hardwareclock";
const string cch_LocalTime="localtime";
const string cch_UTC="UTC";
+               const string cch_SystemdServiceTime="hwclock-load.service";

private string _hostname;
private string _locale;
@@ -230,6 +231,11 @@ namespace frugalmonotools
FileConf.WriteLine(this.GetLocalTime());
FileConf.Close();

+                               //Systemd
+                               if (this.GetLocalTime() == cch_LocalTime)
+                                       
Systemd.DisableService(cch_SystemdServiceTime);
+                               else
+                                       
Systemd.EnableService(cch_SystemdServiceTime);
//TODO :
//Added TimeZone
//tzdata
diff --git a/frugal-mono-tools/Systemd.cs b/frugal-mono-tools/Systemd.cs
new file mode 100644
index 0000000..57c8ec3
--- /dev/null
+++ b/frugal-mono-tools/Systemd.cs
@@ -0,0 +1,42 @@
+// /*
+//  *  Copyright (C) 2010 by Gaetan Gourdin <bouleet...@frogdev.info>
+//  *
+//  *  This program is free software; you can redistribute it and/or modify
+//  *  it under the terms of the GNU General Public License as published by
+//  *  the Free Software Foundation; either version 2 of the License, or
+//  *  (at your option) any later version.
+//  *
+//  *  This program is distributed in the hope that it will be useful,
+//  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  *  GNU General Public License for more details.
+//  *
+//  *  You should have received a copy of the GNU General Public License
+//  *  along with this program; if not, write to the Free Software
+//  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 
USA.
+//  */
+using System;
+namespace frugalmonotools
+{
+       public static class Systemd
+       {
+               public static bool IsActive()
+               {
+                       if (Outils.getoutput("ps aux | grep systemd") != "" )
+                           return true;
+                        else
+                           return false;
+               }
+               public static void EnableService(string serviceName)
+               {
+                       if(IsActive())
+                       Outils.ExcecuteAsRoot("systemctl disable 
"+serviceName,false);
+               }
+               public static void DisableService(string serviceName)
+               {
+                       if(IsActive())
+                       Outils.ExcecuteAsRoot("systemctl enable 
"+serviceName,false);
+               }
+       }
+}
+
diff --git a/frugal-mono-tools/frugal-mono-tools.csproj 
b/frugal-mono-tools/frugal-mono-tools.csproj
index 6f57a87..fa7d52d 100644
--- a/frugal-mono-tools/frugal-mono-tools.csproj
+++ b/frugal-mono-tools/frugal-mono-tools.csproj
@@ -157,6 +157,7 @@
<Compile Include="WID_Notes.cs" />
<Compile Include="gtk-gui\frugalmonotools.WID_Notes.cs" />
<Compile Include="FrugalNote.cs" />
+    <Compile Include="Systemd.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to