From e56fa77d910b9cfbdfc440938608592bcc4e8e4e Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 5 Oct 2020 11:19:24 +0300 Subject: [PATCH] restore owner --- .../SoftwareReport/SoftwareReport.Generator.ps1 | 3 +++ .../SoftwareReport/SoftwareReport.Helpers.psm1 | 4 ++++ .../SoftwareReport/SoftwareReport.Tools.psm1 | 16 ++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index ff03ba846..ac8c26dd7 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -14,6 +14,9 @@ Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameC Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Rust.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking +# Restore file owner in user profile +Restore-UserOwner + $markdown = "" if ($env:ANNOUNCEMENTS) { diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 index 45ab44948..9ef761d78 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 @@ -49,3 +49,7 @@ function New-MDNewLine { $newLineSymbol = [System.Environment]::NewLine return $newLineSymbol * $Count } + +function Restore-UserOwner { + sudo chown -R ${env:USER}: $env:HOME +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 915f857fd..2c98ecbcb 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -4,7 +4,7 @@ function Get-7zipVersion { } function Get-AnsibleVersion { - $ansibleVersion = sudo ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1 + $ansibleVersion = ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1 return "Ansible $ansibleVersion" } @@ -19,12 +19,12 @@ function Get-AzCopy10Version { } function Get-BazelVersion { - $bazelVersion = sudo bazel --version | Select-String "bazel" | Take-OutputPart -Part 1 + $bazelVersion = bazel --version | Select-String "bazel" | Take-OutputPart -Part 1 return "Bazel $bazelVersion" } function Get-BazeliskVersion { - $bazeliskVersion = sudo bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" + $bazeliskVersion = bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" return "Bazelisk $bazeliskVersion" } @@ -92,7 +92,7 @@ function Get-GitFTPVersion { } function Get-GoogleCloudSDKVersion { - return "$(sudo gcloud --version | Select-Object -First 1)" + return "$(gcloud --version | Select-Object -First 1)" } function Get-HavegedVersion { @@ -101,7 +101,7 @@ function Get-HavegedVersion { } function Get-HerokuVersion { - $herokuVersion = sudo heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" + $herokuVersion = heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Heroku $herokuVersion" } @@ -201,12 +201,12 @@ function Get-JqVersion { } function Get-AzureCliVersion { - $azcliVersion = sudo az -v | Select-String "azure-cli" | Take-OutputPart -Part -1 + $azcliVersion = az -v | Select-String "azure-cli" | Take-OutputPart -Part -1 return "Azure CLI (azure-cli) $azcliVersion" } function Get-AzureDevopsVersion { - $azdevopsVersion = sudo az -v | Select-String "azure-devops" | Take-OutputPart -Part -1 + $azdevopsVersion = az -v | Select-String "azure-devops" | Take-OutputPart -Part -1 return "Azure CLI (azure-devops) $azdevopsVersion" } @@ -238,7 +238,7 @@ function Get-GitHubCliVersion { } function Get-NetlifyCliVersion { - $netlifyVersion = sudo netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" + $netlifyVersion = netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Netlify CLI $netlifyVersion" }