Score:0

Anydesk installation by bash script using wget

bj flag

I'm trying to write a bash script for automating the installation of anydesk by wget with the help of th following code:

echo -e "[ - ] Installing AnyDesk..."
wget --max-redirect 1 --trust-server-names 'https://anydesk.com/en/downloads/thank-you?dv=deb_64' -O anydesk.deb
sudo apt install ./anydesk.deb
echo -e "[ ✔ ] AnyDesk ➜ INSTALLED\n"

I know the error is in wget command but I don't know how to correct it. and that's why I'm unale to download the exact latest and stable anyesk*.deb file.

kindly help me by correcting the wget command

Output of the current code is:

[ - ] Installing AnyDesk...
--2022-12-15 20:01:35--  https://anydesk.com/en/downloads/thank-you?dv=deb_64
Resolving anydesk.com (anydesk.com)... 18.161.69.37, 18.161.69.66, 18.161.69.96, ...
Connecting to anydesk.com (anydesk.com)|18.161.69.37|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘anydesk.deb’

anydesk.deb             [  <=>               ]  62.18K  88.5KB/s    in 0.7s    

2022-12-15 20:01:36 (88.5 KB/s) - ‘anydesk.deb’ saved [63675]

[ ✔ ] AnyDesk ➜ INSTALLED

An html file is downloading instead of anydesk's deb file.

Alejandro avatar
mz flag
Can you please post the output of running the line containing wget?
Muhammad Habib avatar
bj flag
@Alejandro, I edit the question and include the output
Score:1
om flag

You don't give wget the correct URL. You feed it with the URL to a HTML page.

The correct download URL for your deb package is https://download.anydesk.com/linux/anydesk_6.2.1-1_amd64.deb, but this will change - so you probably want a more complex script to determine URL from the page you see and download the latest version.


That said, this is the wrong approach. The Correct Approach is to use their apt repository.

Alejandro avatar
mz flag
Another problem I faced on a busybox docker container is that wget wasn't updated, so many flags were missing from available options. The URL is the main problem, but please check that wget is on the latest release.-
vidarlo avatar
om flag
@Alejandro huh? There's nothing in the question to indicate that this is the problem.
Muhammad Habib avatar
bj flag
Bro, I know the correct URL and I also know the correct URL will change when new version of anydesk will arrive that's why I give it the said link. actually I want wget to resolve the current latest address itself like other browsers are resolving. Thanks
vidarlo avatar
om flag
Wget doesn't really HTML or execute javascript. You have to do that manually. But my updated edit is really the answer you're looking for...
Muhammad Habib avatar
bj flag
@vidarlo are you familiar with apt-key add key[8] error. this legcy method has ben depricated since 22.04 LTS, see the DEPRECATION section in apt-key(8) for details, that's why I'm trying with wget. I only don't know how to redirect with wget to resolve the actual link. any help in this regard. thanks for helping
Muhammad Habib avatar
bj flag
The question is not about adding an entry in repository, it is about how to resolve the redirected link by WGET. I'm just trying to explain the question. English is not my native language so sorry if I choose wrong or hard words
vidarlo avatar
om flag
I think the general answer will be rather long winded. [For instance this answer](https://stackoverflow.com/a/54885490/11529761) to a question on SO gives an idea about how you can parse HTML. In addition, you will probably have to learn some more shell scripting, including control functions (if/else etc.), and variable assignment.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.