Skip to content
Snippets Groups Projects
Commit fa6cfbec authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Allow for common and host-specific config file update paths.

With this commit the updater script is considered as being completed for
now, so this fixes #13.
parent 6c692ea9
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,8 @@ The `$UpdateSourcePath` folder structure is expected to be like this:
```
├─── Configs
│ ├─── _COMMON_
│ │ └─── common_config.xml
│ └─── <HOSTNAME>
│ └─── configuration.xml
└─── Service
......
......@@ -233,14 +233,21 @@ function Update-File {
function Update-Configuration {
$NewConfig = "$($UpdateConfigPath)\configuration.xml"
if (Test-Path -PathType Leaf $NewConfig) {
$ret = Update-File $NewConfig $ConfigPath
} else {
$ret = $False
Log-Debug "No configuration file found at '$($NewConfig)'."
}
Return $ret
$RetOr = $False
# common config files first:
ForEach ($NewConfig in Get-ChildItem $UpdPathConfigCommon) {
$ret = Update-File $NewConfig.FullName $ConfigPath
$RetOr = $RetOr -Or $ret
}
# then host specific config files:
ForEach ($NewConfig in Get-ChildItem $UpdPathConfig) {
$ret = Update-File $NewConfig.FullName $ConfigPath
$RetOr = $RetOr -Or $ret
}
if (-Not ($RetOr)) {
Log-Debug "No (new) configuration file(s) found."
}
Return $RetOr
}
......@@ -408,6 +415,7 @@ Log-Debug "$($Me) started..."
Ensure-ServiceRunning $ServiceName
$UpdPathConfig = "$($UpdateSourcePath)\Configs\$($env:COMPUTERNAME)"
$UpdPathConfigCommon = "$($UpdateSourcePath)\Configs\_COMMON_"
$UpdPathMarkerFiles = "$($UpdateSourcePath)\Service\UpdateMarkers"
$UpdPathBinaries = "$($UpdateSourcePath)\Service\Binaries"
$UploadPathLogs = "$($UpdateSourcePath)\Logs\$($env:COMPUTERNAME)"
......@@ -417,6 +425,7 @@ Exit-IfDirMissing $LogPath "log files"
Exit-IfDirMissing $ConfigPath "configuration files"
Exit-IfDirMissing $UpdateSourcePath "update source"
Exit-IfDirMissing $UpdPathConfig "configuration update"
Exit-IfDirMissing $UpdPathConfigCommon "common configuration update"
Exit-IfDirMissing $UpdPathMarkerFiles "update marker"
Exit-IfDirMissing $UpdPathBinaries "service binaries update"
Exit-IfDirMissing $UploadPathLogs "log file target"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment