From 4cbaa761542a91a958dbc29c029be6c427ea2537 Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Mon, 13 Jan 2020 19:51:27 +0200
Subject: [PATCH 01/15] The names for the batch files made no sense

---
 Windows-admin.bat => Install-as-admin.bat      | 0
 Windows-user.bat => Install-as-normal-user.bat | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename Windows-admin.bat => Install-as-admin.bat (100%)
 rename Windows-user.bat => Install-as-normal-user.bat (100%)

diff --git a/Windows-admin.bat b/Install-as-admin.bat
similarity index 100%
rename from Windows-admin.bat
rename to Install-as-admin.bat
diff --git a/Windows-user.bat b/Install-as-normal-user.bat
similarity index 100%
rename from Windows-user.bat
rename to Install-as-normal-user.bat
-- 
GitLab


From 2c56c3ffccfa36d7651e5e51dce9079fe6e64cfd Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 01:21:38 +0200
Subject: [PATCH 02/15] mkzip: File name changes

---
 mkzip | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkzip b/mkzip
index 54a56ba..24f16cc 100755
--- a/mkzip
+++ b/mkzip
@@ -3,8 +3,8 @@ version="$(git log --oneline | wc -l)"
 echo "Version: $version"
 
 mkdir anonymine-windows
-cp -t anonymine-windows foo README.txt Windows-admin.bat Windows-user.bat \
-    icon.ico cygwin-x86.exe cygwin-x86_64.exe
+cp -t anonymine-windows foo README.txt Install-as-admin.bat \
+    Install-as-normal-user.bat icon.ico cygwin-x86.exe cygwin-x86_64.exe
 zip -r ~www-data/archive/anonymine/windows/anonymine-windows-"${version}".zip \
     anonymine-windows
 rm -r anonymine-windows
-- 
GitLab


From 983f581a7bc96434363cd6344cccf54014b3f230 Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 01:22:11 +0200
Subject: [PATCH 03/15] foo: Install all shortcuts in current working directory
 unconditionally

---
 foo | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/foo b/foo
index 7a8d99d..780f828 100644
--- a/foo
+++ b/foo
@@ -223,7 +223,10 @@ install ()
     shortcut_wrap ()
     {
         # Args:
-        #       {-P|-D} name cmd title
+        #       {-P|-D|-l} name cmd title
+        #       -P start menu
+        #       -D desktop
+        #       -l local file
         # Invokes
         #       mkshortcut [-A] {-P|-D} -n <name> -a <mintty-args> \
         #       -i <icon> /bin/mintty.exe
@@ -235,8 +238,13 @@ install ()
         #
         echo "shortcut_wrap '$1' '$2' '$3' '$4'" >>log
         cmd="-h error -i '$(pwd)/icon.ico' -t '$4' -e /bin/bash -lc '$3'"
-        mkshortcut $mkshortcut_flags "$1" -n "$2" "-a $cmd" \
-            -i "$(pwd)/icon.ico" /bin/mintty.exe 2>>log
+        if [ "$1" = "-l" ]; then
+            mkshortcut  -n "$2" "-a $cmd" -i "$(pwd)/icon.ico" \
+                /bin/mintty.exe 2>>log
+        else
+            mkshortcut $mkshortcut_flags "$1" -n "$2" "-a $cmd" \
+                -i "$(pwd)/icon.ico" /bin/mintty.exe 2>>log
+        fi
     }
     
     # Get configuration before doing time consuming work.
@@ -294,12 +302,17 @@ install ()
     update      # update does ./configure && make && make install
 
     echo "Creating shortcuts..."
+    shortcut_wrap -l "$anonymine_lnk" "anonymine" "Anonymine"
     if [ $shortcut_d -ne 0 ]; then
         shortcut_wrap -D "$anonymine_lnk" "anonymine" "Anonymine"
     fi
     if [ $shortcut_m -ne 0 ]; then
         shortcut_wrap -P "$anonymine_lnk" "anonymine" "Anonymine"
     fi
+    shortcut_wrap -l "$update_anonymine_lnk" \
+        "cd \"$(pwd)\"; ./foo $self_mode update" "Updating Anonymine..."
+    shortcut_wrap -l "$uninstall_anonymine_lnk" \
+        "cd \"$(pwd)\"; ./foo $self_mode uninstall" "Uninstalling Anonymine..."
     if [ $maintenance_d -ne 0 ]; then
         shortcut_wrap -D "$update_anonymine_lnk" \
             "cd \"$(pwd)\"; ./foo $self_mode update" "Updating Anonymine..."
-- 
GitLab


From afd79a7cd0f314d80de69dba0bcf7e333c456a5c Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 01:22:26 +0200
Subject: [PATCH 04/15] New README

---
 README.txt | 183 ++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 132 insertions(+), 51 deletions(-)

diff --git a/README.txt b/README.txt
index d8db982..1803012 100644
--- a/README.txt
+++ b/README.txt
@@ -1,50 +1,126 @@
-It's a bit of a PITA at the moment, but I'm not going to make a better
-installer any time soon.
+Table of contents
+=================
+
+    Notes
+    Step 1  Extract folder and keep it
+    Step 2  Start batch files from command prompt (double clicking can fail)
+    Step 3  Choose mirror and click next a bunch of times
+    Step 4  Click next a bunch of times and answer yes/no questions.
+    Step 5  Installed
+    Authors
+    Manual installation
+    Advanced
 
 
-This zip file contains scripts for automated installation of Cygwin and
-Anonymine.
+Notes
+=====
 
