diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-03-15 00:20:18 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-03-15 00:20:18 +0000 |
commit | bdf75f07aac9d8d166f9733b71ebb2f0a8a538e1 (patch) | |
tree | c600748ac441c537643b29d2e2964ecfd684bf8f /utils | |
parent | 40896dd3d94751af98cac4a0551486ca36108938 (diff) | |
download | netsurf-bdf75f07aac9d8d166f9733b71ebb2f0a8a538e1.tar.gz netsurf-bdf75f07aac9d8d166f9733b71ebb2f0a8a538e1.tar.bz2 |
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
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/svn-testament.pl | 12 |
1 files changed, 12 insertions, 0 deletions
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; |