diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 5fafca0f1..64c828424 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -217,56 +217,6 @@ function Get-StackVersion { return "Stack $stackVersion" } -function Get-RustVersion { - $rustVersion = $(rustc --version) | Take-OutputPart -Part 1 - return "Rust $rustVersion" -} - -function Get-BindgenVersion { - $bindgenVersion = $(bindgen --version) | Take-OutputPart -Part 1 - return "Bindgen $bindgenVersion" -} - -function Get-CargoVersion { - $cargoVersion = $(cargo --version) | Take-OutputPart -Part 1 - return "Cargo $cargoVersion" -} - -function Get-CargoAuditVersion { - $cargoAuditVersion = $(cargo audit --version) | Take-OutputPart -Part 1 - return "Cargo audit $cargoAuditVersion" -} - -function Get-CargoOutdatedVersion { - $cargoOutdatedVersion = $(cargo outdated --version) | Take-OutputPart -Part 1 -Delimiter "v" - return "Cargo outdated $cargoOutdatedVersion" -} - -function Get-CargoClippyVersion { - $cargoClippyVersion = $(cargo-clippy --version) | Take-OutputPart -Part 1 - return "Cargo clippy $cargoClippyVersion" -} - -function Get-CbindgenVersion { - $cbindgenVersion = $(cbindgen --version) | Take-OutputPart -Part 1 - return "Cbindgen $cbindgenVersion" -} - -function Get-RustupVersion { - $rustupVersion = $(rustup --version) | Take-OutputPart -Part 1 - return "Rustup $rustupVersion" -} - -function Get-RustdocVersion { - $rustdocVersion = $(rustdoc --version) | Take-OutputPart -Part 1 - return "Rustdoc $rustdocVersion" -} - -function Get-RustfmtVersion { - $rustfmtVersion = $(rustfmt --version) | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-" - return "Rustfmt $rustfmtVersion" -} - function Get-AzModuleVersions { $azModuleVersions = Get-ChildItem /usr/share | Where-Object { $_ -match "az_\d+" } | Foreach-Object { $_.Name.Split("_")[1] diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 1cd951f3a..e0acc6bde 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -4,14 +4,15 @@ param ( ) Import-Module MarkdownPS +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.CachedTools.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Common.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Databases.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Rust.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking $markdown = "" diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 index 4bad753bd..45ab44948 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 @@ -37,8 +37,7 @@ function Test-IsUbuntu20 { return (lsb_release -rs) -eq "20.04" } -function Get-ToolsetContent -{ +function Get-ToolsetContent { $toolset = Join-Path $env:INSTALLER_SCRIPT_FOLDER "toolset.json" Get-Content $toolset -Raw | ConvertFrom-Json } diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 new file mode 100644 index 000000000..640ad2cf8 --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 @@ -0,0 +1,54 @@ +function Initialize-RustEnvironment { + ln -sf "/usr/share/rust/.rustup" $HOME/.rustup + ln -sf "/usr/share/rust/.cargo" $HOME/.cargo +} +function Get-RustVersion { + Initialize-RustEnvironment + $rustVersion = $(rustc --version) | Take-OutputPart -Part 1 + return "Rust $rustVersion" +} + +function Get-BindgenVersion { + $bindgenVersion = $(bindgen --version) | Take-OutputPart -Part 1 + return "Bindgen $bindgenVersion" +} + +function Get-CargoVersion { + $cargoVersion = $(cargo --version) | Take-OutputPart -Part 1 + return "Cargo $cargoVersion" +} + +function Get-CargoAuditVersion { + $cargoAuditVersion = $(cargo audit --version) | Take-OutputPart -Part 1 + return "Cargo audit $cargoAuditVersion" +} + +function Get-CargoOutdatedVersion { + $cargoOutdatedVersion = $(cargo outdated --version) | Take-OutputPart -Part 1 -Delimiter "v" + return "Cargo outdated $cargoOutdatedVersion" +} + +function Get-CargoClippyVersion { + $cargoClippyVersion = $(cargo-clippy --version) | Take-OutputPart -Part 1 + return "Cargo clippy $cargoClippyVersion" +} + +function Get-CbindgenVersion { + $cbindgenVersion = $(cbindgen --version) | Take-OutputPart -Part 1 + return "Cbindgen $cbindgenVersion" +} + +function Get-RustupVersion { + $rustupVersion = $(rustup --version) | Take-OutputPart -Part 1 + return "Rustup $rustupVersion" +} + +function Get-RustdocVersion { + $rustdocVersion = $(rustdoc --version) | Take-OutputPart -Part 1 + return "Rustdoc $rustdocVersion" +} + +function Get-RustfmtVersion { + $rustfmtVersion = $(rustfmt --version) | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-" + return "Rustfmt $rustfmtVersion" +} \ 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 05032cfb6..a76c17f9b 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 = ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1 + $ansibleVersion = sudo ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1 return "Ansible $ansibleVersion" } @@ -19,12 +19,12 @@ function Get-AzCopy10Version { } function Get-BazelVersion { - $bazelVersion = bazel --version | Select-String "bazel" | Take-OutputPart -Part 1 + $bazelVersion = sudo bazel --version | Select-String "bazel" | Take-OutputPart -Part 1 return "Bazel $bazelVersion" } function Get-BazeliskVersion { - $bazeliskVersion = bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" + $bazeliskVersion = sudo bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" return "Bazelisk $bazeliskVersion" } @@ -84,7 +84,7 @@ function Get-GitFTPVersion { } function Get-GoogleCloudSDKVersion { - return "$(gcloud --version | Select-Object -First 1)" + return "$(sudo gcloud --version | Select-Object -First 1)" } function Get-HavegedVersion { @@ -93,7 +93,7 @@ function Get-HavegedVersion { } function Get-HerokuVersion { - $herokuVersion = heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" + $herokuVersion = sudo heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Heroku $herokuVersion" } @@ -146,7 +146,7 @@ function Get-NewmanVersion { } function Get-NvmVersion { - $nvmVersion = bash -c "source $HOME/.nvm/nvm.sh && nvm --version" + $nvmVersion = bash -c "source /etc/skel/.nvm/nvm.sh && nvm --version" return "nvm $nvmVersion" } @@ -193,12 +193,12 @@ function Get-JqVersion { } function Get-AzureCliVersion { - $azcliVersion = az -v | Select-String "azure-cli" | Take-OutputPart -Part -1 + $azcliVersion = sudo az -v | Select-String "azure-cli" | Take-OutputPart -Part -1 return "Azure CLI (azure-cli) $azcliVersion" } function Get-AzureDevopsVersion { - $azdevopsVersion = az -v | Select-String "azure-devops" | Take-OutputPart -Part -1 + $azdevopsVersion = sudo az -v | Select-String "azure-devops" | Take-OutputPart -Part -1 return "Azure CLI (azure-devops) $azdevopsVersion" } @@ -230,7 +230,7 @@ function Get-GitHubCliVersion { } function Get-NetlifyCliVersion { - $netlifyVersion = netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" + $netlifyVersion = sudo netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Netlify CLI $netlifyVersion" } diff --git a/images/linux/scripts/installers/azcopy.sh b/images/linux/scripts/installers/azcopy.sh index 3efe54d11..9d15d37af 100644 --- a/images/linux/scripts/installers/azcopy.sh +++ b/images/linux/scripts/installers/azcopy.sh @@ -17,6 +17,7 @@ rm azcopy.tar.gz wget -O /tmp/azcopy.tar.gz https://aka.ms/downloadazcopy-v10-linux tar zxvf /tmp/azcopy.tar.gz --strip-components=1 -C /tmp mv /tmp/azcopy /usr/local/bin/azcopy10 +chmod +x /usr/local/bin/azcopy10 # Run tests to determine that the software installed as expected echo "Testing to make sure that script performed as expected, and basic scenarios work"