chore: fixed install script issue where module path didn't exist
This commit is contained in:
parent
329bb8728a
commit
08a05eab2c
21
Install.ps1
21
Install.ps1
@ -1,12 +1,11 @@
|
|||||||
# Setup variables
|
|
||||||
$GitURI = "https://git.wnd.sh/n/PSGraylog/archive/main.zip"
|
|
||||||
# Defaults to the first module path, however you can change this to any path you wish (provided it's in your $PSModulePath)
|
# Defaults to the first module path, however you can change this to any path you wish (provided it's in your $PSModulePath)
|
||||||
$OutputPath = "$($env:PSModulePath.Split(";")[0])/PSGraylog"
|
$ModulePath = $env:PSModulePath.Split(";")[0]
|
||||||
Invoke-WebRequest $GitURI -OutFile "$OutputPath.zip"
|
if (-NOT (Test-Path $ModulePath)) { New-Item -Path $ModulePath -ItemType Directory } # Create the module path if it doesn't exist (might happen on brand new installs)
|
||||||
Expand-Archive "$OutputPath.zip" $OutputPath
|
$GitURI = "https://git.wnd.sh/n/PSGraylog/archive/main.zip"
|
||||||
# The archive nests the files, so we need to move the up a level
|
$OutputPath = "$ModulePath/PSGraylog"
|
||||||
Move-Item "$OutputPath/PSGraylog/*" $OutputPath
|
|
||||||
# Remove the excess PSGraylog directory (it's empty)
|
Invoke-WebRequest $GitURI -OutFile "$OutputPath.zip" # Download the zip archive to the module path
|
||||||
Remove-Item "$OutputPath/PSGraylog"
|
Expand-Archive "$OutputPath.zip" $OutputPath # Extract the zip archive to the module path
|
||||||
# Remove the archive
|
Move-Item "$OutputPath/PSGraylog/*" $OutputPath # The archive nests the files, so we need to move the up a level
|
||||||
Remove-Item "$OutputPath.zip"
|
Remove-Item "$OutputPath/PSGraylog" # Remove the excess PSGraylog directory (it's empty)
|
||||||
|
Remove-Item "$OutputPath.zip" # Remove the archive
|
Loading…
Reference in New Issue
Block a user