Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anydesk arm64 #2455

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 38 additions & 15 deletions api
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,19 @@ package_installed() { #exit 0 if $1 package is installed, otherwise exit 1
grep "^Package: $package$" /var/lib/dpkg/status -A 1 | tail -n 1 | grep -q 'Status: install ok installed'
}

package_available() { #determine if the specified package-name exists in a repository
local package="$1"
package_available() { #determine if the specified package-name exists in a local repository for the current dpkg architecture
local package="$(awk -F: '{print $1}' <<<"$1")"
local dpkg_arch="$(awk -F: '{print $2}' <<<"$2")"
[ -z "$dpkg_arch" ] && dpkg_arch="$(dpkg --print-architecture)"
[ -z "$package" ] && error "package_available(): no package name specified!"
#using find and grep to do this is nearly instantaneous, rather than apt-cache which takes several seconds
local IFS=$'\n'
for file in $(find /var/lib/apt/lists -maxdepth 1 -type f -name "*_Packages") ;do
grep -q "^Package: $package$" "$file" && break
done
local output="$(apt-cache policy "$package":"$dpkg_arch" | grep "Candidate:")"
if [ -z "$output" ]; then
return 1
elif echo "$output" | grep -q "Candidate: (none)"; then
return 1
else
return 0
fi
}

package_dependencies() { #outputs the list of dependencies for the $1 package
Expand Down Expand Up @@ -401,11 +406,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 +443,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
45 changes: 45 additions & 0 deletions apps/AnyDesk/install-64
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

version=6.3.0-1

function check-armhf() {
ARMHF="$(dpkg --print-foreign-architectures | grep "armhf")"
}

#add armhf architecture (multiarch)
check-armhf
if [[ "$ARMHF" == *"armhf"* ]]; then
echo "armhf architecture already added..."
else
sudo dpkg --add-architecture armhf
check-armhf
if [[ "$ARMHF" != *"armhf"* ]]; then
error "armhf architecture should be added by now, but it isn't!"
fi
fi

unset rpi_arm_userspace

if ! package_available libraspberrypi0:armhf ; then
error "AnyDesk needs some system libraries specific to the Raspberry Pi, but on your system the libraspberrypi0:armhf package does not seem to be available."
fi

install_packages https://download.anydesk.com/rpi/anydesk_${version}_armhf.deb libgles2:armhf libegl1:armhf libpolkit-gobject-1-0:armhf libraspberrypi0:armh patchelf || exit 1

#make anydesk search armhf libs first
sudo patchelf --set-rpath /usr/lib/arm-linux-gnueabihf /usr/bin/anydesk

#libraspberrypi0:armhf provides libs with so.0, but anydesk wants libs that end in .so
#fix it

sudo patchelf --replace-needed libbcm_host.so libbcm_host.so.0 /usr/bin/anydesk
sudo patchelf --replace-needed libvcos.so libvcos.so.0 /usr/bin/anydesk
sudo patchelf --replace-needed libvchiq_arm.so libvchiq_arm.so.0 /usr/bin/anydesk

#use gl libraries from lib deps to avoid needing to install -dev variants
sudo patchelf --replace-needed libGLESv2.so libGLESv2.so.2 /usr/bin/anydesk
sudo patchelf --replace-needed libEGL.so libEGL.so.1 /usr/bin/anydesk

# Solve error: "anydesk: error while loading shared libraries: libbrcmGLESv2.so: cannot open shared object file: No such file or directory"
sudo patchelf --replace-needed libbrcmGLESv2.so libGLESv2.so /usr/bin/anydesk
sudo patchelf --replace-needed libbrcmEGL.so libEGL.so /usr/bin/anydesk
5 changes: 5 additions & 0 deletions apps/AnyDesk/uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

purge_packages || exit 1

if [ "$arch" == 64 ];then
# remove armhf architecture if no packages from it are currently installed
apt list --installed | awk '$3 == "armhf" { print }' | grep -q installed || sudo dpkg --remove-architecture armhf
fi

#remove symlinked libraries
if [ -L /usr/lib/libbrcmGLESv2.so ];then
sudo rm -f /usr/lib/libbrcmGLESv2.so
Expand Down
Loading