Skip to content

Commit

Permalink
feat: fix windows installer (#6043)
Browse files Browse the repository at this point in the history
Description
---
A recent PR changed how the default `config.toml` file is created based
on user input, so that it cannot be created ahead of time anymore. This
PR applies that behaviour to the Windows installer.

Motivation and Context
---
See above

How Has This Been Tested?
---
Generated the install file, tested the installation as well as the
runtime

What process can a PR reviewer use to test or verify this change?
---
As above

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
  • Loading branch information
hansieodendaal committed Dec 13, 2023
1 parent f394fd8 commit c37a0a8
Show file tree
Hide file tree
Showing 25 changed files with 42 additions and 164 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/base_node_binaries.yml
Expand Up @@ -361,13 +361,11 @@ jobs:
name: ${{ env.TBN_FILENAME }}-${{ matrix.builds.name }}-${{ env.VERSION }}.pkg
path: "${{ env.distDirPKG }}/${{ env.TBN_FILENAME }}-${{ matrix.builds.name }}-${{ env.VERSION }}*.pkg*"

# unlike inno script studio, iscc.exe doesn't run the [precompile] step generate_config.bat
- name: Build the Windows installer
shell: cmd
if: startsWith(runner.os,'Windows')
run: |
cd buildtools
call generate_config.bat
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "/DMyAppVersion=${{ env.VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer" "/DMinotariSuite=${{ env.TBN_FILENAME }}" "/DTariSuitePath=${{ github.workspace }}${{ env.TBN_DIST }}" "windows_inno_installer.iss"
cd Output
echo "Compute archive shasum"
Expand Down
Expand Up @@ -2,16 +2,6 @@
title Minotari Wallet

rem Verify arguments
if ["%config_path%"]==[""] (
echo Problem with "config_path" environment variable: '%config_path%'
pause
exit /b 10101
)
if not exist "%config_path%" (
echo Path as per "config_path" environment variable not found: '%config_path%'
pause
exit /b 10101
)
if ["%base_path%"]==[""] (
echo Problem with "base_path" environment variable: '%base_path%'
pause
Expand Down Expand Up @@ -61,19 +51,13 @@ if exist "%my_exe_path%\%my_exe%" (

echo.
echo.
if not exist "%config_path%\log4rs_console_wallet.yml" (
echo Creating new "%config_path%\log4rs_console_wallet.yml".
) else (
echo Using existing "%config_path%\log4rs_console_wallet.yml"
)
echo.

cd "%base_path%"
rem check if Windows Terminal is in path, if so, run it there, to see emojis properly.
where /q wt
if errorlevel 1 (
"%console_wallet%" --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_console_wallet.yml" --base-path "%base_path%"
"%console_wallet%" --base-path "%base_path%"
) else (
wt "%console_wallet%" --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_console_wallet.yml" --base-path "%base_path%"
wt "%console_wallet%" --base-path "%base_path%"
exit
)
Expand Up @@ -6,10 +6,6 @@ echo ----------------------------
rem These are the console wallet executable and SQLite dynamic link library names
set my_exe=minotari_console_wallet.exe

rem This is the location of the configuration and identity files
set config_path=%~dp0..\config
echo config_path = %config_path%

rem The default location for the console wallet executable
set my_exe_path=%~dp0
if %my_exe_path:~-1%==\ set my_exe_path=%my_exe_path:~0,-1%
Expand Down
Expand Up @@ -2,16 +2,6 @@
title Minotari Merge Mining Proxy

rem Verify arguments
if ["%config_path%"]==[""] (
echo Problem with "config_path" environment variable: '%config_path%'
pause
exit /b 10101
)
if not exist "%config_path%" (
echo Path as per "config_path" environment variable not found: '%config_path%'
pause
exit /b 10101
)
if ["%base_path%"]==[""] (
echo Problem with "base_path" environment variable: '%base_path%'
pause
Expand Down Expand Up @@ -59,19 +49,4 @@ if exist "%my_exe_path%\%my_exe%" (
)
)

rem First time run
if not exist "%config_path%\log4rs_merge_mining_proxy.yml" (
"%merge_mining_proxy%" --init --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_merge_mining_proxy.yml" --base-path "%base_path%"
echo.
echo.
echo Created "%config_path%\log4rs_merge_mining_proxy.yml".
echo.
) else (
echo.
echo.
echo Using existing "%config_path%\log4rs_merge_mining_proxy.yml"
echo.
)

rem Consecutive runs
"%merge_mining_proxy%" --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_merge_mining_proxy.yml" --base-path "%base_path%"
"%merge_mining_proxy%" --base-path "%base_path%"
@@ -1,12 +1,12 @@
@echo off
rem Verify arguments
if ["%config_path%"]==[""] (
echo Problem with "config_path" environment variable: '%config_path%'
if ["%xmrig_config_path%"]==[""] (
echo Problem with "xmrig_config_path" environment variable: '%xmrig_config_path%'
pause
exit /b 10101
)
if not exist "%config_path%" (
echo Path as per "config_path" environment variable not found: '%config_path%'
if not exist "%xmrig_config_path%" (
echo Path as per "xmrig_config_path" environment variable not found: '%xmrig_config_path%'
pause
exit /b 10101
)
Expand All @@ -32,7 +32,9 @@ if exist "%TARI_XMRIG_DIR%\%my_exe%" (
)

rem Copy the config file to the XMRig folder
copy /y /v "%config_path%\xmrig_config_example_stagenet.json" "%TARI_XMRIG_DIR%\config.json"
if not exist "%TARI_XMRIG_DIR%\config.json" (
copy /y /v "%xmrig_config_path%\xmrig_config_example_mainnet.json" "%TARI_XMRIG_DIR%\config.json"
)

rem Run
"%xmrig%"
Expand Up @@ -6,10 +6,6 @@ echo ----------------------------
rem These is the merge mining proxy executable name
set my_exe=minotari_merge_mining_proxy.exe

rem This is the location of the configuration and identity files
set config_path=%~dp0..\config
echo config_path = %config_path%

rem The default location for the merge mining proxy executable
set my_exe_path=%~dp0
if %my_exe_path:~-1%==\ set my_exe_path=%my_exe_path:~0,-1%
Expand Down
Expand Up @@ -7,8 +7,8 @@ rem This is the XMRig executable name
set my_exe=xmrig.exe

rem This is the location of the XMRig configuration file
set config_path=%~dp0..\config
echo config_path = %config_path%
set xmrig_config_path=%~dp0..\xmrig_config
echo xmrig_config_path = %xmrig_config_path%

rem The default location for the XMRig start file
set my_exe_path=%~dp0
Expand Down
18 changes: 1 addition & 17 deletions applications/minotari_miner/windows/runtime/source_miner_env.bat
Expand Up @@ -2,16 +2,6 @@
title Minotari Miner

rem Verify arguments
if ["%config_path%"]==[""] (
echo Problem with "config_path" environment variable: '%config_path%'
pause
exit /b 10101
)
if not exist "%config_path%" (
echo Path as per "config_path" environment variable not found: '%config_path%'
pause
exit /b 10101
)
if ["%base_path%"]==[""] (
echo Problem with "base_path" environment variable: '%base_path%'
pause
Expand Down Expand Up @@ -61,12 +51,6 @@ if exist "%my_exe_path%\%my_exe%" (

echo.
echo.
if not exist "%config_path%\log4rs_miner.yml" (
echo Creating new "%config_path%\log4rs_miner.yml".
) else (
echo Using existing "%config_path%\log4rs_miner.yml"
)
echo.

cd "%base_path%"
"%miner%" --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_miner.yml" --base-path "%base_path%"
"%miner%" --base-path "%base_path%"
Expand Up @@ -6,10 +6,6 @@ echo ----------------------------
rem These are the miner executable and SQLite dynamic link library names
set my_exe=minotari_miner.exe

rem This is the location of the configuration and identity files
set config_path=%~dp0..\config
echo config_path = %config_path%

rem The default location for the miner executable
set my_exe_path=%~dp0
if %my_exe_path:~-1%==\ set my_exe_path=%my_exe_path:~0,-1%
Expand Down
1 change: 0 additions & 1 deletion applications/minotari_node/osx/install.sh
Expand Up @@ -64,7 +64,6 @@ fi

if [ ! -f "$DATA_DIR/config.toml" ]; then
echo "Copying configuraton files"
cp tari_config_example.toml $DATA_DIR/config.toml
cp log4rs_sample_base_node.yml $DATA_DIR/log4rs_base_node.yml
echo "Configuration complete."
fi
Expand Down
1 change: 0 additions & 1 deletion applications/minotari_node/osx/post_install.sh
Expand Up @@ -193,7 +193,6 @@ fi

if [ ! -f "$DATA_DIR/config.toml" ]; then
echo "Copying configuraton files"
# cp tari_config_example.toml $DATA_DIR/config.toml
# cp log4rs_sample_base_node.yml $DATA_DIR/log4rs_base_node.yml

# Configure Base Node
Expand Down
Expand Up @@ -2,16 +2,6 @@
title Minotari Base Node

rem Verify arguments
if ["%config_path%"]==[""] (
echo Problem with "config_path" environment variable: '%config_path%'
pause
exit /b 10101
)
if not exist "%config_path%" (
echo Path as per "config_path" environment variable not found: '%config_path%'
pause
exit /b 10101
)
if ["%base_path%"]==[""] (
echo Problem with "base_path" environment variable: '%base_path%'
pause
Expand Down Expand Up @@ -59,33 +49,5 @@ if exist "%my_exe_path%\%my_exe%" (
)
)

rem First time run
if not exist "%config_path%\base_node_id.json" (
"%base_node%" --init --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_base_node.yml" --base-path "%base_path%"
echo.
echo.
echo Created "%config_path%\base_node_id.json".
echo.
) else (
echo.
echo.
echo Using existing "%config_path%\base_node_id.json"
echo.
)
if not exist "%config_path%\log4rs_base_node.yml" (
cd "%base_path%"
"%base_node%" --init --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_base_node.yml" --base-path "%base_path%"
echo.
echo.
echo Created "%config_path%\log4rs_base_node.yml".
echo.
) else (
echo.
echo.
echo Using existing "%config_path%\log4rs_base_node.yml"
echo.
)

rem Consecutive runs
cd "%base_path%"
"%base_node%" --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_base_node.yml" --base-path "%base_path%"
"%base_node%" --base-path "%base_path%"
4 changes: 0 additions & 4 deletions applications/minotari_node/windows/runtime/start_all.bat
@@ -1,9 +1,5 @@
@echo off

rem This is the location of the configuration and identity files
set config_path=%~dp0..\config
echo config_path = %config_path%

rem The default runtime location
set my_exe_path=%~dp0
if %my_exe_path:~-1%==\ set my_exe_path=%my_exe_path:~0,-1%
Expand Down
Expand Up @@ -6,10 +6,6 @@ echo ----------------------------
rem These are the base node executable and SQLite dynamic link library names
set my_exe=minotari_node.exe

rem This is the location of the configuration and identity files
set config_path=%~dp0..\config
echo config_path = %config_path%

rem The default location for the base node executable
set my_exe_path=%~dp0
if %my_exe_path:~-1%==\ set my_exe_path=%my_exe_path:~0,-1%
Expand Down
2 changes: 1 addition & 1 deletion buildtools/create_osx_install_zip.sh
Expand Up @@ -80,7 +80,7 @@ cp -f "${local_dir}/get_xmrig_osx.ps1" "${tarball_folder}/runtime/get_xmrig_osx.
# Config
cat "${project_dir}"/common/config/presets/*.toml >"${tarball_folder}/config/config.toml"
cp -f "${project_dir}/common/xmrig_config/config_example_stagenet.json" "${tarball_folder}/config/xmrig_config_example_stagenet.json"
cp -f "${project_dir}/common/xmrig_config/config_example_mainnet.json" "${tarball_folder}/config/xxmrig_config_example_mainnet.json"
cp -f "${project_dir}/common/xmrig_config/config_example_mainnet.json" "${tarball_folder}/config/xmrig_config_example_mainnet.json"
cp -f "${project_dir}/common/xmrig_config/config_example_mainnet_self_select.json" "${tarball_folder}/config/xmrig_config_example_mainnet_self_select.json"

# Scripts
Expand Down
2 changes: 1 addition & 1 deletion buildtools/create_ubuntu_install_zip.sh
Expand Up @@ -79,7 +79,7 @@ cp -f "${local_dir}/install_powershell_ubuntu.sh" "${tarball_folder}/runtime/ins
# Config
cat "${project_dir}/common/config/presets/*.toml" >"${tarball_folder}/config/config.toml"
cp -f "${project_dir}/common/xmrig_config/config_example_stagenet.json" "${tarball_folder}/config/xmrig_config_example_stagenet.json"
cp -f "${project_dir}/common/xmrig_config/config_example_mainnet.json" "${tarball_folder}/config/xxmrig_config_example_mainnet.json"
cp -f "${project_dir}/common/xmrig_config/config_example_mainnet.json" "${tarball_folder}/config/xmrig_config_example_mainnet.json"
cp -f "${project_dir}/common/xmrig_config/config_example_mainnet_self_select.json" "${tarball_folder}/config/xmrig_config_example_mainnet_self_select.json"

echo Files copied to "${tarball_folder}"
Expand Down
1 change: 0 additions & 1 deletion buildtools/generate_config.bat

This file was deleted.

1 change: 0 additions & 1 deletion buildtools/generate_config.sh

This file was deleted.

13 changes: 5 additions & 8 deletions buildtools/windows_inno_installer.iss
Expand Up @@ -17,7 +17,6 @@
; /p "<password used to create the certificate>" $f
; (3) To run this script from the command line with Inno Setup console-mode compiler:
; - change directory to "<project_root>/buildtools"
; - generate_config.bat
; - "<path to console-mode compiler>\ISCC.exe" "/SSignTool=signtool sign
; /tr http://timestamp.digicert.com /f "<path and filename of the certificate>"
; /p <password used to create the certificate> $f"
Expand Down Expand Up @@ -90,7 +89,6 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[PreCompile]
Name: ".\generate_config.bat"; Flags: abortonerror cmdprompt redirectoutput

[Files]
Source: "..\LICENSE"; DestDir: "{app}"; DestName: "LICENSE.md"; Flags: ignoreversion
Expand Down Expand Up @@ -120,17 +118,16 @@ Source: "..\applications\minotari_merge_mining_proxy\windows\runtime\source_merg
Source: "..\applications\minotari_merge_mining_proxy\windows\runtime\start_minotari_merge_mining_proxy.bat"; DestDir: "{app}\runtime"; Flags: ignoreversion
Source: "..\applications\minotari_merge_mining_proxy\windows\runtime\source_xmrig_env.bat"; DestDir: "{app}\runtime"; Flags: ignoreversion
Source: "..\applications\minotari_merge_mining_proxy\windows\runtime\start_xmrig.bat"; DestDir: "{app}\runtime"; Flags: ignoreversion
Source: ".\tari_config_example.toml"; DestDir: "{app}\config"; DestName: "config.toml"; Flags: ignoreversion
Source: "tari_logo_purple.ico"; DestDir: "{userdocs}\..\temp\tari_icons"; Flags: ignoreversion
Source: "tor.ico"; DestDir: "{userdocs}\..\temp\tari_icons"; Flags: ignoreversion
Source: "xmr_logo.ico"; DestDir: "{userdocs}\..\temp\tari_icons"; Flags: ignoreversion
Source: "install_tor_services.bat"; DestDir: "{app}\runtime"; Flags: ignoreversion
Source: "install_vs2019_redist.bat"; DestDir: "{app}\runtime"; Flags: ignoreversion
Source: "install_xmrig.bat"; DestDir: "{app}\runtime"; Flags: ignoreversion
Source: "get_xmrig_win.ps1"; DestDir: "{app}\runtime"; Flags: ignoreversion
Source: "..\common\xmrig_config\config_example_stagenet.json"; DestDir: "{app}\config"; DestName: "xmrig_config_example_stagenet.json"; Flags: ignoreversion
Source: "..\common\xmrig_config\config_example_mainnet.json"; DestDir: "{app}\config"; DestName: "xmrig_config_example_mainnet.json"; Flags: ignoreversion
Source: "..\common\xmrig_config\config_example_mainnet_self_select.json"; DestDir: "{app}\config"; DestName: "xmrig_config_example_mainnet_self_select.json"; Flags: ignoreversion
Source: "..\common\xmrig_config\config_example_stagenet.json"; DestDir: "{app}\xmrig_config"; DestName: "xmrig_config_example_stagenet.json"; Flags: ignoreversion
Source: "..\common\xmrig_config\config_example_mainnet.json"; DestDir: "{app}\xmrig_config"; DestName: "xmrig_config_example_mainnet.json"; Flags: ignoreversion
Source: "..\common\xmrig_config\config_example_mainnet_self_select.json"; DestDir: "{app}\xmrig_config"; DestName: "xmrig_config_example_mainnet_self_select.json"; Flags: ignoreversion

[Icons]
Name: "{group}\Start {#AllName}"; Filename: "{app}\runtime\{#AllExeName}"; WorkingDir: "{app}"
Expand Down Expand Up @@ -162,7 +159,7 @@ Filename: "{app}\runtime\install_xmrig.bat"; Parameters: "NO_PAUSE"; Flags: runa
Filename: "{app}\runtime\install_vs2019_redist.bat"; Parameters: "NO_PAUSE"; Flags: runascurrentuser postinstall; Description: "Install Redistributable for Visual Studio 2019"

[InstallDelete]
Type: filesandordirs; Name: "{app}\config"
Type: filesandordirs; Name: "{app}\xmrig_config"
Type: filesandordirs; Name: "{app}\log"
Type: filesandordirs; Name: "{app}\runtime"
Type: files; Name: "{app}\LICENSE.md"
Expand All @@ -185,6 +182,6 @@ Type: files; Name: "{userdesktop}\Tari XMRig.lnk"
Type: files; Name: "{userdesktop}\Tari - Tor Services.lnk"

[UninstallDelete]
Type: filesandordirs; Name: "{app}\config"
Type: filesandordirs; Name: "{app}\xmrig_config"
Type: filesandordirs; Name: "{app}\log"
Type: filesandordirs; Name: "{app}\runtime"

0 comments on commit c37a0a8

Please sign in to comment.