Skip to content

Commit

Permalink
Refactor UnboundConfig to use LogicLib
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRand committed Nov 20, 2021
1 parent bbea1a7 commit 6d8d686
Showing 1 changed file with 34 additions and 19 deletions.
53 changes: 34 additions & 19 deletions ncdns.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -1569,26 +1569,41 @@ Function UnboundConfig
# Detect dnssec-trigger/Unbound installation.
ClearErrors
ReadRegStr $UnboundConfPath HKLM "Software\Wow6432Node\DnssecTrigger" "InstallLocation"
IfErrors 0 found
ReadRegStr $UnboundConfPath HKLM "Software\DnssecTrigger" "InstallLocation"
IfErrors 0 found
ReadRegStr $UnboundConfPath HKLM "Software\Wow6432Node\Unbound" "InstallLocation"
IfErrors 0 found
ReadRegStr $UnboundConfPath HKLM "Software\Unbound" "InstallLocation"
IfErrors 0 found
not_found:
DetailPrint "*** dnssec-trigger installation was NOT found, not configuring Unbound."
StrCpy $UnboundConfPath ""
Return
${IfNot} ${Errors}
DetailPrint "32-bit DNSSEC-Trigger InstallLocation found."
${Else}
ReadRegStr $UnboundConfPath HKLM "Software\DnssecTrigger" "InstallLocation"
${IfNot} ${Errors}
DetailPrint "Native-arch DNSSEC-Trigger InstallLocation found."
${Else}
ReadRegStr $UnboundConfPath HKLM "Software\Wow6432Node\Unbound" "InstallLocation"
${IfNot} ${Errors}
DetailPrint "32-bit standalone Unbound InstallLocation found."
${Else}
ReadRegStr $UnboundConfPath HKLM "Software\Unbound" "InstallLocation"
${IfNot} ${Errors}
DetailPrint "Native-arch standalone Unbound InstallLocation found."
${Else}
DetailPrint "*** Unbound InstallLocation was NOT found."
MessageBox "MB_OK|MB_ICONSTOP" "Unbound InstallLocation was NOT found." /SD IDOK
Abort
${EndIf}
${EndIf}
${EndIf}
${EndIf}

${IfNot} ${FileExists} "$UnboundConfPath\unbound.conf"
DetailPrint "*** unbound.conf was NOT found."
MessageBox "MB_OK|MB_ICONSTOP" "unbound.conf was NOT found." /SD IDOK
Abort
${ElseIfNot} ${FileExists} "$UnboundConfPath\service.conf"
DetailPrint "*** service.conf was NOT found."
MessageBox "MB_OK|MB_ICONSTOP" "service.conf was NOT found." /SD IDOK
Abort
${Else}
DetailPrint "Unbound configuration files found."
${EndIf}

# dnssec-trigger/Unbound is installed. Adapt the Unbound config to include from a
# directory.
found:
DetailPrint "*** dnssec-trigger installation WAS found, configuring Unbound."
IfFileExists "$UnboundConfPath\unbound.conf" found2
IfFileExists "$UnboundConfPath\service.conf" found2
Goto not_found
found2:
CreateDirectory "$UnboundConfPath\unbound.conf.d"

# Unbound on Windows doesn't appear to support globbing include directives,
Expand Down

0 comments on commit 6d8d686

Please sign in to comment.