[pve-devel] r5300 - pve-common/trunk
svn-commits at proxmox.com
svn-commits at proxmox.com
Mon Nov 8 11:49:39 CET 2010
Author: dietmar
Date: 2010-11-08 10:49:39 +0000 (Mon, 08 Nov 2010)
New Revision: 5300
Modified:
pve-common/trunk/ChangeLog
pve-common/trunk/INotify.pm
Log:
* INotify.pm (read_etc_hostname): impl. read/write /etc/hostname
Modified: pve-common/trunk/ChangeLog
===================================================================
--- pve-common/trunk/ChangeLog 2010-11-08 10:03:59 UTC (rev 5299)
+++ pve-common/trunk/ChangeLog 2010-11-08 10:49:39 UTC (rev 5300)
@@ -1,3 +1,7 @@
+2010-11-08 Proxmox Support Team <support at proxmox.com>
+
+ * INotify.pm (read_etc_hostname): impl. read/write /etc/hostname
+
2010-09-17 Proxmox Support Team <support at proxmox.com>
* RESTHandler.pm (AUTOLOAD): bug fix.
Modified: pve-common/trunk/INotify.pm
===================================================================
--- pve-common/trunk/INotify.pm 2010-11-08 10:03:59 UTC (rev 5299)
+++ pve-common/trunk/INotify.pm 2010-11-08 10:49:39 UTC (rev 5300)
@@ -490,4 +490,28 @@
}
}
+sub read_etc_hostname {
+ my ($filename, $fd) = @_;
+
+ my $hostname = <$fd>;
+
+ chomp $hostname;
+
+ $hostname =~ s/\..*$//; # strip domain part, if any
+
+ return $hostname;
+}
+
+sub write_etc_hostname {
+ my ($filename, $fh, $hostname) = @_;
+
+ print $fh "$hostname\n";
+
+ return $hostname;
+}
+
+register_file ('hostname', "/etc/hostname",
+ \&read_etc_hostname,
+ \&write_etc_hostname);
+
1;
More information about the pve-devel
mailing list