Skip to content

Commit 9833157

Browse files
CopilotSteveL-MSFT
andcommitted
Add support for 'current' architecture in RPM and DEB packaging
Co-authored-by: SteveL-MSFT <[email protected]>
1 parent 03a0eb0 commit 9833157

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

build.ps1

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,17 @@ if ($packageType -eq 'msixbundle') {
902902
}
903903

904904
# Determine RPM architecture
905-
$rpmArch = if ($architecture -eq 'aarch64-unknown-linux-musl' -or $architecture -eq 'aarch64-unknown-linux-gnu') {
905+
$rpmArch = if ($architecture -eq 'current') {
906+
# Detect current system architecture
907+
$currentArch = uname -m
908+
if ($currentArch -eq 'x86_64') {
909+
'x86_64'
910+
} elseif ($currentArch -eq 'aarch64') {
911+
'aarch64'
912+
} else {
913+
throw "Unsupported current architecture for RPM: $currentArch"
914+
}
915+
} elseif ($architecture -eq 'aarch64-unknown-linux-musl' -or $architecture -eq 'aarch64-unknown-linux-gnu') {
906916
'aarch64'
907917
} elseif ($architecture -eq 'x86_64-unknown-linux-musl' -or $architecture -eq 'x86_64-unknown-linux-gnu') {
908918
'x86_64'
@@ -977,7 +987,17 @@ if ($packageType -eq 'msixbundle') {
977987
New-Item -ItemType SymbolicLink -Path $symlinkPath -Target '/opt/dsc/dsc' -Force > $null
978988

979989
# Determine DEB architecture
980-
$debArch = if ($architecture -eq 'aarch64-unknown-linux-musl' -or $architecture -eq 'aarch64-unknown-linux-gnu') {
990+
$debArch = if ($architecture -eq 'current') {
991+
# Detect current system architecture
992+
$currentArch = uname -m
993+
if ($currentArch -eq 'x86_64') {
994+
'amd64'
995+
} elseif ($currentArch -eq 'aarch64') {
996+
'arm64'
997+
} else {
998+
throw "Unsupported current architecture for DEB: $currentArch"
999+
}
1000+
} elseif ($architecture -eq 'aarch64-unknown-linux-musl' -or $architecture -eq 'aarch64-unknown-linux-gnu') {
9811001
'arm64'
9821002
} elseif ($architecture -eq 'x86_64-unknown-linux-musl' -or $architecture -eq 'x86_64-unknown-linux-gnu') {
9831003
'amd64'

0 commit comments

Comments
 (0)