aru-d-at commented on PR #714:
URL: https://github.com/apache/age/pull/714#issuecomment-1478302511

   @jrgemignani I have this Batch script ready for Windows and have tested it.
   
   I also have the Bash script ready and tested on Linux but, haven't found a 
way to test it on Mac yet.
   
   Should I go ahead and commit them?
   
   **Batch script**
   ```
   @echo off
   setlocal
   
   set "minimum_version=1.18"
   set "installed_version="
   set "download_url=https://go.dev/dl/go1.19.7.windows-amd64.msi";
   
   :: Check if Go is installed and get its version
   set "go_path="
   for %%i in (go.exe) do set "go_path=%%~$PATH:i"
   if defined go_path (
        for /f "tokens=3" %%v in ('go version 2^>^&1') do set 
"installed_version=%%v"
   )
   
   :: If Go is not installed or the version is less than 1.18, prompt the user 
to install a new version
   if not defined installed_version (
        echo installing Go
        :: Download and install the latest version of Go
        powershell -Command "& {Invoke-WebRequest -Uri "%download_url%" 
-OutFile '%TEMP%\go-minimum-version.msi'}"
        start /wait msiexec /i "%TEMP%\go-minimum-version.msi"
        for /f "tokens=3" %%v in ('go version 2^>^&1') do set 
"installed_version=%%v"
   ) else if "%installed_version%" lss "%minimum_version%" (
       set /p "install_new_version=Go version %minimum_version% or higher is 
required. Would you like to install the latest version? (y/n)"
       if /i "%install_new_version%"=="y" (
           :: Download and install the latest version of Go
           powershell -Command "& {Invoke-WebRequest -Uri "%download_url%" 
-OutFile '%TEMP%\go-minimum-version.msi'}"
           start /wait msiexec /i "%TEMP%\go-minimum_version.msi"
           for /f "tokens=3" %%v in ('go version 2^>^&1') do set 
"installed_version=%%v"
       ) else (
           echo Please update Go version before installing driver.
           goto end
       )
   )
   
   :: Echo "a", "b", and "c"
   echo a
   echo b
   echo c
   pause
   :end
   pause
   endlocal
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to