Skip to content

Commit 98ab3d8

Browse files
authored
Merge pull request #32 from nulijiazaizhong/main
Add a repository from the CNB platform for users in China
2 parents a309da9 + 7fcca62 commit 98ab3d8

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

main.nsi

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ InstallDir "C:\ETS2LA"
1111
!define GITLAB_URL "https://gitlab.com/ETS2LA/ETS2LA"
1212
!define GITHUB_URL "https://github.com/ETS2LA/Euro-Truck-Simulator-2-Lane-Assist.git"
1313
!define SOURCEFORGE_URL "https://git.code.sf.net/p/eurotrucksimulator2-laneassist/code"
14+
!define CNB_URL "https://cnb.cool/ETS2LA-CN/Euro-Truck-Simulator-2-Lane-Assist.git"
1415

1516
!define MIRROR_NAME "Aliyun PyPi Mirror"
1617
!define MIRROR_URL "https://mirrors.aliyun.com/pypi/simple/"
@@ -59,6 +60,7 @@ Var PyPi
5960
Var RadioGitLab
6061
Var RadioGitHub
6162
Var RadioSourceForge
63+
Var RadioCNB
6264
Var PyPiMirrorSelection
6365

6466
# Shortcuts
@@ -113,8 +115,10 @@ Function SelectMirrorPage
113115
Pop $RadioGitHub
114116
${NSD_CreateRadioButton} 0 60u 100% 12u "SourceForge"
115117
Pop $RadioSourceForge
118+
${NSD_CreateRadioButton} 0 75u 100% 12u "CNB"
119+
Pop $RadioCNB
116120
# Toggle to enable/disable Aliyun mirror
117-
${NSD_CreateCheckBox} 0 80u 100% 12u "${MIRROR_NAME}"
121+
${NSD_CreateCheckBox} 0 95u 100% 12u "${MIRROR_NAME}"
118122
Pop $PyPiMirrorSelection
119123

120124
# Set default selection (GitLab)
@@ -136,6 +140,11 @@ Function SelectMirrorPageLeave
136140
${NSD_GetState} $RadioSourceForge $0
137141
${If} $0 == ${BST_CHECKED}
138142
StrCpy $MirrorSelection "SourceForge"
143+
${Else}
144+
${NSD_GetState} $RadioCNB $0
145+
${If} $0 == ${BST_CHECKED}
146+
StrCpy $MirrorSelection "CNB"
147+
${EndIf}
139148
${EndIf}
140149
${EndIf}
141150
${EndIf}
@@ -260,6 +269,8 @@ Section "Download" SEC03
260269
nsExec::ExecToLog '"$INSTDIR\system\git\bin\git.exe" clone --quiet --depth=20 --branch=${BRANCH} --single-branch ${GITHUB_URL} .'
261270
${ElseIf} $MirrorSelection == "SourceForge"
262271
nsExec::ExecToLog '"$INSTDIR\system\git\bin\git.exe" clone --quiet --depth=20 --branch=${BRANCH} --single-branch ${SOURCEFORGE_URL} .'
272+
${ElseIf} $MirrorSelection == "CNB"
273+
nsExec::ExecToLog '"$INSTDIR\system\git\bin\git.exe" clone --quiet --depth=20 --branch=${BRANCH} --single-branch ${CNB_URL} .'
263274
${EndIf}
264275

265276
# Check if git clone was successful
@@ -279,8 +290,14 @@ Section "Download" SEC03
279290
nsExec::ExecToLog '"$INSTDIR\system\git\bin\git.exe" clone --quiet --depth=20 --branch=${BRANCH} --single-branch ${SOURCEFORGE_URL} .' $0
280291
Pop $0
281292
${If} $0 != 0
282-
MessageBox MB_ICONSTOP|MB_OK $(AllMirrorsFailed)
283-
Abort $(InstallationAborted)
293+
DetailPrint $(TryingAnotherMirror)
294+
DetailPrint "CNB"
295+
nsExec::ExecToLog '"$INSTDIR\system\git\bin\git.exe" clone --quiet --depth=20 --branch=${BRANCH} --single-branch ${CNB_URL} .' $0
296+
Pop $0
297+
${If} $0 != 0
298+
MessageBox MB_ICONSTOP|MB_OK $(AllMirrorsFailed)
299+
Abort $(InstallationAborted)
300+
${EndIf}
284301
${EndIf}
285302
${EndIf}
286303
${ElseIf} $MirrorSelection == "GitHub"
@@ -294,8 +311,14 @@ Section "Download" SEC03
294311
nsExec::ExecToLog '"$INSTDIR\system\git\bin\git.exe" clone --quiet --depth=20 --branch=${BRANCH} --single-branch ${SOURCEFORGE_URL} .' $0
295312
Pop $0
296313
${If} $0 != 0
297-
MessageBox MB_ICONSTOP|MB_OK $(AllMirrorsFailed)
298-
Abort $(InstallationAborted)
314+
DetailPrint $(TryingAnotherMirror)
315+
DetailPrint "CNB"
316+
nsExec::ExecToLog '"$INSTDIR\system\git\bin\git.exe" clone --quiet --depth=20 --branch=${BRANCH} --single-branch ${CNB_URL} .' $0
317+
Pop $0
318+
${If} $0 != 0
319+
MessageBox MB_ICONSTOP|MB_OK $(AllMirrorsFailed)
320+
Abort $(InstallationAborted)
321+
${EndIf}
299322
${EndIf}
300323
${EndIf}
301324
${ElseIf} $MirrorSelection == "SourceForge"
@@ -309,8 +332,14 @@ Section "Download" SEC03
309332
nsExec::ExecToLog '"$INSTDIR\system\git\bin\git.exe" clone --quiet --depth=20 --branch=${BRANCH} --single-branch ${GITHUB_URL} .' $0
310333
Pop $0
311334
${If} $0 != 0
312-
MessageBox MB_ICONSTOP|MB_OK $(AllMirrorsFailed)
313-
Abort $(InstallationAborted)
335+
DetailPrint $(TryingAnotherMirror)
336+
DetailPrint "CNB"
337+
nsExec::ExecToLog '"$INSTDIR\system\git\bin\git.exe" clone --quiet --depth=20 --branch=${BRANCH} --single-branch ${CNB_URL} .' $0
338+
Pop $0
339+
${If} $0 != 0
340+
MessageBox MB_ICONSTOP|MB_OK $(AllMirrorsFailed)
341+
Abort $(InstallationAborted)
342+
${EndIf}
314343
${EndIf}
315344
${EndIf}
316345
${EndIf}
@@ -415,4 +444,4 @@ Section "Uninstall"
415444
DetailPrint "Uninstallation complete."
416445
SectionEnd
417446

418-
!include "languages.nsh"
447+
!include "languages.nsh"

0 commit comments

Comments
 (0)