+    Cygwin will take up quite a lot of space, nearly 1 GB.
 
-Installation instructions for Windows
-=====================================
+    It's supposed to be as easy as jsut starting the appropriate batch file,
+    but due to some bug, it sometimes only works if started from the command
+    prompt.
     
-    Notes
-    =====
+    Admin mode on Windows 10 seems to fail to install shortcuts.
+
+
+Step 1
+======
+
+    The batch files will need access to the other files in this zip file.
+
+    Extract the 'anonymine-windows' folder out from the zip file
+    and place it somewhere "convenient", eg. the documents folder.
+
+    The "important" thing is that it won't get deleted nor take up precious
+    screen space.  The icon and update/uninstall script is also kept in this
+    folder, if the folder is moved these will stop working.
+
+
+Step 2
+======
+
+    There are two batch files, 'Install-as-normal-user.bat' and
+    'Install-as-admin.bat', they do exactly what they say.
+
+    Due to some bug, it might silently crash in the middle of installation
+    if you double click the file.  It is more reliable to start them from
+    an open command prompt.
+
+    If you installed as a normal user AND you stored the 'anonymine-windows'
+    folder in Documents, you can start cmd.exe and type these commands:
+        cd Documents
+        Install-as-normal-user
+
+    This subsection for the Admin version only
+    ==========================================
     
-        - Cygwin will require almost 1 GB of disk space.
+        The admin version will install Cygwin and the game for all users on this
+        computer.  It will not trigger a UAC prompt by itself, so you will need
+        to start the command prompt as administrator or run the batch file as
+        administrator from Windows Explorer.
         
