Score:1

How to always get the latest version of Bleachbit with wget in bash?

tr flag

To get latest version of BleachBit (for Ubuntu 20.04) we can use the following commands:

wget -c https://download.bleachbit.org/bleachbit_4.4.0-0_all_ubuntu2004.deb -O bleachbit.deb
dpkg -i bleachbit.deb

If we install it from the official Ubuntu repository (with apt-get bleachbit), an older version is installed, which contains installation errors. And according to the creators of this tool:

Ubuntu has a "no rolling release" policy, so the Ubuntu repository will not update with the recent versions

Since this tool is regularly updated, I would like to always download the latest version. So I did this bash, but it doesn't work:

lastbleachbit=$(wget -O - https://www.bleachbit.org/download/ | grep -Po '/download/file/([^"]+)' | grep ubuntu2004 | sort -u)
wget -c https://www.bleachbit.org"$lastbleachbit" -O bleachbit.deb
dpkg -i bleachbit.deb

Output variable:

lastmintstick=$(wget -O - http://packages.linuxmint.com/pool/main/m/mintstick/ | grep -Po 'href=".*?"' | sed -r 's:href\="(.*)":\1:' | grep ".deb" | sort | tail -1)
--2021-11-10 10:24:50--  http://packages.linuxmint.com/pool/main/m/mintstick/
Resolviendo packages.linuxmint.com (packages.linuxmint.com)... 208.77.20.11, 68.235.39.11
Conectando con packages.linuxmint.com (packages.linuxmint.com)[208.77.20.11]:80... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: 10112 (9,9K) [text/html]
Guardando como: “STDOUT”

-                   100%[===================>]   9,88K  --.-KB/s    en 0s      
2021-11-10 10:24:51 (191 MB/s) - escritos a stdout [10112/10112]

Output command:

wget -c https://www.bleachbit.org"$lastbleachbit"
--2021-11-10 10:26:39--  https://www.bleachbit.org/
Resolviendo www.bleachbit.org (www.bleachbit.org)... 172.67.129.101, 104.21.1.137, 2606:4700:3030::ac43:8165, ...
Conectando con www.bleachbit.org (www.bleachbit.org)[172.67.129.101]:443... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: no especificado [text/html]
Guardando como: “index.html”

index.html              [ <=>                ]  10,93K  --.-KB/s    en 0,002s  

2021-11-10 10:26:40 (4,38 MB/s) - “index.html” guardado [11193]

What did I do wrong?

ar flag
Does this answer your question? [Why don't the Ubuntu repositories have the latest versions of software?](https://askubuntu.com/questions/151283/why-dont-the-ubuntu-repositories-have-the-latest-versions-of-software)
acgbox avatar
tr flag
@user68186 No. according to the creators of this tool: Ubuntu has a "no rolling release" policy https://github.com/bleachbit/bleachbit/issues/1277#issuecomment-932959861
muru avatar
us flag
Have you checked what the contents of the `lastbleachbit` variable are?
acgbox avatar
tr flag
@muru update question with output
Score:2
sd flag

You're missing /linux.

$ lastbleachbit=$(wget --quiet -O - https://www.bleachbit.org/download/linux | grep -Po '/download/file/([^"]+)' | grep ubuntu2004 | sort -u)
$ echo $lastbleachbit 
/download/file/t?file=bleachbit_4.4.0-0_all_ubuntu2004.deb

With my limited grep knowledge, I managed to get it working.

$ lastbleachbit=$(wget --quiet -O - https://www.bleachbit.org/download/linux | grep -Po '(?<=file=).*(?=">)' | grep ubuntu2004 | sort -u)
$ echo $lastbleachbit 
bleachbit_4.4.0-0_all_ubuntu2004.deb

When you download it.

$ wget "https://download.bleachbit.org/${lastbleachbit}"
--2021-11-10 16:01:10--  https://download.bleachbit.org/bleachbit_4.4.0-0_all_ubuntu2004.deb
Resolving download.bleachbit.org (download.bleachbit.org)... 172.67.129.101, 104.21.1.137, 2606:4700:3035::6815:189, ...
Connecting to download.bleachbit.org (download.bleachbit.org)|172.67.129.101|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 441432 (431K) [application/x-deb]
Saving to: ‘bleachbit_4.4.0-0_all_ubuntu2004.deb’

bleachbit_4.4.0-0_all_ubuntu2004. 100%[===========================================================>] 431.09K  2.02MB/s    in 0.2s    

2021-11-10 16:01:11 (2.02 MB/s) - ‘bleachbit_4.4.0-0_all_ubuntu2004.deb’ saved [441432/441432]

I think this should work as long the download page keep embedding link containing .deb file, though I don't know for how long as I never use bleachbit.

acgbox avatar
tr flag
super great. thanks
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.