diff --git a/.gitignore b/.gitignore
index c47d414..6933723 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
+!src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.pdb
# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
diff --git a/Cargo.toml b/Cargo.toml
index 118f17a..6eeca91 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rust-pkg-gen"
-version = "0.1.0"
+version = "0.2.0"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/AverseABFun/rust-pkg-gen"
diff --git a/rust-config.EXAMPLE.toml b/rust-config.EXAMPLE.toml
deleted file mode 100644
index 9fddeaa..0000000
--- a/rust-config.EXAMPLE.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-[x64_package_linux_offline]
-toolchains = [
- {edition="2021", channel="nightly-2024-12-09", profile="complete", components=["rustfmt", "rustsrc"]}
-]
-
-[x64_package_linux_offline.meta]
-offline = true
-platforms = [
- "x86_64-unknown-linux-gnu"
-]
-targets = [
- "x86_64-unknown-linux-gnu",
- "x86_64-pc-windows-gnu"
-]
-
-[x64_package_linux_offline.crates]
-"*-nightly" = {"syn"="2.0.90"}
\ No newline at end of file
diff --git a/src/copied.rs b/src/copied.rs
index 3f3b683..39b46cd 100644
--- a/src/copied.rs
+++ b/src/copied.rs
@@ -88,7 +88,7 @@ pub fn normalize_path(path: &Path) -> PathBuf {
ret
}
-/// This is the beefy function. It takes an absurd number of arguments
+/// This is a beefy function. It takes an absurd number of arguments
/// and based on them downloads a certain subset of the rust components
/// that are relevant.
///
@@ -127,7 +127,9 @@ pub fn download_all(
}
for (target, formats) in format_map.clone() {
if !platforms.contains(&target) {
- return Some(anyhow!("target that is not being built for in target map"));
+ return Some(anyhow!(
+ "target {target} that is not being built for in target map"
+ ));
}
if formats.len() < 1 {
return Some(anyhow!("format list is empty"));
diff --git a/src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.deps.json b/src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.deps.json
new file mode 100644
index 0000000..f9ef2c9
--- /dev/null
+++ b/src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.deps.json
@@ -0,0 +1,261 @@
+{
+ "runtimeTarget": {
+ "name": ".NETStandard,Version=v2.0/",
+ "signature": ""
+ },
+ "compilationOptions": {},
+ "targets": {
+ ".NETStandard,Version=v2.0": {},
+ ".NETStandard,Version=v2.0/": {
+ "7Zip4PowerShell/2.6.2": {
+ "dependencies": {
+ "GitVersion.MsBuild": "6.1.0",
+ "JetBrains.Annotations": "2024.3.0",
+ "NETStandard.Library": "2.0.3",
+ "PowerShellStandard.Library": "5.1.1",
+ "Squid-Box.SevenZipSharp": "1.6.2.24"
+ },
+ "runtime": {
+ "7Zip4PowerShell.dll": {}
+ }
+ },
+ "GitVersion.MsBuild/6.1.0": {},
+ "JetBrains.Annotations/2024.3.0": {
+ "runtime": {
+ "lib/netstandard2.0/JetBrains.Annotations.dll": {
+ "assemblyVersion": "4242.42.42.42",
+ "fileVersion": "2024.3.0.0"
+ }
+ }
+ },
+ "Microsoft.NETCore.Platforms/1.1.0": {},
+ "NETStandard.Library/2.0.3": {
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "1.1.0"
+ }
+ },
+ "PowerShellStandard.Library/5.1.1": {
+ "runtime": {
+ "lib/netstandard2.0/System.Management.Automation.dll": {
+ "assemblyVersion": "3.0.0.0",
+ "fileVersion": "5.1.1.0"
+ }
+ }
+ },
+ "Squid-Box.SevenZipSharp/1.6.2.24": {
+ "dependencies": {
+ "System.Configuration.ConfigurationManager": "4.5.0",
+ "System.Security.Permissions": "4.5.0"
+ },
+ "runtime": {
+ "lib/netstandard2.0/SevenZipSharp.dll": {
+ "assemblyVersion": "1.6.2.24",
+ "fileVersion": "1.6.2.24"
+ }
+ }
+ },
+ "System.Buffers/4.4.0": {
+ "runtime": {
+ "lib/netstandard2.0/System.Buffers.dll": {
+ "assemblyVersion": "4.0.2.0",
+ "fileVersion": "4.6.25519.3"
+ }
+ }
+ },
+ "System.Configuration.ConfigurationManager/4.5.0": {
+ "dependencies": {
+ "System.Security.Cryptography.ProtectedData": "4.5.0",
+ "System.Security.Permissions": "4.5.0"
+ },
+ "runtime": {
+ "lib/netstandard2.0/System.Configuration.ConfigurationManager.dll": {
+ "assemblyVersion": "4.0.1.0",
+ "fileVersion": "4.6.26515.6"
+ }
+ }
+ },
+ "System.Memory/4.5.0": {
+ "dependencies": {
+ "System.Buffers": "4.4.0",
+ "System.Numerics.Vectors": "4.4.0",
+ "System.Runtime.CompilerServices.Unsafe": "4.5.0"
+ },
+ "runtime": {
+ "lib/netstandard2.0/System.Memory.dll": {
+ "assemblyVersion": "4.0.1.0",
+ "fileVersion": "4.6.26515.6"
+ }
+ }
+ },
+ "System.Numerics.Vectors/4.4.0": {
+ "runtime": {
+ "lib/netstandard2.0/System.Numerics.Vectors.dll": {
+ "assemblyVersion": "4.1.3.0",
+ "fileVersion": "4.6.25519.3"
+ }
+ }
+ },
+ "System.Runtime.CompilerServices.Unsafe/4.5.0": {
+ "runtime": {
+ "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
+ "assemblyVersion": "4.0.4.0",
+ "fileVersion": "0.0.0.0"
+ }
+ }
+ },
+ "System.Security.AccessControl/4.5.0": {
+ "dependencies": {
+ "System.Security.Principal.Windows": "4.5.0"
+ },
+ "runtime": {
+ "lib/netstandard2.0/System.Security.AccessControl.dll": {
+ "assemblyVersion": "4.1.1.0",
+ "fileVersion": "4.6.26515.6"
+ }
+ }
+ },
+ "System.Security.Cryptography.ProtectedData/4.5.0": {
+ "dependencies": {
+ "System.Memory": "4.5.0"
+ },
+ "runtime": {
+ "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": {
+ "assemblyVersion": "4.0.3.0",
+ "fileVersion": "4.6.26515.6"
+ }
+ }
+ },
+ "System.Security.Permissions/4.5.0": {
+ "dependencies": {
+ "System.Security.AccessControl": "4.5.0"
+ },
+ "runtime": {
+ "lib/netstandard2.0/System.Security.Permissions.dll": {
+ "assemblyVersion": "4.0.1.0",
+ "fileVersion": "4.6.26515.6"
+ }
+ }
+ },
+ "System.Security.Principal.Windows/4.5.0": {
+ "runtime": {
+ "lib/netstandard2.0/System.Security.Principal.Windows.dll": {
+ "assemblyVersion": "4.1.1.0",
+ "fileVersion": "4.6.26515.6"
+ }
+ }
+ }
+ }
+ },
+ "libraries": {
+ "7Zip4PowerShell/2.6.2": {
+ "type": "project",
+ "serviceable": false,
+ "sha512": ""
+ },
+ "GitVersion.MsBuild/6.1.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-qZFJ+vJQp/BybHH15RUq15Cg46tHXVKaxwdDFEvrA3MjClEXHpmDwKQzvaPOk9ysS2h6A+fOzcsyXiXqRbF5ZA==",
+ "path": "gitversion.msbuild/6.1.0",
+ "hashPath": "gitversion.msbuild.6.1.0.nupkg.sha512"
+ },
+ "JetBrains.Annotations/2024.3.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-ox5pkeLQXjvJdyAB4b2sBYAlqZGLh3PjSnP1bQNVx72ONuTJ9+34/+Rq91Fc0dG29XG9RgZur9+NcP4riihTug==",
+ "path": "jetbrains.annotations/2024.3.0",
+ "hashPath": "jetbrains.annotations.2024.3.0.nupkg.sha512"
+ },
+ "Microsoft.NETCore.Platforms/1.1.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
+ "path": "microsoft.netcore.platforms/1.1.0",
+ "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
+ },
+ "NETStandard.Library/2.0.3": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
+ "path": "netstandard.library/2.0.3",
+ "hashPath": "netstandard.library.2.0.3.nupkg.sha512"
+ },
+ "PowerShellStandard.Library/5.1.1": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-e31xJjG+Kjbv6YF3Yq6D4Dl3or8v7LrNF41k3CXrWozW6hR1zcOe5KYuZJaGSiAgLnwP8wcW+I3+IWEzMPZKXQ==",
+ "path": "powershellstandard.library/5.1.1",
+ "hashPath": "powershellstandard.library.5.1.1.nupkg.sha512"
+ },
+ "Squid-Box.SevenZipSharp/1.6.2.24": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-1T4GqUM9YveA/HsFsco67tXyzrBTo7vbzHC3ZSY7xxPe9s2yN65R42O3PnUEukmpB30wx+162YeMI4Xx/156LA==",
+ "path": "squid-box.sevenzipsharp/1.6.2.24",
+ "hashPath": "squid-box.sevenzipsharp.1.6.2.24.nupkg.sha512"
+ },
+ "System.Buffers/4.4.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-AwarXzzoDwX6BgrhjoJsk6tUezZEozOT5Y9QKF94Gl4JK91I4PIIBkBco9068Y9/Dra8Dkbie99kXB8+1BaYKw==",
+ "path": "system.buffers/4.4.0",
+ "hashPath": "system.buffers.4.4.0.nupkg.sha512"
+ },
+ "System.Configuration.ConfigurationManager/4.5.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-UIFvaFfuKhLr9u5tWMxmVoDPkFeD+Qv8gUuap4aZgVGYSYMdERck4OhLN/2gulAc0nYTEigWXSJNNWshrmxnng==",
+ "path": "system.configuration.configurationmanager/4.5.0",
+ "hashPath": "system.configuration.configurationmanager.4.5.0.nupkg.sha512"
+ },
+ "System.Memory/4.5.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-m0psCSpUxTGfvwyO0i03ajXVhgBqyXlibXz0Mo1dtKGjaHrXFLnuQ8rNBTmWRqbfRjr4eC6Wah4X5FfuFDu5og==",
+ "path": "system.memory/4.5.0",
+ "hashPath": "system.memory.4.5.0.nupkg.sha512"
+ },
+ "System.Numerics.Vectors/4.4.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==",
+ "path": "system.numerics.vectors/4.4.0",
+ "hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512"
+ },
+ "System.Runtime.CompilerServices.Unsafe/4.5.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-YrzNWduCDHhUaSRBxHxL11UkM2fD6y8hITHis4/LbQZ6vj3vdRjoH3IoPWWC9uDXK2wHIqn+b5gv1Np/VKyM1g==",
+ "path": "system.runtime.compilerservices.unsafe/4.5.0",
+ "hashPath": "system.runtime.compilerservices.unsafe.4.5.0.nupkg.sha512"
+ },
+ "System.Security.AccessControl/4.5.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-vW8Eoq0TMyz5vAG/6ce483x/CP83fgm4SJe5P8Tb1tZaobcvPrbMEL7rhH1DRdrYbbb6F0vq3OlzmK0Pkwks5A==",
+ "path": "system.security.accesscontrol/4.5.0",
+ "hashPath": "system.security.accesscontrol.4.5.0.nupkg.sha512"
+ },
+ "System.Security.Cryptography.ProtectedData/4.5.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-wLBKzFnDCxP12VL9ANydSYhk59fC4cvOr9ypYQLPnAj48NQIhqnjdD2yhP8yEKyBJEjERWS9DisKL7rX5eU25Q==",
+ "path": "system.security.cryptography.protecteddata/4.5.0",
+ "hashPath": "system.security.cryptography.protecteddata.4.5.0.nupkg.sha512"
+ },
+ "System.Security.Permissions/4.5.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-9gdyuARhUR7H+p5CjyUB/zPk7/Xut3wUSP8NJQB6iZr8L3XUXTMdoLeVAg9N4rqF8oIpE7MpdqHdDHQ7XgJe0g==",
+ "path": "system.security.permissions/4.5.0",
+ "hashPath": "system.security.permissions.4.5.0.nupkg.sha512"
+ },
+ "System.Security.Principal.Windows/4.5.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-U77HfRXlZlOeIXd//Yoj6Jnk8AXlbeisf1oq1os+hxOGVnuG+lGSfGqTwTZBoORFF6j/0q7HXIl8cqwQ9aUGqQ==",
+ "path": "system.security.principal.windows/4.5.0",
+ "hashPath": "system.security.principal.windows.4.5.0.nupkg.sha512"
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.dll b/src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.dll
new file mode 100644
index 0000000..bd25022
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.pdb b/src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.pdb
new file mode 100644
index 0000000..12c2672
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/7Zip4PowerShell.pdb differ
diff --git a/src/install/7Zip4Powershell/2.7.0/7Zip4Powershell.psd1 b/src/install/7Zip4Powershell/2.7.0/7Zip4Powershell.psd1
new file mode 100644
index 0000000..16c4038
--- /dev/null
+++ b/src/install/7Zip4Powershell/2.7.0/7Zip4Powershell.psd1
@@ -0,0 +1,28 @@
+@{
+GUID = 'bd4390dc-a8ad-4bce-8d69-f53ccf8e4163'
+Author = 'Thomas Freudenberg'
+Description = 'Powershell module for creating and extracting 7-Zip archives'
+CompanyName = 'N/A'
+Copyright = '2013-2021 Thomas Freudenberg'
+DotNetFrameworkVersion = '4.7.2'
+ModuleVersion = '2.7.0'
+PowerShellVersion = '5.0'
+PrivateData = @{
+ PSData = @{
+ Tags = @('powershell', '7zip', '7-zip', 'zip', 'archive', 'extract', 'compress', 'PSEdition_Core', 'PSEdition_Desktop', 'Windows')
+ LicenseUri = 'https://github.com/thoemmi/7Zip4Powershell/blob/master/LICENSE'
+ ProjectUri = 'https://github.com/thoemmi/7Zip4Powershell'
+ IconUri = 'https://raw.githubusercontent.com/thoemmi/7Zip4Powershell/master/Assets/7zip4powershell.png'
+ RequireLicenseAcceptance = $false
+ PreRelease = ''
+ # ReleaseNotes = ''
+ } # End of PSData hashtable
+}
+
+NestedModules = @("7Zip4PowerShell.dll")
+CmdletsToExport = @(
+ "Expand-7Zip",
+ "Compress-7Zip",
+ "Get-7Zip",
+ "Get-7ZipInformation")
+}
diff --git a/src/install/7Zip4Powershell/2.7.0/7z.dll b/src/install/7Zip4Powershell/2.7.0/7z.dll
new file mode 100644
index 0000000..729036f
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/7z.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/7z64.dll b/src/install/7Zip4Powershell/2.7.0/7z64.dll
new file mode 100644
index 0000000..e81e08b
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/7z64.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/PSGetModuleInfo.xml b/src/install/7Zip4Powershell/2.7.0/PSGetModuleInfo.xml
new file mode 100644
index 0000000..e1cc5a2
--- /dev/null
+++ b/src/install/7Zip4Powershell/2.7.0/PSGetModuleInfo.xml
@@ -0,0 +1,136 @@
+
+
+
+ Microsoft.PowerShell.Commands.PSRepositoryItemInfo
+ System.Management.Automation.PSCustomObject
+ System.Object
+
+
+ 7Zip4Powershell
+ 2.7.0
+ Module
+ Powershell module for creating and extracting 7-Zip archives
+ Thomas Freudenberg
+ thoemmi
+ 2013-2021 Thomas Freudenberg
+ 2024-12-10T20:06:18-06:00
+
+
+ https://github.com/thoemmi/7Zip4Powershell/blob/master/LICENSE
+ https://github.com/thoemmi/7Zip4Powershell
+ https://raw.githubusercontent.com/thoemmi/7Zip4Powershell/master/Assets/7zip4powershell.png
+
+
+ System.Object[]
+ System.Array
+ System.Object
+
+
+ powershell
+ 7zip
+ 7-zip
+ zip
+ archive
+ extract
+ compress
+ PSEdition_Core
+ PSEdition_Desktop
+ Windows
+ PSModule
+
+
+
+
+ System.Collections.Hashtable
+ System.Object
+
+
+
+ Cmdlet
+
+
+
+ Expand-7Zip
+ Compress-7Zip
+ Get-7Zip
+ Get-7ZipInformation
+
+
+
+
+ Command
+
+
+
+ Expand-7Zip
+ Compress-7Zip
+ Get-7Zip
+ Get-7ZipInformation
+
+
+
+
+ Function
+
+
+
+
+
+
+ Workflow
+
+
+
+ RoleCapability
+
+
+
+ DscResource
+
+
+
+
+
+
+
+
+
+
+ https://www.powershellgallery.com/api/v2
+ PSGallery
+ NuGet
+
+
+ System.Management.Automation.PSCustomObject
+ System.Object
+
+
+ 2013-2021 Thomas Freudenberg
+ Powershell module for creating and extracting 7-Zip archives
+ False
+ True
+ True
+ 101029
+ 18016680
+ 3108050
+ 12/10/2024 8:06:18PM -06:00
+ 12/10/2024 8:06:18PM -06:00
+ 12/25/2024 7:00:00PM -06:00
+ powershell 7zip 7-zip zip archive extract compress PSEdition_Core PSEdition_Desktop Windows PSModule PSCmdlet_Expand-7Zip PSCommand_Expand-7Zip PSCmdlet_Compress-7Zip PSCommand_Compress-7Zip PSCmdlet_Get-7Zip PSCommand_Get-7Zip PSCmdlet_Get-7ZipInformation PSCommand_Get-7ZipInformation PSIncludes_Cmdlet
+ False
+ 2024-12-25T19:00:00Z
+ 2.7.0
+ Thomas Freudenberg
+ false
+ Module
+ 7Zip4Powershell.nuspec|7z.dll|7z64.dll|7Zip4PowerShell.deps.json|7Zip4PowerShell.dll|7Zip4PowerShell.pdb|7Zip4Powershell.psd1|SevenZipSharp.dll|System.Buffers.dll|System.Configuration.ConfigurationManager.dll|System.Management.Automation.dll|System.Memory.dll|System.Numerics.Vectors.dll|System.Runtime.CompilerServices.Unsafe.dll|System.Security.AccessControl.dll|System.Security.Cryptography.ProtectedData.dll|System.Security.Permissions.dll|System.Security.Principal.Windows.dll
+ bd4390dc-a8ad-4bce-8d69-f53ccf8e4163
+ 5.0
+ 4.7.2
+ N/A
+
+
+ /home/averse/rust-pkg-gen/src/install/7Zip4Powershell/2.7.0
+
+
+
diff --git a/src/install/7Zip4Powershell/2.7.0/SevenZipSharp.dll b/src/install/7Zip4Powershell/2.7.0/SevenZipSharp.dll
new file mode 100644
index 0000000..5a724c9
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/SevenZipSharp.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Buffers.dll b/src/install/7Zip4Powershell/2.7.0/System.Buffers.dll
new file mode 100644
index 0000000..b6d9c77
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Buffers.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Configuration.ConfigurationManager.dll b/src/install/7Zip4Powershell/2.7.0/System.Configuration.ConfigurationManager.dll
new file mode 100644
index 0000000..7d0b114
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Configuration.ConfigurationManager.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Management.Automation.dll b/src/install/7Zip4Powershell/2.7.0/System.Management.Automation.dll
new file mode 100644
index 0000000..4774bbd
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Management.Automation.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Memory.dll b/src/install/7Zip4Powershell/2.7.0/System.Memory.dll
new file mode 100644
index 0000000..4171ff3
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Memory.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Numerics.Vectors.dll b/src/install/7Zip4Powershell/2.7.0/System.Numerics.Vectors.dll
new file mode 100644
index 0000000..a808165
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Numerics.Vectors.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Runtime.CompilerServices.Unsafe.dll b/src/install/7Zip4Powershell/2.7.0/System.Runtime.CompilerServices.Unsafe.dll
new file mode 100644
index 0000000..0b45903
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Runtime.CompilerServices.Unsafe.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Security.AccessControl.dll b/src/install/7Zip4Powershell/2.7.0/System.Security.AccessControl.dll
new file mode 100644
index 0000000..e807432
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Security.AccessControl.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Security.Cryptography.ProtectedData.dll b/src/install/7Zip4Powershell/2.7.0/System.Security.Cryptography.ProtectedData.dll
new file mode 100644
index 0000000..3feb9f9
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Security.Cryptography.ProtectedData.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Security.Permissions.dll b/src/install/7Zip4Powershell/2.7.0/System.Security.Permissions.dll
new file mode 100644
index 0000000..d1af38f
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Security.Permissions.dll differ
diff --git a/src/install/7Zip4Powershell/2.7.0/System.Security.Principal.Windows.dll b/src/install/7Zip4Powershell/2.7.0/System.Security.Principal.Windows.dll
new file mode 100644
index 0000000..afd187c
Binary files /dev/null and b/src/install/7Zip4Powershell/2.7.0/System.Security.Principal.Windows.dll differ
diff --git a/src/install/install.fish b/src/install/install.fish
old mode 100644
new mode 100755
index 1c5dfb6..7f8e176
--- a/src/install/install.fish
+++ b/src/install/install.fish
@@ -1 +1,2 @@
-#!/bin/fish
\ No newline at end of file
+#!/bin/fish
+/bin/sh $(status dirname)/install.sh # lets pray that /bin/sh isn't fish...
diff --git a/src/install/install.ps1 b/src/install/install.ps1
old mode 100644
new mode 100755
index e7c8d4f..447df34
--- a/src/install/install.ps1
+++ b/src/install/install.ps1
@@ -1 +1,143 @@
-Start-Process
\ No newline at end of file
+if (!$IsWindows) {
+ Write-Output "Sorry, but this powershell script currently doesn't support powershell core."
+ Exit
+}
+
+$workdir = "$($Env:temp)\tmp$([convert]::tostring((get-random 65535),16).padleft(4,'0')).tmp"
+New-Item -ItemType Directory -Path $workdir
+
+function cleanup {
+ Pop-Location
+ Remove-Item $workdir -Recurse -Force
+}
+
+trap {
+ cleanup
+}
+
+$PARENT_DIR = ""
+
+if ( $VERSION -ge 3 ) {
+ $PARENT_DIR = $PSScriptRoot
+}
+else {
+ $PARENT_DIR = split-path -parent $MyInvocation.MyCommand.Definition
+}
+
+$FORCE_TAR = $env:FORCE_TAR ?? $false
+$USE_TAR = $true
+
+if (-not (Get-Command tar -ErrorAction Ignore)) {
+ if ($FORCE_TAR) {
+ Write-Output "FORCE_TAR is set and tar is uninstalled, please either update your system or unset FORCE_TAR!"
+ cleanup
+ Exit
+ }
+ Write-Output "Cannot find tar, using Expand-7Zip"
+ if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) {
+ Write-Output "Importing bundled version of 7Zip4Powershell(could not find system version)..."
+ $pathToModule = "$PARENT_DIR\7Zip4Powershell\2.7.0\7Zip4PowerShell.psd1"
+ Import-Module $pathToModule
+ $USE_TAR = $false
+ }
+}
+
+$FORMAT = $env:FORMAT ?? ".tar.gz"
+
+if ($USE_TAR) {
+ if (!(tar --help | Select-String -Pattern gzip)) {
+ if (!(tar --help | Select-String -Pattern xz)) {
+ Write-Output "Tar does not support gzip or xz, using Expand-7Zip"
+ if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) {
+ Write-Output "Importing bundled version of 7Zip4Powershell(could not find system version)..."
+ $pathToModule = "$PARENT_DIR\7Zip4Powershell\2.7.0\7Zip4PowerShell.psd1"
+ Import-Module $pathToModule
+ $USE_TAR = $false
+ }
+ }
+ else {
+ if ($FORMAT -eq ".tar.gz") {
+ Write-Output "Tar does not support gzip, using xz"
+ $FORMAT = ".tar.xz"
+ }
+ }
+ }
+ else {
+ if (!(tar --help | Select-String -Pattern xz)) {
+ if ($FORMAT -eq ".tar.xz") {
+ Write-Output "Tar does not support xz, using gzip"
+ $FORMAT = ".tar.gz"
+ }
+ }
+ }
+}
+
+Push-Location .
+
+$USING_MSI = $env:USING_MSI ?? &?TOOLCHAIN.MSI
+$VERSION = $PSVersionTable.PSVersion.Major ?? 1
+
+$COMPONENTS = $env:COMPONENTS ?? "&?TOOLCHAIN.COMPONENTS"
+$CHANNEL = $env:CHANNEL ?? "&?TOOLCHAIN.CHANNEL"
+
+$TAR_FLAGS = $env:TAR_FLAGS ?? "-xf"
+$EXPAND_7ZIP_FLAGS = $env:EXPAND_7ZIP_FLAGS ?? ""
+$MSI_FLAGS = $env:MSI_FLAGS ?? ""
+
+Set-Location $PARENT_DIR
+
+if ($USING_MSI) {
+ Start-Process msiexec "$MSI_FLAGS $PARENT_DIR\toolchain\rust-$CHANNEL-$target_triple.msi";
+}
+$arch = "i686"
+if ([System.Environment]::Is64BitProcess) {
+ $arch = "x86_64"
+}
+
+$target_triple = "$arch-pc-windows-msvc"
+
+$COMPONENTS.Split(" ") | ForEach-Object {
+ $comp = $_
+ if (! $(Test-Path "$PARENT_DIR\toolchain\$comp-$CHANNEL-$target_triple.$FORMAT" -PathType Leaf)) {
+ if ($env:IGNORE_NONEXISTANT_COMPONENTS) {
+ return # actually continue, but foreach-object is weird
+ }
+ Write-Output "Expected file $PARENT_DIR\toolchain\$comp-$CHANNEL-$target_triple.$FORMAT to exist, but doesn't!"
+ Write-Output "(hint: to ignore and continue, set the environment variable IGNORE_NONEXISTANT_COMPONENTS to any truthy value)"
+ cleanup
+ Exit
+ }
+ if (! $env:DONT_HASH) {
+ if (! $(Test-Path "$PARENT_DIR\toolchain\$comp-$CHANNEL-$target_triple.$FORMAT.sha256" -PathType Leaf)) {
+ Write-Output "Expected file $PARENT_DIR\toolchain\$comp-$CHANNEL-$target_triple.$FORMAT.sha256 to exist, but doesn't!"
+ Write-Output "(hint: to ignore and continue, set the environment variable DONT_HASH to any truthy value)"
+ cleanup
+ Exit
+ }
+ $HASH1 = $(Get-FileHash "$PARENT_DIR\toolchain\$comp-$CHANNEL-$target_triple.$FORMAT" -Algorithm SHA256)
+ $HASH2 = $(Get-Content "$PARENT_DIR\toolchain\$comp-$CHANNEL-$target_triple.$FORMAT.sha256")
+ if ($HASH1 -ne $HASH2) {
+ Write-Output "Error: Hash of $PARENT_DIR\toolchain\$comp-$CHANNEL-$target_triple.$FORMAT does not match expected hash!"
+ Write-Output "(hint: to disable this warning, set the environment variable DONT_HASH to 1)"
+ cleanup
+ Exit
+ }
+ Write-Output "Tested - hash and expected hash of $comp-$CHANNEL-$target_triple.$FORMAT match($HASH1)!"
+ }
+ New-Item -Path $(Get-Location) -Name "$comp-$CHANNEL-$target_triple" -ItemType "directory"
+ Set-Location "$comp-$CHANNEL-$target_triple"
+ if ($USE_TAR) {
+ tar $TAR_FLAGS "$PARENT_DIR\toolchain\$comp-$CHANNEL-$target_triple.$FORMAT"
+ }
+ else {
+ Expand-7Zip "$PARENT_DIR\toolchain\$comp-$CHANNEL-$target_triple.$FORMAT" $(Get-Location) $EXPAND_7ZIP_FLAGS
+ }
+ Set-Location "$comp-$CHANNEL-$target_triple"
+ New-Item -Path "$env:USERPROFILE" -Name ".cargo" -ItemType Directory
+ New-Item -Path "$env:USERPROFILE\.cargo" -Name "bin" -ItemType Directory
+ (Get-Content "$(Get-Location)\components").Split("`n") | ForEach-Object {
+ Copy-Item "$(Get-Location)\$_\bin\*" "$env:USERPROFILE\.cargo\bin" -Recurse
+ }
+}
+
+cleanup
\ No newline at end of file
diff --git a/src/install/install.sh b/src/install/install.sh
old mode 100644
new mode 100755
index 96b4b06..def3b62
--- a/src/install/install.sh
+++ b/src/install/install.sh
@@ -1 +1,454 @@
-#!/bin/sh
\ No newline at end of file
+#!/bin/sh
+# shellcheck shell=dash
+
+:
+
+{ #This block of code taken from https://github.com/rust-lang/rustup/blob/7ccf717e6e1aee46f65cc6fea4132a3f0e37593b/rustup-init.sh
+
+ _ansi_escapes_are_valid=false
+ if [ -t 2 ]; then
+ if [ "${TERM+set}" = 'set' ]; then
+ case "$TERM" in
+ xterm* | rxvt* | urxvt* | linux* | vt*)
+ _ansi_escapes_are_valid=true
+ ;;
+ esac
+ fi
+ fi
+
+ check_cmd() {
+ command -v "$1" >/dev/null 2>&1
+ }
+
+ err() {
+ __print 'error' "$1" >&2
+ }
+
+ __print() {
+ if $_ansi_escapes_are_valid; then
+ printf '\33[1m%s:\33[0m %s\n' "$1" "$2" >&2
+ else
+ printf '%s: %s\n' "$1" "$2" >&2
+ fi
+ }
+
+ need_cmd() {
+ if ! check_cmd "$1"; then
+ err "need '$1' (command not found)"
+ fi
+ }
+
+ get_current_exe() {
+ # Returns the executable used for system architecture detection
+ # This is only run on Linux
+ if test -L /proc/self/exe; then
+ _current_exe=/proc/self/exe
+ else
+ warn "Unable to find /proc/self/exe. System architecture detection might be inaccurate."
+ if test -n "$SHELL"; then
+ _current_exe=$SHELL
+ else
+ need_cmd /bin/sh
+ _current_exe=/bin/sh
+ fi
+ warn "Falling back to $_current_exe."
+ fi
+ echo "$_current_exe"
+ }
+
+ get_bitness() {
+ need_cmd head
+ # Architecture detection without dependencies beyond coreutils.
+ # ELF files start out "\x7fELF", and the following byte is
+ # 0x01 for 32-bit and
+ # 0x02 for 64-bit.
+ # The printf builtin on some shells like dash only supports octal
+ # escape sequences, so we use those.
+ _current_exe_head=$(head -c 5 "$_current_exe")
+ if [ "$_current_exe_head" = "$(printf '\177ELF\001')" ]; then
+ echo 32
+ elif [ "$_current_exe_head" = "$(printf '\177ELF\002')" ]; then
+ echo 64
+ else
+ err "unknown platform bitness"
+ exit 1
+ fi
+ }
+
+ get_architecture() {
+ _ostype="$(uname -s)"
+ _cputype="$(uname -m)"
+ _clibtype="gnu"
+
+ if [ "$_ostype" = Linux ]; then
+ if [ "$(uname -o)" = Android ]; then
+ _ostype=Android
+ fi
+ if ldd --version 2>&1 | grep -q 'musl'; then
+ _clibtype="musl"
+ fi
+ fi
+
+ if [ "$_ostype" = Darwin ]; then
+ # Darwin `uname -m` can lie due to Rosetta shenanigans. If you manage to
+ # invoke a native shell binary and then a native uname binary, you can
+ # get the real answer, but that's hard to ensure, so instead we use
+ # `sysctl` (which doesn't lie) to check for the actual architecture.
+ if [ "$_cputype" = i386 ]; then
+ # Handling i386 compatibility mode in older macOS versions (<10.15)
+ # running on x86_64-based Macs.
+ # Starting from 10.15, macOS explicitly bans all i386 binaries from running.
+ # See:
+
+ # Avoid `sysctl: unknown oid` stderr output and/or non-zero exit code.
+ if sysctl hw.optional.x86_64 2>/dev/null || true | grep -q ': 1'; then
+ _cputype=x86_64
+ fi
+ elif [ "$_cputype" = x86_64 ]; then
+ # Handling x86-64 compatibility mode (a.k.a. Rosetta 2)
+ # in newer macOS versions (>=11) running on arm64-based Macs.
+ # Rosetta 2 is built exclusively for x86-64 and cannot run i386 binaries.
+
+ # Avoid `sysctl: unknown oid` stderr output and/or non-zero exit code.
+ if sysctl hw.optional.arm64 2>/dev/null || true | grep -q ': 1'; then
+ _cputype=arm64
+ fi
+ fi
+ fi
+
+ if [ "$_ostype" = SunOS ]; then
+ # Both Solaris and illumos presently announce as "SunOS" in "uname -s"
+ # so use "uname -o" to disambiguate. We use the full path to the
+ # system uname in case the user has coreutils uname first in PATH,
+ # which has historically sometimes printed the wrong value here.
+ if [ "$(/usr/bin/uname -o)" = illumos ]; then
+ _ostype=illumos
+ fi
+
+ # illumos systems have multi-arch userlands, and "uname -m" reports the
+ # machine hardware name; e.g., "i86pc" on both 32- and 64-bit x86
+ # systems. Check for the native (widest) instruction set on the
+ # running kernel:
+ if [ "$_cputype" = i86pc ]; then
+ _cputype="$(isainfo -n)"
+ fi
+ fi
+
+ case "$_ostype" in
+
+ Android)
+ _ostype=linux-android
+ ;;
+
+ Linux)
+ _current_exe=$(get_current_exe)
+ _ostype=unknown-linux-$_clibtype
+ _bitness=$(get_bitness "$_current_exe")
+ ;;
+
+ FreeBSD)
+ _ostype=unknown-freebsd
+ ;;
+
+ NetBSD)
+ _ostype=unknown-netbsd
+ ;;
+
+ DragonFly)
+ _ostype=unknown-dragonfly
+ ;;
+
+ Darwin)
+ _ostype=apple-darwin
+ ;;
+
+ illumos)
+ _ostype=unknown-illumos
+ ;;
+
+ MINGW* | MSYS* | CYGWIN* | Windows_NT)
+ _ostype=pc-windows-gnu
+ ;;
+
+ *)
+ err "unrecognized OS type: $_ostype"
+ exit 1
+ ;;
+
+ esac
+
+ case "$_cputype" in
+
+ i386 | i486 | i686 | i786 | x86)
+ _cputype=i686
+ ;;
+
+ xscale | arm)
+ _cputype=arm
+ if [ "$_ostype" = "linux-android" ]; then
+ _ostype=linux-androideabi
+ fi
+ ;;
+
+ armv6l)
+ _cputype=arm
+ if [ "$_ostype" = "linux-android" ]; then
+ _ostype=linux-androideabi
+ else
+ _ostype="${_ostype}eabihf"
+ fi
+ ;;
+
+ armv7l | armv8l)
+ _cputype=armv7
+ if [ "$_ostype" = "linux-android" ]; then
+ _ostype=linux-androideabi
+ else
+ _ostype="${_ostype}eabihf"
+ fi
+ ;;
+
+ aarch64 | arm64)
+ _cputype=aarch64
+ ;;
+
+ x86_64 | x86-64 | x64 | amd64)
+ _cputype=x86_64
+ ;;
+
+ mips)
+ _cputype=$(get_endianness "$_current_exe" mips '' el)
+ ;;
+
+ mips64)
+ if [ "$_bitness" -eq 64 ]; then
+ # only n64 ABI is supported for now
+ _ostype="${_ostype}abi64"
+ _cputype=$(get_endianness "$_current_exe" mips64 '' el)
+ fi
+ ;;
+
+ ppc)
+ _cputype=powerpc
+ ;;
+
+ ppc64)
+ _cputype=powerpc64
+ ;;
+
+ ppc64le)
+ _cputype=powerpc64le
+ ;;
+
+ s390x)
+ _cputype=s390x
+ ;;
+ riscv64)
+ _cputype=riscv64gc
+ ;;
+ loongarch64)
+ _cputype=loongarch64
+ ensure_loongarch_uapi
+ ;;
+ *)
+ err "unknown CPU type: $_cputype"
+ exit 1
+ ;;
+
+ esac
+
+ # Detect 64-bit linux with 32-bit userland
+ if [ "${_ostype}" = unknown-linux-gnu ] && [ "${_bitness}" -eq 32 ]; then
+ case $_cputype in
+ x86_64)
+ if [ -n "${RUSTUP_CPUTYPE:-}" ]; then
+ _cputype="$RUSTUP_CPUTYPE"
+ else {
+ # 32-bit executable for amd64 = x32
+ if is_host_amd64_elf "$_current_exe"; then {
+ err "This host is running an x32 userland, for which no native toolchain is provided."
+ err "You will have to install multiarch compatibility with i686 or amd64."
+ err "To do so, set the RUSTUP_CPUTYPE environment variable set to i686 or amd64 and re-run this script."
+ err "You will be able to add an x32 target after installation by running \`rustup target add x86_64-unknown-linux-gnux32\`."
+ exit 1
+ }; else
+ _cputype=i686
+ fi
+ }; fi
+ ;;
+ mips64)
+ _cputype=$(get_endianness "$_current_exe" mips '' el)
+ ;;
+ powerpc64)
+ _cputype=powerpc
+ ;;
+ aarch64)
+ _cputype=armv7
+ if [ "$_ostype" = "linux-android" ]; then
+ _ostype=linux-androideabi
+ else
+ _ostype="${_ostype}eabihf"
+ fi
+ ;;
+ riscv64gc)
+ err "riscv64 with 32-bit userland unsupported"
+ exit 1
+ ;;
+ esac
+ fi
+
+ # Detect armv7 but without the CPU features Rust needs in that build,
+ # and fall back to arm.
+ # See https://github.com/rust-lang/rustup.rs/issues/587.
+ if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7 ]; then
+ if ! (ensure grep '^Features' /proc/cpuinfo | grep -E -q 'neon|simd'); then
+ # Either `/proc/cpuinfo` is malformed or unavailable, or
+ # at least one processor does not have NEON (which is asimd on armv8+).
+ _cputype=arm
+ fi
+ fi
+
+ _arch="${_cputype}-${_ostype}"
+
+ export RETVAL="$_arch"
+ }
+
+}
+
+# shellcheck disable=SC2153
+test -n "$FISH_VERSION" && echo "You appear to be running fish, please use install.fish instead of install.sh!" && exit 1
+# the above is kind of cursed, but I can't use if statements because fish likes to be different
+
+START_DIR="$(pwd)"
+cd "$(dirname "$0")"
+
+set -euo pipefail
+
+# shellcheck shell=bash
+if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then
+ HAS_TRAPS=0
+ # shellcheck disable=SC3045
+ if ! type -a "trap" 2>/dev/null | grep -E '\' >/dev/null; then
+ HAS_TRAPS=1
+ fi
+fi
+
+workdir=$(
+ echo 'mkstemp(template)' |
+ m4 -D template="${TMPDIR:-/tmp}/rust_pkg_gen_installerXXXXXX"
+) || exit
+
+cleanup() {
+ cd "$START_DIR"
+ if [ -n "$workdir" ]; then
+ return
+ fi
+ rm -rf "$workdir"
+}
+if [ "$HAS_TRAPS" = "1" ]; then
+ trap SIGINT cleanup
+ trap SIGKILL cleanup
+fi
+
+PARENT_DIR=$(
+ cd dirname "$0"
+ pwd
+)
+
+COMPONENTS="${COMPONENTS:-&?TOOLCHAIN.COMPONENTS}"
+CHANNEL="${CHANNEL:-&?TOOLCHAIN.CHANNEL}"
+FORMAT="${FORMAT:-.tar.gz}"
+TAR_FLAGS="${TAR_FLAGS:-"-xf"}"
+
+USING_PKG="${USING_PKG:-&?TOOLCHAIN.PKG}"
+
+if ! command -v tar >/dev/null 2>&1; then
+ echo "Tar is not installed, cannot unpack archives!"
+ cleanup
+ exit 1
+fi
+
+if [ "$FORMAT" = ".tar.gz" ]; then
+ if ! tar --help | grep gzip >/dev/null 2>&1; then
+ if ! tar --help | grep xz >/dev/null 2>&1; then
+ echo "Tar does not support gzip or xz, cannot unpack archives!"
+ cleanup
+ exit 1
+ fi
+ echo "Tar supports xz but not gzip, switching format to .tar.xz from .tar.gz!"
+ FORMAT=".tar.xz"
+ fi
+fi
+
+if [ "$FORMAT" = ".tar.xz" ]; then
+ tar --help | grep xz >/dev/null 2>&1
+ if ! tar --help | grep xz >/dev/null 2>&1; then
+ if ! tar --help | grep gzip >/dev/null 2>&1; then
+ echo "Tar does not support gzip or xz, cannot unpack archives!"
+ cleanup
+ exit 1
+ fi
+ echo "Tar supports gzip but not xz, switching format to .tar.gz from .tar.xz!"
+ FORMAT=".tar.gz"
+ fi
+fi
+
+if [ "$FORMAT" = ".tar.gz" ]; then
+ TAR_FLAGS="--gzip $TAR_FLAGS"
+fi
+
+if [ "$FORMAT" = ".tar.xz" ]; then
+ TAR_FLAGS="--xz $TAR_FLAGS"
+fi
+
+target_triple=$(get_architecture)
+
+if [ "$_cputype" = "apple-darwin" ] && [ -n "$USING_PKG" ]; then
+ installer -pkg "$PARENT_DIR/toolchain/rust-$CHANNEL-$target_triple.pkg" -target CurrentUserHomeDirectory
+fi
+
+cd "$workdir"
+for comp in $COMPONENTS; do
+ if [ ! -e "$PARENT_DIR/toolchain/$comp-$CHANNEL-$target_triple.$FORMAT" ]; then
+ if [ -n "$IGNORE_NONEXISTANT_COMPONENTS" ]; then
+ continue
+ fi
+ echo "Expected file $PARENT_DIR/toolchain/$comp-$CHANNEL-$target_triple.$FORMAT to exist, but doesn't!"
+ echo "(hint: to ignore and continue, set the environment variable IGNORE_NONEXISTANT_COMPONENTS to 1)"
+ cleanup
+ exit 1
+ fi
+ if [ -z "$DONT_HASH" ]; then
+ if [ ! -e "$PARENT_DIR/toolchain/$comp-$CHANNEL-$target_triple.$FORMAT.sha256" ]; then
+ echo "Expected file $PARENT_DIR/toolchain/$comp-$CHANNEL-$target_triple.$FORMAT.sha256 to exist, but doesn't!"
+ echo "(hint: to disable this warning, set the environment variable DONT_HASH to 1)"
+ cleanup
+ exit 1
+ fi
+ HASH1=$(openssl dgst -sha256 -hex "$PARENT_DIR/toolchain/$comp-$CHANNEL-$target_triple.$FORMAT" | awk '{print $2}')
+ HASH2=$(cat "$PARENT_DIR/toolchain/$comp-$CHANNEL-$target_triple.$FORMAT.sha256")
+ if [ "$HASH1" != "$HASH2" ]; then
+ echo "Error: Hash of $PARENT_DIR/toolchain/$comp-$CHANNEL-$target_triple.$FORMAT does not match expected hash!"
+ echo "(hint: to disable this warning, set the environment variable DONT_HASH to 1)"
+ cleanup
+ exit 1
+ fi
+ echo "Tested - hash and expected hash of $comp-$CHANNEL-$target_triple.$FORMAT match($HASH1)!"
+ fi
+ mkdir "$comp-$CHANNEL-$target_triple"
+ cd "$comp-$CHANNEL-$target_triple"
+ # shellcheck disable=SC2086
+ tar $TAR_FLAGS "$PARENT_DIR/toolchain/$comp-$CHANNEL-$target_triple.$FORMAT"
+ cd "$comp-$CHANNEL-$target_triple"
+ chmod u+x install.sh
+ if [ ! -x "install.sh" ]; then
+ echo "Cannot execute $(pwd)/install.sh (likely because of mounting /tmp as noexec)."
+ echo "Set \$TMPDIR to a path that you can execute files in and rerun this script."
+ echo "Note that this will create a temporary directory inside this path and delete it at the end of the script."
+ cleanup
+ exit 1
+ fi
+ ./install.sh
+done
+
+cleanup
diff --git a/src/main.rs b/src/main.rs
index 96e4f26..76797c8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -6,11 +6,11 @@
use clap::Parser;
use log::*;
use rand::{Rng, SeedableRng};
-use rust_pkg_gen::resources::TemplateAssets;
+use rust_pkg_gen::resources::{InstallAssets, TemplateAssets};
use std::{
fs::{self, write},
- path::PathBuf,
- process::Stdio,
+ path::{Path, PathBuf},
+ process::{self, Stdio},
};
fn gen_char() -> u8 {
@@ -65,6 +65,35 @@ struct Cli {
help = "Saves all temporary files"
)]
save_temp: bool,
+ #[arg(
+ long = "no-download-toolchain",
+ default_value_t = false,
+ help = "Disable downloading the toolchain for major speed ups"
+ )]
+ no_download_toolchain: bool,
+}
+
+fn move_files_in_directory(src_dir: &str, dest_dir: &str) -> std::io::Result<()> {
+ if !Path::new(dest_dir).exists() {
+ fs::create_dir_all(dest_dir)?;
+ }
+
+ let entries = fs::read_dir(src_dir)?;
+
+ for entry in entries {
+ let entry = entry?;
+ let entry_path = entry.path();
+
+ if entry_path.is_dir() {
+ continue;
+ }
+
+ let dest_path = Path::new(dest_dir).join(entry_path.file_name().unwrap());
+
+ fs::rename(entry_path, dest_path)?;
+ }
+
+ Ok(())
}
fn generate_crates(
@@ -193,25 +222,132 @@ fn main() {
)
.unwrap();
- rust_pkg_gen::copied::download_all(
- vec![&toolchain.channel],
- rust_pkg_gen::copied::DEFAULT_UPSTREAM_URL,
- dir.join("tmp").to_str().unwrap(),
- toolchain.targets.iter().map(|s| &**s).collect(),
- dir.join("toolchain").to_str().unwrap(),
- toolchain.components.iter().map(|s| &**s).collect(),
- toolchain.platforms.iter().map(|s| &**s).collect(),
- args.quiet,
- toolchain
- .format_map
- .iter()
- .map(|(k, v)| (k.as_str(), cfg.formats[v].clone()))
- .collect(),
- );
+ if !args.no_download_toolchain {
+ if let Some(err) = rust_pkg_gen::copied::download_all(
+ vec![&toolchain.channel],
+ rust_pkg_gen::copied::DEFAULT_UPSTREAM_URL,
+ dir.join("tmp").to_str().unwrap(),
+ toolchain.targets.iter().map(|s| &**s).collect(),
+ dir.join("toolchain").to_str().unwrap(),
+ toolchain.components.iter().map(|s| &**s).collect(),
+ toolchain.platforms.iter().map(|s| &**s).collect(),
+ args.quiet,
+ toolchain
+ .format_map
+ .iter()
+ .map(|(k, v)| (k.as_str(), cfg.formats[v].clone()))
+ .collect(),
+ ) {
+ error!("{}", err);
+ process::exit(1);
+ };
+ }
- if !args.save_temp {
+ if !args.save_temp && !args.no_download_toolchain {
fs::remove_dir_all(dir.join("tmp").to_str().unwrap()).unwrap();
}
+
+ if !args.no_download_toolchain {
+ let dist_data_path = dir
+ .join("toolchain")
+ .join(format!("dist/channel-rust-{}.toml", toolchain.channel));
+ let data = fs::read_to_string(dist_data_path.to_str().unwrap()).unwrap();
+
+ let dist_data = data.parse::().unwrap();
+ let dist_dir_name = dist_data["date"].as_str().unwrap();
+
+ move_files_in_directory(
+ dir.join("toolchain")
+ .join("dist")
+ .join(dist_dir_name)
+ .to_str()
+ .unwrap(),
+ dir.join("toolchain").to_str().unwrap(),
+ )
+ .unwrap();
+
+ if !args.save_temp {
+ fs::remove_dir_all(dir.join("toolchain").join("dist").to_str().unwrap())
+ .unwrap();
+ fs::remove_file(
+ dir.join("toolchain")
+ .join(format!("channel-rust-{}.toml", toolchain.channel)),
+ )
+ .unwrap();
+ fs::remove_file(
+ dir.join("toolchain")
+ .join(format!("channel-rust-{}.toml.sha256", toolchain.channel)),
+ )
+ .unwrap();
+ }
+ }
+
+ for ele in InstallAssets::iter() {
+ let file = InstallAssets::get(&ele).unwrap();
+
+ let ele = std::borrow::Cow::Borrowed(ele.split_once("/").unwrap().1);
+
+ let path = dir.join(PathBuf::from(ele.as_ref()));
+ let prefix = path.parent().unwrap();
+ std::fs::create_dir_all(prefix).unwrap();
+
+ let str_data = std::str::from_utf8(file.data.as_ref());
+
+ if str_data.is_ok() {
+ std::fs::write(
+ path,
+ str_data
+ .unwrap()
+ .replace("&?TOOLCHAIN.CHANNEL", &toolchain.channel)
+ .replace("&?TOOLCHAIN.COMPONENTS", &toolchain.components.join(" "))
+ .replace(
+ "&?TOOLCHAIN.PKG",
+ if toolchain
+ .format_map
+ .iter()
+ .map(|(_, v)| {
+ cfg.formats[v]
+ .iter()
+ .map(|v| v.format.clone())
+ .collect::>()
+ .contains(&"pkg".to_string())
+ })
+ .collect::>()
+ .iter()
+ .any(|v| *v)
+ {
+ "$true"
+ } else {
+ "$false"
+ },
+ )
+ .replace(
+ "&?TOOLCHAIN.MSI",
+ if toolchain
+ .format_map
+ .iter()
+ .map(|(_, v)| {
+ cfg.formats[v]
+ .iter()
+ .map(|v| v.format.clone())
+ .collect::>()
+ .contains(&"msi".to_string())
+ })
+ .collect::>()
+ .iter()
+ .any(|v| *v)
+ {
+ "$true"
+ } else {
+ "$false"
+ },
+ ),
+ )
+ .unwrap();
+ } else {
+ std::fs::write(path, file.data).unwrap();
+ }
+ }
}
}
}
diff --git a/src/resources.rs b/src/resources.rs
index 18e7816..30f4980 100644
--- a/src/resources.rs
+++ b/src/resources.rs
@@ -8,9 +8,16 @@ use rust_embed::Embed;
/// The template assets outputted to {temp_dir}/{target}/crates.
///
/// If viewing after running, it will be the output of [`cargo-local-registry`](https://crates.io/crates/cargo-local-registry/0.2.7)
-/// (build alongside this crate in an incredibly janky way)
+/// (built alongside this crate in an incredibly janky way)
pub struct TemplateAssets;
+#[derive(Embed)]
+#[folder = "src/install/"]
+#[prefix = "install/"]
+/// The install assets outputted to {temp_dir}/{target}
+/// Contains (as of writing this) install.sh, install.ps1, and install.fish
+pub struct InstallAssets;
+
/// The README file automatically placed into {temp_dir}/{target}/crates
/// after [`cargo-local-registry`](https://crates.io/crates/cargo-local-registry/0.2.7) runs.
pub const CRATES_README: &str = include_str!("crates_README.md");