]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1241026 - checksetup.pl requires editing localconfig to remove apache group
authorDylan Hardison <dylan@mozilla.com>
Wed, 27 Jan 2016 22:44:02 +0000 (17:44 -0500)
committerDylan Hardison <dylan@mozilla.com>
Wed, 27 Jan 2016 22:44:02 +0000 (17:44 -0500)
r=dkl,a=dylan

Bugzilla/Install/Localconfig.pm

index 4ccd107ae3eb1b024d9caf8d1db3dd641fcded35..9d385fc141eb90d9708245f2b7eda69132379eda 100644 (file)
@@ -25,6 +25,8 @@ use Bugzilla::Util qw(generate_random_password wrap_hard);
 
 use Data::Dumper;
 use File::Basename qw(dirname);
+use English qw($EGID);
+use List::Util qw(first);
 use Safe;
 use Term::ANSIColor;
 
@@ -35,6 +37,14 @@ our @EXPORT_OK = qw(
     update_localconfig
 );
 
+sub _sensible_group {
+    return '' if ON_WINDOWS;
+    my @groups     = qw( apache www-data _www );
+    my $sensible_group = first { return getgrnam($_) } @groups;
+
+    return $sensible_group // getgrgid($EGID) // '';
+}
+
 use constant LOCALCONFIG_VARS => (
     {
         name    => 'create_htaccess',
@@ -42,7 +52,7 @@ use constant LOCALCONFIG_VARS => (
     },
     {
         name    => 'webservergroup',
-        default => ON_WINDOWS ? '' : 'apache',
+        default => _sensible_group(),
     },
     {
         name    => 'use_suexec',
@@ -124,6 +134,7 @@ use constant LOCALCONFIG_VARS => (
     },
 );
 
+
 sub read_localconfig {
     my ($include_deprecated) = @_;
     my $filename = bz_locations()->{'localconfig'};