Add Ubuntu Server initial draft
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@ -1,55 +0,0 @@
|
||||
#Requires -Modules 'powershell-yaml'
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateScript({
|
||||
If (Test-Path($_)) {
|
||||
$True
|
||||
} Else {
|
||||
Throw "'$_' is not a valid filename (within working directory '$PWD'), or access denied; aborting."
|
||||
}
|
||||
})]
|
||||
[string]$ManifestFileName
|
||||
)
|
||||
|
||||
$GetItemSplat = @{
|
||||
Path = $ManifestFileName
|
||||
}
|
||||
$ManifestFile = Get-Item @GetItemSplat
|
||||
|
||||
$SetLocationSplat = @{
|
||||
Path = $ManifestFile.DirectoryName
|
||||
}
|
||||
Set-Location @SetLocationSplat
|
||||
|
||||
$GetContentSplat = @{
|
||||
Path = $ManifestFile.FullName
|
||||
}
|
||||
$Manifest = Get-Content @GetContentSplat
|
||||
|
||||
$UpdatedManifest = ForEach ($Line in $Manifest) {
|
||||
Write-Host "Processing '$($Line)' ..."
|
||||
If ($Line -match '^SHA256\((.+)\)= ([0-9a-fA-F]{64})$') {
|
||||
If (Test-Path $Matches[1]) {
|
||||
$GetFileHashSplat = @{
|
||||
Path = $Matches[1]
|
||||
Algorithm = 'SHA256'
|
||||
}
|
||||
Write-Host "Updating checksum..."
|
||||
"SHA256($($Matches[1]))= $((Get-FileHash @GetFileHashSplat).Hash)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
If ($UpdatedManifest -ne $Null) {
|
||||
$SetContentSplat = @{
|
||||
Path = $ManifestFile.FullName
|
||||
Value = $UpdatedManifest
|
||||
Force = $True
|
||||
Confirm = $False
|
||||
}
|
||||
Set-Content @SetContentSplat
|
||||
} Else {
|
||||
Write-Host "Failed updating manifest."
|
||||
Exit 1
|
||||
}
|
Reference in New Issue
Block a user