X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/97b87610331f53e756d032ad21db786037f921a1..refs/heads/master:/install?ds=inline diff --git a/install b/install index a34adf1..c300815 100755 --- a/install +++ b/install @@ -7,6 +7,8 @@ use Socket; use IO::Socket::INET; use Digest::MD5 'md5_hex'; +our (@local_rdomains,@local_rhosts); + $ENV{PATH} .= ':/sbin:/usr/sbin'; $usage = "usage: $0 [-p port] [IP-address]\n"; @@ -23,6 +25,9 @@ if (system("host $fex >/dev/null") != 0) { die "host $fex is not resolvable - check /etc/resolv.conf\n"; } +# $fexupdate = '/root/bin/fexupdate'; +# die "found $fexupdate\n" if -x $fexupdate; + $opt_p = 80; if (open $xinetd,$xinetd) { @@ -121,7 +126,14 @@ print "prerequisites checked, ok\n"; unless (getpwnam('fex')) { print "creating user fex\n"; - system 'useradd -s /bin/bash -c "File EXchange" -m fex'; + system 'groupadd --system fex 2>/dev/null || groupadd fex'; + my @g = getgrnam('fex') or die "$0: cannot groupadd fex\n"; + my $gid = $g[2]; + if (getpwuid($gid)) { + system "useradd -s /bin/bash -c 'File EXchange' -g $gid -m fex" + } else { + system "useradd -s /bin/bash -c 'File EXchange' -u $gid -g $gid -m fex" + } exit $? if $?; } @@ -151,6 +163,12 @@ if ($FEXHOME !~ /fex/) { exit unless /^y/i; } +# old bug fix +if (-d "$FEXHOME/htdocs/locale") { + chmod 0755,"$FEXHOME/htdocs/locale"; + chmod 0755,grep { -d $_ } glob("$FEXHOME/locale/*/htdocs"); +} + print "Installing:\n"; $pecl = "$FEXHOME/perl/Encode/ConfigLocal.pm"; @@ -163,7 +181,7 @@ unless (-f $pecl) { "1;\n"; close $pecl; print $pecl,"\n"; - chownr('fex:root',"$FEXHOME/perl"); + chownr('fex:0',"$FEXHOME/perl"); } @save = ( @@ -211,6 +229,10 @@ if (-d "$FEXHOME/spool") { mkdir "$FEXHOME/spool",0700 or die "cannot mkdir $FEXHOME/spool - $!\n"; mkdir "$FEXHOME/spool/.error",0700; } +foreach my $dir (qw'.dkeys .ukeys .akeys .skeys .gkeys .xkeys .locks') { + mkdir "$FEXHOME/spool/$dir",0700; +} + chownr('fex',"$FEXHOME/spool/."); # fex-VM? @@ -314,6 +336,7 @@ if (@locales = glob "locale/*/lib/fup.pl") { chownr('fex',"$FEXHOME/locale/$locale"); $hl = "$FEXHOME/htdocs/locale/$locale"; symlink "$FEXHOME/locale/$locale/htdocs",$hl unless -l $hl; + chownr('fex',"$FEXHOME/htdocs/locale/$locale"); } else { push @nlocales,"./install $1\n"; } @@ -371,7 +394,7 @@ unless (-f $xinetd) { system qw'crontab -u fex fex.cron'; } - chownr('fex:root',$FEXHOME,"$FEXHOME/spool/."); + chownr('fex:0',$FEXHOME,"$FEXHOME/spool/.","$FEXHOME/htdocs/."); chmodr('go-r',"$FEXHOME/lib","$FEXHOME/cgi-bin","$FEXHOME/spool/."); print "\n"; @@ -391,12 +414,12 @@ unless (-f $xinetd) { if (@local_rdomains and not @local_rhosts) { print "\nWARNING:\n"; - print "In $fph you have @local_rdomains but not @local_rhosts!\n"; + print "In $fph you have \@local_rdomains but not \@local_rhosts!\n"; print "Selfregistrating of external users will not work!\n"; print "See ${fph}_new/\n"; } -if (`$sendmail -h 2>&1` =~ /exim/ and +if (`$sendmail -h 2>&1 /dev/null` !~ /\bfex\b/) { print "\nWARNING:\n"; print "$sendmail is exim\n";