-        - The update and uninstall shortcuts require that the extracted
-          directory is not removed after installation.
-        
-        - The uninstall shortcut can't uninstall Cygwin.
-    
-    1.  Extract the directory "anonymine-windows" from this zip file to some
-        good place (somewhere where it won't clutter and where you're unlikely
-        to accidentally remove it).
-    
-    2a. Enter that extracted folder and start "Windows-user.bat".
-        (Windows-user.bat will install Cygwin in your home
-        directory and doesn't require administrator privileges.)
-        On some versions it can fail silently, if that happens try starting
-        the batch file from a cmd window.
-    
-    2b. If you want to install for all users, start the command prompt as
-        Administrator and navigate to this extracted directory and run
-        "Windows-admin.bat"
-    
-    3.  The batch file will launch the Cygwin which will ask you to select
-        a mirror to download Cygwin from.  After choosing the mirror you will
-        only have to click "next" a few times.
-        (This will only happen the first time you install the game.)
-        If you encounter an error suring installation, or if it's too slow,
-        you can go back and choose another mirror.
+        If it doesn't work from Windows Explorer, you'll need to start the
+        command prompt as administrator and navigate to the folder.
+
+
+Step 3
+======
+
+    The batch file should now have started, it will ask you to confirm that
+    you have read the README.  Then it will install Cygwin on your computer.
+
+    Cygwin's installer will ask for a bunch of things:
+        - You need to select a mirror, choose one that seems close.
+            - If you get errors later on, try going back and choose another
+              mirror.
+        - It will let you select / change the selection of packages to install.
+          This is not needed, just click next.
+
+
+Step 4
+======
+
+    After Cygwin has been installed, it will be used to automate the rest of
+    the installation with a bash script (the 'foo' file). Cygwin's installer
+    should restart automatically to install a few needed packages, you only
+    need to click Next until it's done.
     
-    4.  Answer the questions that appear in the console window.
+    The bash script is going to ask whether or not you'd like shortcuts to
+    be installed on the desktop and start menu, just answer yes or no.
+
+    Finally, it's going to install the game itself and then exit.
+
+    There should now exist whatever shortcuts you decided to install.
+    If they don't, you'll have to copy them from this folder and paste them
+    where they belong.
+
+
+Step 5
+======
+
+    The game can now be launched with the 'anonymine' command in the
+    Cygwin Terminal, and from any shortcuts you installed.
+
+    Updating and uninstalling can be done with the shortcuts.
+
+    Uninstallation is unable to remove Cygwin, but will tell you were it is
+    so you can delete it yourself.
+
+
+Authors
+=======
+
+    cygwin-x86.exe and cygwin-x86_64.exe are the 32/64-bit Cygwin installers
+    from https://cygwin.com/ their source code can be found at
+    https://sourceware.org/cygwin-apps/setup.html
+    Cygwin is free software distributed under the terms of the GPL.
     
-    5.  Do not remove, move or rename the extracted directory.
-        It is needed for updating and uninstalling Anonymine.
+    All other files are mine, and released under the terms of the
+    2-clause BSD license.  See https://gitlab.com/oskog97/anonymine-windows
+
 
+==============================================================================
 
 
 Manual installation
@@ -53,7 +129,7 @@ Manual installation
     1. Install Cygwin, but read step 2 first
     
     2. During the installation, make sure to select "git", "make" and
-       "python3" for installation.  And optionally a text editor such as "nano".
+       "python3" for installation. And optionally a text editor such as "nano".
     
     3. Start the Cygwin terminal
     
@@ -75,7 +151,7 @@ Manual installation
             git pull
             ./configure -v
             make
-            make install            
+            make install 
 
 
 For advanced users
@@ -92,23 +168,28 @@ For advanced users
     Files
     =====
     
-        Winows-user.bat       Cygwin in home directory, shortcuts for this user
+        Install-as-normal-user.bat  Cygwin in home directory, shortcuts for
+                                    this user only
       
-        Windows-admin.bat     Cygwin in C:\, shortcuts for all users (Does not
-                              work on Windows 10!) (On Windows 7 and 8 it must
-                              be ran from an Administrator cmd window, double
-                              clicking the bat file in Explorer will cause it
-                              to fail in the middle with no apparent reason.)
+        Install-as-admin.bat        Cygwin in C:\, shortcuts for all users
+                                    (Does not work on Windows 10!) (On Windows
+                                    7 and 8 it must be ran from an
+                                    Administrator cmd window, double clicking
+                                    the bat file in Explorer will cause it
+                                    to fail in the middle for no apparent
+                                    reason.)
         
-        foo                   The script that does everything, with Cygwin
+        foo                         The script that does everything except
+                                    install Cygwin.
         
-        icon.ico              Self-explanatory
+        icon.ico                    Self-explanatory
 
-        cygwin-x86.exe        32-bit installer for Cygwin
-        cygwin-x86_64.exe     64-bit installer for Cygwin
+        cygwin-x86.exe              32-bit installer for Cygwin
+        cygwin-x86_64.exe           64-bit installer for Cygwin
         
-      * anonymine/            Cloned from Gitlab
+      * anonymine/                  Cloned from Gitlab
       
-      * log                   git pull|clone, ./update, make, make install
+      * log                         Logfile, can be useful if there were
+                                    errors.
       
         If you downloaded from Gitlab, there will be other files as well.
-- 
GitLab


From 43265febb3c4beec2938ddd89d2d9746536318ab Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 01:26:33 +0200
Subject: [PATCH 05/15] Adjusted messages from batch files

---
 Install-as-admin.bat       | 17 +++++++++--------
 Install-as-normal-user.bat | 10 +++++-----
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/Install-as-admin.bat b/Install-as-admin.bat
index a6ad459..f4725d6 100644
--- a/Install-as-admin.bat
+++ b/Install-as-admin.bat
@@ -35,17 +35,18 @@ echo.
 echo  ******************************************************************************
 echo  *                                                                            *
 echo  * Windows 10:                                                                *
-echo  * Creating shortcuts doesn't work. It should work with Windows-user.bat      *
-echo  * You must run this from an Administrator cmd window, double clickin this    *
-echo  * file in Explorer will not work.                                            *
+echo  * - Creating shortcuts doesn't work. It should work with                     *
+echo  *   Install-as-normal-user.bat                                               *
+echo  * - You must run this from an Administrator cmd window, double clickin this  *
+echo  *   file in Explorer will not work.                                          *
 echo  *                                                                            *
-echo  * Maybe Windows 7 - 8.1 als            o:                                    *
-echo  * You might have to run this from an Administrator cmd window.               *
-echo  * Double clicking this file in Explorer might not work.                      *
+echo  * Maybe Windows 7 - 8.1 also:                                                *
+echo  * - You might have to run this from an Administrator cmd window as           *
+echo  *   double clicking this file in Explorer might not work.                    *
 echo  *                                                                            *
 echo  * Windows Vista and older:                                                   *
-echo  * Vista has not been tested, but will probably work like on 7.               *
-echo  * XP and 2003 will not work.  (Missing DLLs)                                 *
+echo  * - Vista has not been tested, but will probably work like on 7.             *
+echo  * - XP and 2003 will not work.  (Missing DLLs)                               *
 echo  *                                                                            *
 echo  ******************************************************************************
 echo Please email me if you find any undocumented bugs.
diff --git a/Install-as-normal-user.bat b/Install-as-normal-user.bat
index b84fc85..c82a659 100644
--- a/Install-as-normal-user.bat
+++ b/Install-as-normal-user.bat
@@ -35,15 +35,15 @@ echo.
 echo  ******************************************************************************
 echo  *                                                                            *
 echo  * Windows 10:                                                                *
-echo  * No known issues                                                            *
+echo  * - No known issues, woo-hoo                                                 *
 echo  *                                                                            *
 echo  * Maybe Windows 7 - 8.1:                                                     *
-echo  * You might have to run this from a cmd window. Double clicking this         *
-echo  * file in Explorer might not work.                                           *
+echo  * - You might have to run this from a cmd window. Double clicking this       *
+echo  *   file in Explorer might not work.                                         *
 echo  *                                                                            *
 echo  * Windows Vista and older:                                                   *
-echo  * Vista has not been tested, but will probably work like on 7.               *
-echo  * XP and 2003 will not work.  (Missing DLLs)                                 *
+echo  * - Vista has not been tested, but will probably work like on 7.             *
+echo  * - XP and 2003 will not work.  (Missing DLLs)                               *
 echo  *                                                                            *
 echo  ******************************************************************************
 echo Please email me if you find any undocumented bugs.
-- 
GitLab


From 6ec3ec59cba26bfbe1ebbc60c07b5a3cd5139fd1 Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 01:32:15 +0200
Subject: [PATCH 06/15] Dodgy binary only conveying of GPL'ed programs...

---
 LICENSE    | 14 +++++++++++---
 README.txt |  2 ++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/LICENSE b/LICENSE
index 7a5b4ac..3581178 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,8 +1,16 @@
-cygwin-x86.exe and cygwin-x86_64.exe are fetched from Cygwin's website.
-https://cygwin.com/
+cygwin-x86.exe and cygwin-x86_64.exe are fetched from Cygwin's website:
+<https://cygwin.com/>
+Source code available at https://sourceware.org/cygwin-apps/setup.html
+Cygwin is free software distributed under the terms of the GNU General
+Public License.  The inclusion of these binary files are needed because
+BITSADMIN doesn't support TLS 1.2 making it impossible to fetch those
+files from Cygwin's homepage.
 
 
-Copyright (c) Oskar Skog, 2016-2017
+For all other files, the following applies:
+===========================================
+
+Copyright (c) Oskar Skog, 2016-2020
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
diff --git a/README.txt b/README.txt
index 1803012..0fdf9c8 100644
--- a/README.txt
+++ b/README.txt
@@ -115,6 +115,8 @@ Authors
     from https://cygwin.com/ their source code can be found at
     https://sourceware.org/cygwin-apps/setup.html
     Cygwin is free software distributed under the terms of the GPL.
+    These binaries are only included here, because BITSADMIN doesn't support
+    TLS 1.2 so they can't be fetched automatically.
     
     All other files are mine, and released under the terms of the
     2-clause BSD license.  See https://gitlab.com/oskog97/anonymine-windows
-- 
GitLab


From cbe37308d087310978251aed7a7145b97a0ac844 Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 01:34:31 +0200
Subject: [PATCH 07/15] Incude LICENSE.txt in the zip files

---
 LICENSE => LICENSE.txt | 70 +++++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 35 deletions(-)
 rename LICENSE => LICENSE.txt (98%)

diff --git a/LICENSE b/LICENSE.txt
similarity index 98%
rename from LICENSE
rename to LICENSE.txt
index 3581178..df738c9 100644
--- a/LICENSE
+++ b/LICENSE.txt
@@ -1,35 +1,35 @@
-cygwin-x86.exe and cygwin-x86_64.exe are fetched from Cygwin's website:
-<https://cygwin.com/>
-Source code available at https://sourceware.org/cygwin-apps/setup.html
-Cygwin is free software distributed under the terms of the GNU General
-Public License.  The inclusion of these binary files are needed because
-BITSADMIN doesn't support TLS 1.2 making it impossible to fetch those
-files from Cygwin's homepage.
-
-
-For all other files, the following applies:
-===========================================
-
-Copyright (c) Oskar Skog, 2016-2020
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1.  Redistributions of source code must retain the above copyright notice,
-    this list of conditions and the following disclaimer.
-
-2.  Redistributions in binary form must reproduce the above copyright notice,
-    this list of conditions and the following disclaimer in the documentation
-    and/or other materials provided with the distribution.
-
-This software is provided by the copyright holders and contributors "as is"
-and any express or implied warranties, including, but not limited to, the
-implied warranties of merchantability and fitness for a particular purpose
-are disclaimed. In no event shall the copyright holder or contributors be
-liable for any direct, indirect, incidental, special, exemplary, or
-consequential damages (including, but not limited to, procurement of
-substitute goods or services; loss of use, data, or profits; or business
-interruption) however caused and on any theory of liability, whether in
-contract, strict liability, or tort (including negligence or otherwise)
-arising in any way out of the use of this software, even if advised of the
-possibility of such damage.
+cygwin-x86.exe and cygwin-x86_64.exe are fetched from Cygwin's website:
+<https://cygwin.com/>
+Source code available at https://sourceware.org/cygwin-apps/setup.html
+Cygwin is free software distributed under the terms of the GNU General
+Public License.  The inclusion of these binary files are needed because
+BITSADMIN doesn't support TLS 1.2 making it impossible to fetch those
+files from Cygwin's homepage.
+
+
+For all other files, the following applies:
+===========================================
+
+Copyright (c) Oskar Skog, 2016-2020
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1.  Redistributions of source code must retain the above copyright notice,
+    this list of conditions and the following disclaimer.
+
+2.  Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+This software is provided by the copyright holders and contributors "as is"
+and any express or implied warranties, including, but not limited to, the
+implied warranties of merchantability and fitness for a particular purpose
+are disclaimed. In no event shall the copyright holder or contributors be
+liable for any direct, indirect, incidental, special, exemplary, or
+consequential damages (including, but not limited to, procurement of
+substitute goods or services; loss of use, data, or profits; or business
+interruption) however caused and on any theory of liability, whether in
+contract, strict liability, or tort (including negligence or otherwise)
+arising in any way out of the use of this software, even if advised of the
+possibility of such damage.
-- 
GitLab


From ed1198c52305846c2dabce404f1fa7b67670feb3 Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 01:34:53 +0200
Subject: [PATCH 08/15] Incude LICENSE.txt in the zip files

---
 mkzip | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mkzip b/mkzip
index 24f16cc..f98ccdc 100755
--- a/mkzip
+++ b/mkzip
@@ -3,7 +3,7 @@ version="$(git log --oneline | wc -l)"
 echo "Version: $version"
 
 mkdir anonymine-windows
-cp -t anonymine-windows foo README.txt Install-as-admin.bat \
+cp -t anonymine-windows foo README.txt LICENSE.txt Install-as-admin.bat \
     Install-as-normal-user.bat icon.ico cygwin-x86.exe cygwin-x86_64.exe
 zip -r ~www-data/archive/anonymine/windows/anonymine-windows-"${version}".zip \
     anonymine-windows
-- 
GitLab


From 658d51b7e85e62d04f5b6b0a2990052e07f8c938 Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 01:55:02 +0200
Subject: [PATCH 09/15] Corrected step 4

---
 README.txt | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/README.txt b/README.txt
index 0fdf9c8..423d3ac 100644
--- a/README.txt
+++ b/README.txt
@@ -81,16 +81,17 @@ Step 3
 Step 4
 ======
 
-    After Cygwin has been installed, it will be used to automate the rest of
-    the installation with a bash script (the 'foo' file). Cygwin's installer
-    should restart automatically to install a few needed packages, you only
-    need to click Next until it's done.
+    Cygwin will now run a bash script that is going to ask whether or not
+    you'd like shortcuts to be installed on the desktop and start menu, just
+    answer yes or no.
+    
+    Cygwin's installer should be started automatically to install a few needed
+    packages, you should only need to click Next until it's done.
+    
+    One more question (actually from the updating script) that you should
+    answer no to, and after that the game should be installed very quickly
+    and the bash script will exit.
     
-    The bash script is going to ask whether or not you'd like shortcuts to
-    be installed on the desktop and start menu, just answer yes or no.
-
-    Finally, it's going to install the game itself and then exit.
-
     There should now exist whatever shortcuts you decided to install.
     If they don't, you'll have to copy them from this folder and paste them
     where they belong.
-- 
GitLab


From f102df851e9ad520bdaf6a8ae139d7cb4dca30fe Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 14:53:59 +0200
Subject: [PATCH 10/15] foo: Fixed messy logging in update()

---
 foo | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/foo b/foo
index 780f828..32ad8a5 100644
--- a/foo
+++ b/foo
@@ -125,10 +125,11 @@ update ()
             if ask "1: Attempt manual repair"; then
                 echo "This is a new shell; Exit when you're done fixing."
                 echo "The log file is ../log"
-                script -q -a ../log
+                #script -q -a ../log.script
+                bash
                 echo "Yes to exit, no to retry or restore from backup"
                 if ask "Installation/update complete"; then
-                    echo "foo: User installed manually"
+                    echo "foo: User installed manually" >>../log
                     break
                 fi
             fi
-- 
GitLab


From e3309792b95abd57f36402205900ee749fbdfe85 Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 15:11:21 +0200
Subject: [PATCH 11/15] Detect absence of needed files; Silence the workaround

---
 Install-as-admin.bat       | 19 ++++++++++++++-----
 Install-as-normal-user.bat | 19 +++++++++++++++----
 README.txt                 |  9 ++++++---
 3 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/Install-as-admin.bat b/Install-as-admin.bat
index f4725d6..cb6e936 100644
--- a/Install-as-admin.bat
+++ b/Install-as-admin.bat
@@ -30,14 +30,20 @@ if not exist %systemroot%\SysWOW64\ set src=%src32%
     :: http://ss64.com/nt/bitsadmin.html
 
 cls
-echo !!!! Did you read the README?  If you didn't, close this window and try again.
-echo.
+
+if not exist foo (
+    echo ERROR: Can't find the rest of the files
+    echo You need to extract all files from the zip file, see README.txt
+    pause
+    exit 1
+)
+
 echo  ******************************************************************************
 echo  *                                                                            *
 echo  * Windows 10:                                                                *
 echo  * - Creating shortcuts doesn't work. It should work with                     *
 echo  *   Install-as-normal-user.bat                                               *
-echo  * - You must run this from an Administrator cmd window, double clickin this  *
+echo  * - You must run this from an Administrator cmd window, double clicking this *
 echo  *   file in Explorer will not work.                                          *
 echo  *                                                                            *
 echo  * Maybe Windows 7 - 8.1 also:                                                *
@@ -46,7 +52,7 @@ echo  *   double clicking this file in Explorer might not work.
 echo  *                                                                            *
 echo  * Windows Vista and older:                                                   *
 echo  * - Vista has not been tested, but will probably work like on 7.             *
-echo  * - XP and 2003 will not work.  (Missing DLLs)                               *
+echo  * - XP or 2003 will not work.  (Missing DLLs)                                *
 echo  *                                                                            *
 echo  ******************************************************************************
 echo Please email me if you find any undocumented bugs.
@@ -77,5 +83,8 @@ if exist %cygwin_setup% (
 
 :: bash -l to use the Cygwin $PATH rather than the MS %PATH%.
 :: Then you'll need to go back to $OLDPWD.
-%cygwin_dir%\bin\bash -lc 'echo "(Workaround): Do not remove!"'
+:: Something special needs to be done??
+:: %cygwin_dir%\bin\bash -lc 'echo "(Workaround): Do not remove!"'
+%cygwin_dir%\bin\bash -lc 'echo'
+%cygwin_dir%\bin\bash -lc 'echo'
 %cygwin_dir%\bin\bash -lc 'cd $OLDPWD; ./foo admin install'
diff --git a/Install-as-normal-user.bat b/Install-as-normal-user.bat
index c82a659..17cbe91 100644
--- a/Install-as-normal-user.bat
+++ b/Install-as-normal-user.bat
@@ -30,12 +30,20 @@ if not exist %systemroot%\SysWOW64\ set src=%src32%
     :: http://ss64.com/nt/bitsadmin.html
 
 cls
-echo !!!! Did you read the README?  If you didn't, close this window and try again.
+
+if not exist foo (
+    echo ERROR: Can't find the rest of the files
+    echo You need to extract all files from the zip file, see README.txt
+    pause
+    exit 1
+)
+                
+
 echo.
 echo  ******************************************************************************
 echo  *                                                                            *
 echo  * Windows 10:                                                                *
-echo  * - No known issues, woo-hoo                                                 *
+echo  * - No known issues                                                          *
 echo  *                                                                            *
 echo  * Maybe Windows 7 - 8.1:                                                     *
 echo  * - You might have to run this from a cmd window. Double clicking this       *
@@ -43,7 +51,7 @@ echo  *   file in Explorer might not work.
 echo  *                                                                            *
 echo  * Windows Vista and older:                                                   *
 echo  * - Vista has not been tested, but will probably work like on 7.             *
-echo  * - XP and 2003 will not work.  (Missing DLLs)                               *
+echo  * - XP or 2003 will not work.  (Missing DLLs)                                *
 echo  *                                                                            *
 echo  ******************************************************************************
 echo Please email me if you find any undocumented bugs.
@@ -74,5 +82,8 @@ if exist %cygwin_setup% (
 
 :: bash -l to use the Cygwin $PATH rather than the MS %PATH%.
 :: Then you'll need to go back to $OLDPWD.
-%cygwin_dir%\bin\bash -lc 'echo "(Workaround): Do not remove!"'
+:: Something special needs to be done??
+:: %cygwin_dir%\bin\bash -lc 'echo "(Workaround): Do not remove!"'
+%cygwin_dir%\bin\bash -lc 'echo'
+%cygwin_dir%\bin\bash -lc 'echo'
 %cygwin_dir%\bin\bash -lc 'cd $OLDPWD; ./foo user install'
diff --git a/README.txt b/README.txt
index 423d3ac..4153b73 100644
--- a/README.txt
+++ b/README.txt
@@ -16,7 +16,10 @@ Notes
 =====
 
     Cygwin will take up quite a lot of space, nearly 1 GB.
-
+    
+    The batch files requires some of the other files in this folder. You need
+    to extract the entire folder from the zip file.
+    
     It's supposed to be as easy as jsut starting the appropriate batch file,
     but due to some bug, it sometimes only works if started from the command
     prompt.
@@ -67,8 +70,8 @@ Step 2
 Step 3
 ======
 
-    The batch file should now have started, it will ask you to confirm that
-    you have read the README.  Then it will install Cygwin on your computer.
+    The batch file should now have started, it will notify you about any known
+    issues, then it will install Cygwin on your computer.
 
     Cygwin's installer will ask for a bunch of things:
         - You need to select a mirror, choose one that seems close.
-- 
GitLab


From e6f8e78ddd20cbfa56f5958385884c862d72f0aa Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 15:30:51 +0200
Subject: [PATCH 12/15] Fixed some stuff

---
 README.txt | 14 +++++++-------
 foo        | 43 ++++++++++++++++++++++++-------------------
 2 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/README.txt b/README.txt
index 4153b73..f8a59c4 100644
--- a/README.txt
+++ b/README.txt
@@ -20,7 +20,7 @@ Notes
     The batch files requires some of the other files in this folder. You need
     to extract the entire folder from the zip file.
     
-    It's supposed to be as easy as jsut starting the appropriate batch file,
+    It's supposed to be as easy as just starting the appropriate batch file,
     but due to some bug, it sometimes only works if started from the command
     prompt.
     
@@ -87,14 +87,14 @@ Step 4
     Cygwin will now run a bash script that is going to ask whether or not
     you'd like shortcuts to be installed on the desktop and start menu, just
     answer yes or no.
-    
+
     Cygwin's installer should be started automatically to install a few needed
     packages, you should only need to click Next until it's done.
-    
-    One more question (actually from the updating script) that you should
-    answer no to, and after that the game should be installed very quickly
-    and the bash script will exit.
-    
+
+    When the packages have been installed, the bash script will install the
+    game in just a few seconds. If something unexpected occurs, there may be a
+    few other questions.
+        
     There should now exist whatever shortcuts you decided to install.
     If they don't, you'll have to copy them from this folder and paste them
     where they belong.
diff --git a/foo b/foo
index 32ad8a5..46a70c9 100644
--- a/foo
+++ b/foo
@@ -103,11 +103,15 @@ update ()
     echo >>log; echo >>log; echo >>log;
     echo "foo: Updating anonymine... ($(date))" >>log;
 
-    ask 'Update Cygwin' && cyg_setup -g
+    if [ "$1" != "first-time" ]; then
+        ask 'Update Cygwin' && cyg_setup -g
+    fi
     
     cp -r anonymine anonymine-backup
     restore=false
-    
+
+    # Don't bother looping, the newtork must have worked for Cygwin
+    # to be installed.
     cd anonymine || {
         echo "foo: FAILED: git-clone of Anonymine not found" >>log;
         fatal "git-clone of Anonymine not found";
@@ -127,6 +131,7 @@ update ()
                 echo "The log file is ../log"
                 #script -q -a ../log.script
                 bash
+                echo; echo
                 echo "Yes to exit, no to retry or restore from backup"
                 if ask "Installation/update complete"; then
                     echo "foo: User installed manually" >>../log
@@ -151,7 +156,7 @@ update ()
         echo "foo: srcdir/builddir moved to anonymine-failed" >>log
         mv anonymine-backup anonymine
         cd anonymine && make install || fatal "Failed to restore backup"
-        echo "Update failed, backup successfull"
+        echo "Update failed, backup successfull" | tee -a log
     else
         rm -rf anonymine-backup
     fi
@@ -162,9 +167,8 @@ uninstall ()
 {
     ask "Uninstall Anonymine?" || exit
     
-    # Failing to cd into anonymine, but succeeding to cd to ../ .....
+    # cd into anonymine can fail
     (cd anonymine; make uninstall; cd ..) 2>&1 | tee -a log
-    # ..... caused really nasty trouble:
     rm -rf anonymine 2>&1 | tee -a log
     
     # Remove shortcuts:
@@ -224,18 +228,19 @@ install ()
     shortcut_wrap ()
     {
         # Args:
-        #       {-P|-D|-l} name cmd title
-        #       -P start menu
-        #       -D desktop
-        #       -l local file
+        #     {-P|-D|-l} name cmd title
+        #     -P start menu
+        #     -D desktop
+        #     -l local file
         # Invokes
-        #       mkshortcut [-A] {-P|-D} -n <name> -a <mintty-args> \
-        #       -i <icon> /bin/mintty.exe
+        #     mkshortcut [-A] {-P|-D} -n <name> -a <mintty-args> \
+        #     -i <icon> /bin/mintty.exe
+        #     mkshortcut -n <name> -a <mintty-args> -i <icon> /bin/mintty.exe
         # Command
-        #       /bin/mintty -t "<title>" -i <icon> -h error \
-        #           -e /bin/bash -lc "<command>"
-        #       Bash: -l flag needed for bash to set the PATH variable, etc
-        #       Use `cd` to move into the working directory
+        #     /bin/mintty -t "<title>" -i <icon> -h error \
+        #         -e /bin/bash -lc "<command>"
+        #     Bash: -l flag needed for bash to set the PATH variable, etc
+        #     Use `cd` to move into the working directory
         #
         echo "shortcut_wrap '$1' '$2' '$3' '$4'" >>log
         cmd="-h error -i '$(pwd)/icon.ico' -t '$4' -e /bin/bash -lc '$3'"
@@ -298,10 +303,10 @@ install ()
         echo "foo: FAILED: Could not download Anonymine." >>log;
         fatal "Could not download Anonymine.";
     }
-    # "Update Cygwin" is easy to miss
-    echo; echo; echo; echo "Just answer no here"
-    update      # update does ./configure && make && make install
-
+    
+    # update does ./configure && make && make install
+    update first-time
+    
     echo "Creating shortcuts..."
     shortcut_wrap -l "$anonymine_lnk" "anonymine" "Anonymine"
     if [ $shortcut_d -ne 0 ]; then
-- 
GitLab


From 487e94dbdeed6df9b1b3a501f3b2ed202f125162 Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 15:39:02 +0200
Subject: [PATCH 13/15] Windows Explorer in Windows 7 and 10 will notify users
 to extract everything

---
 Install-as-admin.bat       | 5 ++++-
 Install-as-normal-user.bat | 2 +-
 README.txt                 | 9 ++-------
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/Install-as-admin.bat b/Install-as-admin.bat
index cb6e936..7423028 100644
--- a/Install-as-admin.bat
+++ b/Install-as-admin.bat
@@ -33,11 +33,13 @@ cls
 
 if not exist foo (
     echo ERROR: Can't find the rest of the files
-    echo You need to extract all files from the zip file, see README.txt
+    echo You need to extract all files from the zip file.
     pause
     exit 1
 )
 
+echo This batch file needs to be run as adminstrator.
+echo
 echo  ******************************************************************************
 echo  *                                                                            *
 echo  * Windows 10:                                                                *
@@ -55,6 +57,7 @@ echo  * - Vista has not been tested, but will probably work like on 7.
 echo  * - XP or 2003 will not work.  (Missing DLLs)                                *
 echo  *                                                                            *
 echo  ******************************************************************************
+echo
 echo Please email me if you find any undocumented bugs.
 pause
 echo.
diff --git a/Install-as-normal-user.bat b/Install-as-normal-user.bat
index 17cbe91..9ed2324 100644
--- a/Install-as-normal-user.bat
+++ b/Install-as-normal-user.bat
@@ -33,7 +33,7 @@ cls
 
 if not exist foo (
     echo ERROR: Can't find the rest of the files
-    echo You need to extract all files from the zip file, see README.txt
+    echo You need to extract all files from the zip file.
     pause
     exit 1
 )
diff --git a/README.txt b/README.txt
index f8a59c4..44f6f33 100644
--- a/README.txt
+++ b/README.txt
@@ -17,9 +17,6 @@ Notes
 
     Cygwin will take up quite a lot of space, nearly 1 GB.
     
-    The batch files requires some of the other files in this folder. You need
-    to extract the entire folder from the zip file.
-    
     It's supposed to be as easy as just starting the appropriate batch file,
     but due to some bug, it sometimes only works if started from the command
     prompt.
@@ -30,11 +27,9 @@ Notes
 Step 1
 ======
 
-    The batch files will need access to the other files in this zip file.
-
     Extract the 'anonymine-windows' folder out from the zip file
-    and place it somewhere "convenient", eg. the documents folder.
-
+    and place it somewhere "convenient", eg. the Documents folder.
+    
     The "important" thing is that it won't get deleted nor take up precious
     screen space.  The icon and update/uninstall script is also kept in this
     folder, if the folder is moved these will stop working.
-- 
GitLab


From 4004e59be334656150bca1a988e425c9eb561cc0 Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 15:53:50 +0200
Subject: [PATCH 14/15] Tested/fixed README

---
 README.txt | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/README.txt b/README.txt
index 44f6f33..f43fd49 100644
--- a/README.txt
+++ b/README.txt
@@ -30,9 +30,12 @@ Step 1
     Extract the 'anonymine-windows' folder out from the zip file
     and place it somewhere "convenient", eg. the Documents folder.
     
-    The "important" thing is that it won't get deleted nor take up precious
-    screen space.  The icon and update/uninstall script is also kept in this
-    folder, if the folder is moved these will stop working.
+    The "important" thing is that it won't get deleted (Downloads is probably
+    not a good place), and won't take up precious screen space (Desktop is
+    also proabably not a good place).
+    
+    The icon and update/uninstall script is also kept in this folder, if the
+    folder is moved these will stop working.
 
 
 Step 2
@@ -40,16 +43,19 @@ Step 2
 
     There are two batch files, 'Install-as-normal-user.bat' and
     'Install-as-admin.bat', they do exactly what they say.
-
-    Due to some bug, it might silently crash in the middle of installation
+    
+    Due to some bug, it MIGHT silently crash in the middle of installation
     if you double click the file.  It is more reliable to start them from
-    an open command prompt.
-
+    the command prompt.
+    
     If you installed as a normal user AND you stored the 'anonymine-windows'
     folder in Documents, you can start cmd.exe and type these commands:
-        cd Documents
+        cd Documents\anonymine-windows*
+        cd anonymine-windows
         Install-as-normal-user
-
+    (Explorer may put anonymine-windows in a new folder, hence the two
+    cd commands.)
+    
     This subsection for the Admin version only
     ==========================================
     
@@ -74,6 +80,8 @@ Step 3
               mirror.
         - It will let you select / change the selection of packages to install.
           This is not needed, just click next.
+        - Desktop and Start menu icons, these are for Cygwin's terminal, you
+          don't need them.
 
 
 Step 4
@@ -85,8 +93,7 @@ Step 4
 
     Cygwin's installer should be started automatically to install a few needed
     packages, you should only need to click Next until it's done.
-
-    When the packages have been installed, the bash script will install the
+      When the packages have been installed, the bash script will install the
     game in just a few seconds. If something unexpected occurs, there may be a
     few other questions.
         
-- 
GitLab


From faf52736cd3eb9bd63fca23e12da955a86456c0e Mon Sep 17 00:00:00 2001
From: Oskar Skog <oskar@oskog97.com>
Date: Tue, 14 Jan 2020 16:06:15 +0200
Subject: [PATCH 15/15] Changed bug message

---
 Install-as-admin.bat       | 11 +++++------
 Install-as-normal-user.bat |  6 +++---
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/Install-as-admin.bat b/Install-as-admin.bat
index 7423028..c88267c 100644
--- a/Install-as-admin.bat
+++ b/Install-as-admin.bat
@@ -9,7 +9,6 @@ set cygwin_setup=%cygwin_dir%\setup.exe
 
 :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
-:: URLs and valid destination file names.
 set src64=cygwin-x86_64.exe
 set src32=cygwin-x86.exe
 
@@ -38,8 +37,8 @@ if not exist foo (
     exit 1
 )
 
-echo This batch file needs to be run as adminstrator.
-echo
+echo !! This batch file needs to be run as adminstrator !!
+echo.
 echo  ******************************************************************************
 echo  *                                                                            *
 echo  * Windows 10:                                                                *
@@ -48,7 +47,7 @@ echo  *   Install-as-normal-user.bat
 echo  * - You must run this from an Administrator cmd window, double clicking this *
 echo  *   file in Explorer will not work.                                          *
 echo  *                                                                            *
-echo  * Maybe Windows 7 - 8.1 also:                                                *
+echo  * Windows 7 - 8.1:                                                           *
 echo  * - You might have to run this from an Administrator cmd window as           *
 echo  *   double clicking this file in Explorer might not work.                    *
 echo  *                                                                            *
@@ -57,8 +56,8 @@ echo  * - Vista has not been tested, but will probably work like on 7.
 echo  * - XP or 2003 will not work.  (Missing DLLs)                                *
 echo  *                                                                            *
 echo  ******************************************************************************
-echo
-echo Please email me if you find any undocumented bugs.
+echo.
+echo Bugs can be reported to https://gitlab.com/oskog97/anonymine-windows/issues
 pause
 echo.
 echo.
diff --git a/Install-as-normal-user.bat b/Install-as-normal-user.bat
index 9ed2324..5967a0e 100644
--- a/Install-as-normal-user.bat
+++ b/Install-as-normal-user.bat
@@ -9,7 +9,6 @@ set cygwin_setup=%cygwin_dir%\setup.exe
 
 :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
-:: URLs and valid destination file names.
 set src64=cygwin-x86_64.exe
 set src32=cygwin-x86.exe
 
@@ -45,7 +44,7 @@ echo  *
 echo  * Windows 10:                                                                *
 echo  * - No known issues                                                          *
 echo  *                                                                            *
-echo  * Maybe Windows 7 - 8.1:                                                     *
+echo  * Windows 7 - 8.1:                                                           *
 echo  * - You might have to run this from a cmd window. Double clicking this       *
 echo  *   file in Explorer might not work.                                         *
 echo  *                                                                            *
@@ -54,7 +53,8 @@ echo  * - Vista has not been tested, but will probably work like on 7.
 echo  * - XP or 2003 will not work.  (Missing DLLs)                                *
 echo  *                                                                            *
 echo  ******************************************************************************
-echo Please email me if you find any undocumented bugs.
+echo.
+echo Bugs can be reported to https://gitlab.com/oskog97/anonymine-windows/issues
 pause
 echo.
 echo.
-- 
GitLab