]> git.treefish.org Git - fex.git/blobdiff - install
Original release 20160328
[fex.git] / install
diff --git a/install b/install
index 6f0bb62a6e556f1cbf05ec1b357c41e398e1f2fe..7019bee3826e22a1bd46dc855e4d09a9722f40e2 100755 (executable)
--- a/install
+++ b/install
@@ -25,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) {
@@ -123,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 $?;
 }
 
@@ -213,6 +223,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?
@@ -316,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";
     }
@@ -373,7 +388,7 @@ unless (-f $xinetd) {
     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";
@@ -391,6 +406,9 @@ 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";