Compare commits
2 Commits
dc1c78e4b4
...
2f1f0784ad
Author | SHA1 | Date | |
---|---|---|---|
2f1f0784ad | |||
b8718a2250 |
14
README.md
14
README.md
@ -1,17 +1,19 @@
|
|||||||
# NSIS Installer for PolyMC instances
|
# NSIS Installer for PolyMC instances
|
||||||
|
|
||||||
*Warning*
|
## Prerequisites
|
||||||
|
|
||||||
|
### Warning
|
||||||
|
|
||||||
- Only for PolyMC Minecraft installation!
|
- Only for PolyMC Minecraft installation!
|
||||||
- There are destructive operations into PolyMC data folders!
|
- There are destructive operations into PolyMC data folders!
|
||||||
- Overrides instances defined in PolyMC!
|
- Overrides instances defined in PolyMC!
|
||||||
|
|
||||||
*Notice*
|
### Notice
|
||||||
|
|
||||||
- Using NSIS installer for packaging
|
- Using NSIS installer for packaging
|
||||||
- Using CMD for batch installation _(trapped into NSIS)_
|
- Using CMD for batch installation _(trapped into NSIS)_
|
||||||
|
|
||||||
*Fonctionnalities*
|
### Functionnalities
|
||||||
|
|
||||||
- Ask for previous installation _(can be bypassed or uninstalled silently)_
|
- Ask for previous installation _(can be bypassed or uninstalled silently)_
|
||||||
- Create uninstaller
|
- Create uninstaller
|
||||||
@ -19,6 +21,12 @@
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 2024-04-15
|
||||||
|
|
||||||
|
- Moved content to external 7zip file _(with download & extract during install process)_
|
||||||
|
- Fixes in registry keys
|
||||||
|
- Minor fixes in logic
|
||||||
|
|
||||||
### 2024-04-14
|
### 2024-04-14
|
||||||
|
|
||||||
- Initial release
|
- Initial release
|
||||||
|
BIN
files/PolyMC/instances/common/resourcepacks/XrayUltimate.zip
Normal file
BIN
files/PolyMC/instances/common/resourcepacks/XrayUltimate.zip
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
@echo off
|
@echo off
|
||||||
SETLOCAL
|
SETLOCAL
|
||||||
REM 2024-04-08
|
REM 2024-04-15
|
||||||
cls
|
cls
|
||||||
|
|
||||||
REM Define locale paths
|
REM Define locale paths
|
||||||
|
121
mods.nsi
121
mods.nsi
@ -1,4 +1,10 @@
|
|||||||
;2024-04-14
|
;2024-04-15
|
||||||
|
|
||||||
|
;Used NSIS Plug-ins
|
||||||
|
; https://github.com/negrutiu/nsis-nsxfer
|
||||||
|
; https://nsis.sourceforge.io/Locate_plugin
|
||||||
|
; https://nsis.sourceforge.io/Nsis7z_plug-in
|
||||||
|
; (https://nsis.sourceforge.io/PassDialog_plug-in)
|
||||||
|
|
||||||
;Define installer compression method and level
|
;Define installer compression method and level
|
||||||
SetCompressor /SOLID LZMA
|
SetCompressor /SOLID LZMA
|
||||||
@ -6,11 +12,17 @@ SetCompressor /SOLID LZMA
|
|||||||
;Activate CRC check
|
;Activate CRC check
|
||||||
CRCCheck on
|
CRCCheck on
|
||||||
|
|
||||||
|
;Active XP style
|
||||||
|
XPStyle on
|
||||||
|
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
;Constants
|
;Constants
|
||||||
|
|
||||||
!define PRODUCT_YEAR "2024"
|
!define PRODUCT_YEAR "2024"
|
||||||
!define PRODUCT_VERSION "${PRODUCT_YEAR}.04.14.0"
|
!define PRODUCT_MONTH "04"
|
||||||
|
!define PRODUCT_DAY "15"
|
||||||
|
!define PRODUCT_ITERATION "1"
|
||||||
|
!define PRODUCT_VERSION "${PRODUCT_YEAR}.${PRODUCT_MONTH}.${PRODUCT_DAY}.${PRODUCT_ITERATION}"
|
||||||
!define PRODUCT_UUID "1e626553-03f9-47e1-a0cd-858e8effe76e" ;Change for each new product
|
!define PRODUCT_UUID "1e626553-03f9-47e1-a0cd-858e8effe76e" ;Change for each new product
|
||||||
!define PRODUCT_BRAND "Zogg"
|
!define PRODUCT_BRAND "Zogg"
|
||||||
!define PRODUCT_NAME "Mods"
|
!define PRODUCT_NAME "Mods"
|
||||||
@ -22,6 +34,9 @@ CRCCheck on
|
|||||||
!define PRODUCT_TITLE "${PRODUCT_BRAND} ${PRODUCT_NAME}"
|
!define PRODUCT_TITLE "${PRODUCT_BRAND} ${PRODUCT_NAME}"
|
||||||
!define PRODUCT_COMPONENTS "Fabric mods, Ressources Packs & Shaders"
|
!define PRODUCT_COMPONENTS "Fabric mods, Ressources Packs & Shaders"
|
||||||
|
|
||||||
|
!define PRODUCT_BASEURL "https://dl.zogg.fr/files/minecraft"
|
||||||
|
!define PRODUCT_CONTENTFILE "mods.7z"
|
||||||
|
|
||||||
!define PRODUCT_DEST "$LOCALAPPDATA"
|
!define PRODUCT_DEST "$LOCALAPPDATA"
|
||||||
!define PRODUCT_SMDIR "NSIS:StartMenuDir"
|
!define PRODUCT_SMDIR "NSIS:StartMenuDir"
|
||||||
|
|
||||||
@ -43,7 +58,10 @@ CRCCheck on
|
|||||||
!include "Library.nsh"
|
!include "Library.nsh"
|
||||||
!include "x64.nsh"
|
!include "x64.nsh"
|
||||||
!include "WinVer.nsh"
|
!include "WinVer.nsh"
|
||||||
|
!include "Locate.nsh"
|
||||||
|
!include "LogicLib.nsh"
|
||||||
|
!include "Sections.nsh"
|
||||||
|
!include "StrFunc.nsh"
|
||||||
|
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
;Macros
|
;Macros
|
||||||
@ -195,7 +213,7 @@ CRCCheck on
|
|||||||
;Translations
|
;Translations
|
||||||
|
|
||||||
!insertmacro MUI_LANGUAGE "French"
|
!insertmacro MUI_LANGUAGE "French"
|
||||||
|
!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||||
|
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
;Version Tab (in the )Properties of the file)
|
;Version Tab (in the )Properties of the file)
|
||||||
@ -222,18 +240,19 @@ CRCCheck on
|
|||||||
;Set output path to the installation directory
|
;Set output path to the installation directory
|
||||||
SetOutPath $INSTDIR
|
SetOutPath $INSTDIR
|
||||||
|
|
||||||
;Copy a file to the current SetOutPath directory
|
;process content (download and uncompress)
|
||||||
File /r "files\*.*"
|
call proceedContent
|
||||||
|
|
||||||
|
;Execute specific shell script
|
||||||
|
call runCommandBatch
|
||||||
|
|
||||||
|
;Make uninstall
|
||||||
call addRegistryUninstall
|
call addRegistryUninstall
|
||||||
WriteUninstaller "${PRODUCT_UNINSTALLER}"
|
WriteUninstaller "${PRODUCT_UNINSTALLER}"
|
||||||
|
|
||||||
; Add Start Menu entries
|
; Add Start Menu entries
|
||||||
call addStartMenu
|
call addStartMenu
|
||||||
|
|
||||||
;Execute specific shell script
|
|
||||||
call runCommandBatch
|
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
;Uninstall component
|
;Uninstall component
|
||||||
@ -341,6 +360,7 @@ FunctionEnd
|
|||||||
;Execute specific shell script
|
;Execute specific shell script
|
||||||
Function runCommandBatch
|
Function runCommandBatch
|
||||||
|
|
||||||
|
DetailPrint "Mise en place..."
|
||||||
nsExec::ExecToLog /OEM '"$INSTDIR\install.cmd"'
|
nsExec::ExecToLog /OEM '"$INSTDIR\install.cmd"'
|
||||||
Pop $0
|
Pop $0
|
||||||
|
|
||||||
@ -374,6 +394,13 @@ Function checkForPolyMC
|
|||||||
Done:
|
Done:
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
;Open url on error, then quit application
|
||||||
|
Function errorOpenUrl
|
||||||
|
MessageBox MB_OK "Une erreur est survenue !"
|
||||||
|
call openProductUrl
|
||||||
|
Quit
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
;Check for previous installed version
|
;Check for previous installed version
|
||||||
Function checkForPrevious
|
Function checkForPrevious
|
||||||
|
|
||||||
@ -388,3 +415,79 @@ Function checkForPrevious
|
|||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
;Download content to temps
|
||||||
|
Function downloadContent
|
||||||
|
|
||||||
|
Retry:
|
||||||
|
NSxfer::Transfer /URL "${PRODUCT_BASEURL}/${PRODUCT_CONTENTFILE}" /LOCAL "$TEMP\${PRODUCT_CONTENTFILE}" /MODE Page /ABORT "Annuler" "Etes-vous sur ?" /END
|
||||||
|
Pop $0
|
||||||
|
${If} $0 != "OK"
|
||||||
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_SETFOREGROUND|MB_USERICON "Erreur de telechargement !$\r$\nVoulez-vous recommencer ?" IDYES true IDNO false
|
||||||
|
true:
|
||||||
|
goto Retry
|
||||||
|
false:
|
||||||
|
goto Exit
|
||||||
|
${Else}
|
||||||
|
goto Done
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
Exit:
|
||||||
|
call errorOpenUrl
|
||||||
|
|
||||||
|
Done:
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
;Uncompress content to $INSTDIR
|
||||||
|
Function uncompressContent
|
||||||
|
|
||||||
|
locate::_GetSize /NOUNLOAD "$TEMP\${PRODUCT_CONTENTFILE}" "/G=0"
|
||||||
|
Pop $5
|
||||||
|
|
||||||
|
Retry:
|
||||||
|
ClearErrors
|
||||||
|
SetOutPath $INSTDIR
|
||||||
|
GetFunctionAddress $R9 extractCallbackTest
|
||||||
|
Nsis7z::ExtractWithCallback "$TEMP\${PRODUCT_CONTENTFILE}" $R9
|
||||||
|
Pop $6
|
||||||
|
|
||||||
|
;Check if extracted size <> content file size
|
||||||
|
${If} $6 != $5
|
||||||
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_SETFOREGROUND|MB_USERICON "Erreur de decompression !$\r$\nVoulez-vous recommencer ?" IDYES true IDNO false
|
||||||
|
true:
|
||||||
|
goto Retry
|
||||||
|
false:
|
||||||
|
goto Exit
|
||||||
|
${Else}
|
||||||
|
goto Done
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
Exit:
|
||||||
|
Delete "$TEMP\${PRODUCT_CONTENTFILE}"
|
||||||
|
call errorOpenUrl
|
||||||
|
|
||||||
|
Done:
|
||||||
|
Delete "$TEMP\${PRODUCT_CONTENTFILE}"
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
;Download content to installation folder
|
||||||
|
Function proceedContent
|
||||||
|
|
||||||
|
call downloadContent
|
||||||
|
call uncompressContent
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
;Progression callback for extraction
|
||||||
|
Function extractCallbackTest
|
||||||
|
|
||||||
|
Pop $R8 ;current
|
||||||
|
Pop $R9 ;total
|
||||||
|
|
||||||
|
Math::Script "R5 = $R8 * 100 / $R9"
|
||||||
|
|
||||||
|
SetDetailsPrint textonly
|
||||||
|
DetailPrint "Extraction $R5%"
|
||||||
|
SetDetailsPrint both
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
Loading…
Reference in New Issue
Block a user