Skip to content

Commit

Permalink
test1
Browse files Browse the repository at this point in the history
  • Loading branch information
MaynardMiner committed May 21, 2019
1 parent 057576a commit 0c9b1d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion h-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ sudo ln -s /opt/microsoft/powershell/6.1.0/pwsh /usr/bin/pwsh
sudo rm -rf /tmp/powershell.tar.gz
fi

pwsh -command "&.\startup.ps1 $(< /hive/miners/custom/$CUSTOM_NAME/$CUSTOM_NAME.conf)" $@
if jq -e . >/dev/null 2>&1 <<<"$@"; then
$@ > $PWD/config.json
pwsh -command "& .\startup.ps1"
else
pwsh -command "&.\startup.ps1 $(< /hive/miners/custom/$CUSTOM_NAME/$CUSTOM_NAME.conf)" $@
fi
10 changes: 7 additions & 3 deletions startup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (Test-Path ".\config\parameters\default.json") {
}

$List = $Defaults.PSObject.Properties.Name
$global:parsed = @{ }
$parsed = @{ }

if ($args) {
$args | % {
Expand All @@ -39,9 +39,13 @@ if ($args) {
}
}
}
} elseif (test-path ".\config.json") {
$parsed = @{ }
$arguments = Get-Content ".\config.json" | ConvertFrom-Json
$arguments.PSObject.Properties.Name | % { $Parsed.Add("$($_)", $arguments.$_) }
} elseif (Test-Path ".\config\parameters\arguments.json") {
$global:parsed = @{ }
$arguments = Get-Content ".\config\parameters\arguments.json" ConvertFrom-Json
$parsed = @{ }
$arguments = Get-Content ".\config\parameters\arguments.json" | ConvertFrom-Json
$arguments.PSObject.Properties.Name | % { $Parsed.Add("$($_)", $arguments.$_) }
} else {
Write-Host "No Arguments or arguments.json file found. Exiting."
Expand Down

0 comments on commit 0c9b1d2

Please sign in to comment.