X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/c65ee6f7429eff9a7f58aad7c0aec858ad473092..3aae246cf7f4af7ae49da09e5ed0c180f31f0c12:/htdocs/fexitinstaller

diff --git a/htdocs/fexitinstaller b/htdocs/fexitinstaller
index 3054e57..df1c887 100644
--- a/htdocs/fexitinstaller
+++ b/htdocs/fexitinstaller
@@ -1,34 +1,39 @@
 #!/usr/bin/perl -w
 
 $user = $ENV{USER};
-$id = $ENV{ID};
+$authid = $ENV{ID};
 $url = "$ENV{PROTO}://$ENV{HTTP_HOST}";
 $fi = 'fexitinstaller.cmd';
+$id = '%USERPROFILE%\\fex\\id';
 $fe = 'http://fex.belwue.de/download/fexit.exe';
+$fx = '%USERPROFILE%\\Desktop\\fexit.exe';
 $ps = '%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe';
 $cmd = <<EOD;
-mkdir "%USERPROFILE%\\fex"
-cd "%USERPROFILE%\\fex"
-if not exist id (
-  echo $url>id
-  echo $user>>id
-  echo $id>>id
-)
-cd "%USERPROFILE%\\Desktop"
-$ps -command "& { (New-Object Net.WebClient).DownloadFile('$fe','fexit.exe') }"
-\@explorer "%USERPROFILE%\\Desktop"
-\@set /p x="press [ENTER]"
+  mkdir "%USERPROFILE%\\fex"
+  if not exist "$id" (
+    echo $url>"$id"
+    echo $user>>"$id"
+    echo $authid>>"$id"
+  )
+  $ps -command "& { (New-Object Net.WebClient).DownloadFile('$fe','$fx') }"
+  setx PATH "%PATH%;%USERPROFILE%\\Desktop"
+  \@echo.
+  \@set /p x="See fexit on Desktop."
 EOD
+#  \@explorer "%USERPROFILE%\\Desktop"
+$cmd =~ s/^  //gm;
 $cmd =~ s/\n/\r\n/g;
 
-if (chdir "$spooldir/$user" and open $fi,'>',$fi) {
+if (chdir "$::spooldir/$user" and open $fi,'>',$fi) {
   print {$fi} $cmd;
   close $fi;
-  system "$FEXHOME/bin/fexsend ".
-         "-oKq -C 'fexit for your Windows desktop' $fi $user >/dev/null";
+  system "$::FEXHOME/bin/fexsend ".
+         "-oKq -C 'fexit for your Windows desktop' $fi $user >/dev/null 2>&1";
   if ($? == 0) {
     print "<p>\n";
     print "<h3>A fexit installer has been sent to you. Check your email.</h3>\n";
   }
   unlink $fi;
 }
+
+return '';