From bdf75f07aac9d8d166f9733b71ebb2f0a8a538e1 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Tue, 15 Mar 2011 00:20:18 +0000 Subject: Try harder to get useful values if (a) getent is not available or (b) HOSTNAME env-var does not exist. svn path=/trunk/netsurf/; revision=12055 --- utils/svn-testament.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/svn-testament.pl b/utils/svn-testament.pl index e0f678b66..2412064dd 100755 --- a/utils/svn-testament.pl +++ b/utils/svn-testament.pl @@ -58,6 +58,13 @@ my %userinfo; # The information about the current user $gecos =~ s/,.+//g; $gecos =~ s/"/'/g; $userinfo{GECOS} = $gecos; + + if ( $pwdline eq "" ) { # Try whoami if we don't have getent + my $pwdline = `whoami`; + chomp $pwdline; + $userinfo{USERNAME} = $pwdline; + $userinfo{GECOS} = $pwdline; + } } # The current date, in AmigaOS version friendly format (dd.mm.yyyy) @@ -77,6 +84,11 @@ $qroot =~ s/"/\\"/g; my $hostname = $ENV{HOSTNAME}; +if ( $hostname eq "" ) { # Try hostname command if env-var empty + $hostname = `hostname`; + chomp $hostname; +} + $hostname = "unknown-host" unless (defined($hostname) && $hostname ne ""); $hostname =~ s/"/\\"/g; -- cgit v1.2.3