[pve-devel] r5493 - in pve-common/trunk/data: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Feb 8 13:14:02 CET 2011


Author: dietmar
Date: 2011-02-08 13:14:02 +0100 (Tue, 08 Feb 2011)
New Revision: 5493

Modified:
   pve-common/trunk/data/ChangeLog
   pve-common/trunk/data/PVE/INotify.pm
Log:


Modified: pve-common/trunk/data/ChangeLog
===================================================================
--- pve-common/trunk/data/ChangeLog	2011-02-08 10:01:01 UTC (rev 5492)
+++ pve-common/trunk/data/ChangeLog	2011-02-08 12:14:02 UTC (rev 5493)
@@ -3,6 +3,8 @@
 	* PVE/INotify.pm (update_file): use PVE::Tools, changed interface
 	(update_etc_resolv_conf): do not touch other options (like
 	'sortlist' and 'options'),
+	(read_etc_timezone): add timezone parser
+	(write_etc_timezone): add timezone writer
 
 	* PVE/JSONSchema.pm (pve_verify_ipv4): register IPv4 format.
 

Modified: pve-common/trunk/data/PVE/INotify.pm
===================================================================
--- pve-common/trunk/data/PVE/INotify.pm	2011-02-08 10:01:01 UTC (rev 5492)
+++ pve-common/trunk/data/PVE/INotify.pm	2011-02-08 12:14:02 UTC (rev 5493)
@@ -571,10 +571,33 @@
     return $data;
 }
 
-register_file ('resolvconf', "/etc/resolv.conf", 
-	       \&read_etc_resolv_conf, undef, 
-	       \&update_etc_resolv_conf);
+register_file('resolvconf', "/etc/resolv.conf", 
+	      \&read_etc_resolv_conf, undef, 
+	      \&update_etc_resolv_conf);
 
+sub read_etc_timezone {
+    my ($filename, $fd) = @_;
 
+    my $timezone = <$fd>;
 
+    chomp $timezone;
+
+    return $timezone;
+}
+
+sub write_etc_timezone {
+    my ($filename, $fh, $timezone) = @_;
+
+    print $fh "$timezone\n";
+
+    unlink ("/etc/localtime");
+    symlink ("/usr/share/zoneinfo/$timezone", "/etc/localtime");
+
+    return $timezone;
+}
+
+register_file('timezone', "/etc/timezone", 
+	      \&read_etc_timezone, 
+	      \&write_etc_timezone);
+
 1;



More information about the pve-devel mailing list