Good day, dear participants. Help implement a bash script that should work in ubuntu. There was a similar question , but not quite what was needed. I would also like to find out if the package is installed and if installed, also find out the version installed and check this version from that available on the site, if the versions are the same, display a message in the zenity dialog >> that you have the latest version installed .. OK If the site has The new version is displayed in the dialog zenity >> that there is a new version of V / value.
1 answer
Here is a simple example that displays the version of the installed package and the version in the repository. In the absence of a package - the void:
#!/bin/sh if [ -z "$1" ]; then echo "\nUsage: $0 package_name" exit 2 fi apt-cache policy "$1" | \ tr -d '\n' | \ awk -F' ' \ '{printf("%s\n\tcurrent version: %s\n\trepo version: %s\n", $1, $3, $5);}' from third-party sites to download available releases from the page
The short answer is: fail.
A long:
You will have to manually sort through thousands of packages (even if you limit yourself to those that already stand), and for each:
- Find out if he has a separate site.
- Is it possible on this site to download the finished package for a direct link.
- For each site, write a separate parser, tearing out version information and a link.
Even if this work is done (and this is not a couple dozen man-hours), you will cover only a small part of the packages.
- Thanks for the answer, you need to repository to the account not from the repository but for example from third-party sites to download available releases from the page, for example via wget -O- https: //...../releases | grep -o '[0-9] \. [0-9] \. [0-9]' | uniq> releases and then from the file releases to compare with the installed version, since there is no sense in the repositories, in this script, all notifications through the repository and so through the manager are available, which is why you came to the idea of implementing this idea, are there options? thanks again for your answer, sorry no points to note the answer is useful. - zorin
- After a little reflection, I decided to describe in detail, in general, if this script is implemented, then it can be done as a template, for example, I install the package not from the repository, from some project I want to keep track of new releases, when the new version appears, the script tells us The new version continues to install it, so I think you can refuse the messages that "you have the latest version installed", if so the script does not output anything and stops working, if there is a new version, only then displays the dialog through zenity with the proposal about the installation. - zorin
- See the answer update. - PinkTux
|
dpkg -s ...). And what is " to verify this version with available on the site "? On which website? - PinkTuxapt-cache policy один_пакет,apt-cache policy второй_пакет,apt-cache policy третий_пакет... Or even like this:apt-cache policy один_пакет второй_пакет третий_пакет. How to pull versions from output? - PinkTux