Skip to content

Commit

Permalink
Allow installing local packages of foreign architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
Botspot authored Oct 5, 2023
1 parent 8e7c30a commit 4888a20
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions api
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,20 @@ install_packages() { #Make some packages dependencies of the $app app. Package-n

[ -f "$package" ] || error "install_packages(): Local package does not exist! ($package)"

#determine the package name from the filename
packagename="$(dpkg-deb -I "$package" | grep "^ Package:" | awk '{print $2}')"
packageversion="$(dpkg-deb -I "$package" | grep "^ Version:" | awk '{print $2}')"
[ -z "$packagename" ] && error "install_packages(): failed to determine a package-name for the file '$package'"
[ -z "$packageversion" ] && error "install_packages(): failed to determine a package-version for the file '$package'"
#determine the package name, package version, and architecture from the file
local dpkg_deb_output="$(dpkg-deb -I "$filename")"
local packagename="$(echo "$dpkg_deb_output" | grep "^ Package:" | awk '{print $2}')"
local packageversion="$(echo "$dpkg_deb_output" | grep "^ Version:" | awk '{print $2}')"
local packagearch="$(echo "$dpkg_deb_output" | grep "^ Architecture:" | awk '{print $2}')"
[ -z "$packagename" ] && error "install_packages(): failed to determine a package-name for the file '$filename'"
[ -z "$packageversion" ] && error "install_packages(): failed to determine a package-version for the file '$filename'"
[ -z "$packagearch" ] && error "install_packages(): failed to determine a package-architecture for the file '$filename'"
unset dpkg_deb_output

#foreign arch: add :armhf or :arm64 to the packagename if this local package is of a foreign architecture
if [ "$packagearch" != "$(dpkg --print-architecture)" ];then
packagename+=":$packagearch"
fi

#add this local package to the pi-apps-local-packages repository
repo_add "$package" || return 1
Expand All @@ -429,11 +438,20 @@ install_packages() { #Make some packages dependencies of the $app app. Package-n

wget -O "$filename" "$package" || return 1

#determine the package name from the filename
packagename="$(dpkg-deb -I "$filename" | grep "^ Package:" | awk '{print $2}')"
packageversion="$(dpkg-deb -I "$filename" | grep "^ Version:" | awk '{print $2}')"
#determine the package name, package version, and architecture from the file
local dpkg_deb_output="$(dpkg-deb -I "$filename")"
local packagename="$(echo "$dpkg_deb_output" | grep "^ Package:" | awk '{print $2}')"
local packageversion="$(echo "$dpkg_deb_output" | grep "^ Version:" | awk '{print $2}')"
local packagearch="$(echo "$dpkg_deb_output" | grep "^ Architecture:" | awk '{print $2}')"
[ -z "$packagename" ] && error "install_packages(): failed to determine a package-name for the file '$filename'"
[ -z "$packageversion" ] && error "install_packages(): failed to determine a package-version for the file '$filename'"
[ -z "$packagearch" ] && error "install_packages(): failed to determine a package-architecture for the file '$filename'"
unset dpkg_deb_output

#foreign arch: add :armhf or :arm64 to the packagename if this local package is of a foreign architecture
if [ "$packagearch" != "$(dpkg --print-architecture)" ];then
packagename+=":$packagearch"
fi

#add this local package to the pi-apps-local-packages repository
repo_add "$filename" || return 1
Expand Down

0 comments on commit 4888a20

Please sign in to comment.