X-Git-Url: http://git.treefish.org/fex.git/blobdiff_plain/e60096926213ce02293a261254ff065cae44c1c8..cdeb354c4dbb11b683f9f8c5db2861f3dc572c61:/install?ds=sidebyside diff --git a/install b/install index 9c49c06..7019bee 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) { @@ -63,8 +68,10 @@ if (not $ip and open P,'host $(hostname)|') { } } close P; - print "Your IP [$guessed_ip] : "; - chomp($ip = ); + unless (-f $xinetd) { + print "Your IP [$guessed_ip] : "; + chomp($ip = ); + } $ip ||= $guessed_ip; } @@ -119,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 $?; } @@ -209,8 +223,20 @@ 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? +if (open my $setup,'/root/bin/setup') { + while (<$setup>) { + exit if /#.*X-VM/; + } + close $setup; +} + system(qw'perl -p -i -e', 's:href="/?FAQ.html":href="/FAQ/FAQ.html":', "$FEXHOME/lib/fup.pl" @@ -226,7 +252,8 @@ close $fph; eval $conf; -die "no \$spooldir in $fph\n" unless $spooldir; +# die "no \$spooldir in $fph\n" unless $spooldir; +$spooldir ||= '/home/fex/spool'; die "\$spooldir=$spooldir is not a directory, see $fph\n" unless -d $spooldir; symlink $spooldir,"$FEXHOME/spool" unless -e "$FEXHOME/spool"; @sds1 = stat "$spooldir/."; @@ -256,6 +283,7 @@ if ($newinstall or not -s $aa) { last if $admin =~ /.\@./; print "admin must be a valid email address!\n"; } + $aa = "$spooldir/$admin/@"; while (not $admin_pw) { print "F*EX admin password: "; $admin_pw = ; @@ -302,6 +330,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"; } @@ -353,12 +382,13 @@ unless (-f $xinetd) { if ($crontab !~ /fex_cleanup/) { open $crontab,">fex.cron" or die "cannot create fex.cron - $!\n"; print {$crontab} $crontab,"\n"; + print {$crontab} " 3 2 * * * exec $FEXHOME/bin/backup\n"; print {$crontab} " 3 3 * * * exec $FEXHOME/bin/fex_cleanup\n"; close $crontab; - system qw(crontab -u fex fex.cron); + system qw'crontab -u fex fex.cron'; } - chownr('fex:root',"$FEXHOME $FEXHOME/spool/."); + chownr('fex:root',$FEXHOME,"$FEXHOME/spool/.","$FEXHOME/htdocs/."); chmodr('go-r',"$FEXHOME/lib","$FEXHOME/cgi-bin","$FEXHOME/spool/."); print "\n"; @@ -376,14 +406,17 @@ unless (-f $xinetd) { "< $FEXHOME/doc/newfeatures\n"; } +chmod 0755,"$FEXHOME/htdocs/locale"; +chmod 0755,glob("$FEXHOME/locale/*/htdocs"); + 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";