Also compare version in Debian's repo
This commit is contained in:
parent
fa6fe80e27
commit
6ecb7419be
|
@ -3,12 +3,16 @@
|
||||||
## Create a temp file (to monitor) if an upgrade is available for FusionInventory-Agent
|
## Create a temp file (to monitor) if an upgrade is available for FusionInventory-Agent
|
||||||
## project on Github.
|
## project on Github.
|
||||||
## It's based on .deb package installation to check the current version.
|
## It's based on .deb package installation to check the current version.
|
||||||
|
## It can also compare the current available version in a debian repository
|
||||||
|
## if "repo" is given as first argument.
|
||||||
## How-to use {{{
|
## How-to use {{{
|
||||||
### 1. Needs releasetags script, in the same directory
|
### 1. Needs releasetags script, in the same directory
|
||||||
### cf. https://git.ipr.univ-rennes1.fr/cellinfo/scripts/src/master/github/releasetags
|
### cf. https://git.ipr.univ-rennes1.fr/cellinfo/scripts/src/master/github/releasetags
|
||||||
# wget https://git.ipr.univ-rennes1.fr/cellinfo/scripts/raw/master/github/releasetags
|
# wget https://git.ipr.univ-rennes1.fr/cellinfo/scripts/raw/master/github/releasetags
|
||||||
### 2. Create a cron job, eg :
|
### 2. Create a cron job, eg :
|
||||||
#00 20 * * * root /opt/repos/ipr.scripts/github/check.fusioninventory-agent.update
|
#00 20 * * * root /opt/repos/ipr.scripts/github/check.fusioninventory-agent.update
|
||||||
|
### 2-1 Create a cron job to compare the version available in a Debian repository :
|
||||||
|
#00 20 * * * root /opt/repos/ipr.scripts/github/check.fusioninventory-agent.update repo
|
||||||
### 3. Monitor the temp file : /tmp/.github.fusioninventory-agent.upgrade
|
### 3. Monitor the temp file : /tmp/.github.fusioninventory-agent.upgrade
|
||||||
# Or enable MAILTO in cronjob and edit the script to print a message.
|
# Or enable MAILTO in cronjob and edit the script to print a message.
|
||||||
# Or send a mail.
|
# Or send a mail.
|
||||||
|
@ -16,8 +20,8 @@
|
||||||
## }}}
|
## }}}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# Expect no argument {{{
|
# Expect maximum 1 argument {{{
|
||||||
if [ $# -gt 0 ]
|
if [ $# -gt 1 ]
|
||||||
then
|
then
|
||||||
cat << HELP
|
cat << HELP
|
||||||
|
|
||||||
|
@ -28,6 +32,9 @@ EXAMPLE :
|
||||||
- Compare the current version installed from .deb file
|
- Compare the current version installed from .deb file
|
||||||
check.fusioninventory-agent.update
|
check.fusioninventory-agent.update
|
||||||
|
|
||||||
|
- Compare the current version in Debian's repository
|
||||||
|
check.fusioninventory-agent.update repo
|
||||||
|
|
||||||
HELP
|
HELP
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -41,7 +48,12 @@ script_wd=$(dirname "${0}")
|
||||||
|
|
||||||
fi_repo_url="https://github.com/fusioninventory/fusioninventory-agent"
|
fi_repo_url="https://github.com/fusioninventory/fusioninventory-agent"
|
||||||
|
|
||||||
fi_current_version=$(dpkg -l fusioninventory-agent | awk '/^ii.*fusioninventory-agent/ {print $3}' | sed 's/.:\(.*\)-.*/\1/')
|
if [ $# -eq 1 ] && [ "${1}" = "repo" ] ## If repository's version should be compared
|
||||||
|
then
|
||||||
|
fi_current_version=$(apt-cache policy fusioninventory-agent | awk '/Candidate:/ {print $2}' | sed 's/.:\(.*\)-.*/\1/')
|
||||||
|
else
|
||||||
|
fi_current_version=$(dpkg -l fusioninventory-agent | awk '/^ii.*fusioninventory-agent/ {print $3}' | sed 's/.:\(.*\)-.*/\1/')
|
||||||
|
fi
|
||||||
|
|
||||||
fi_new_version=$("${script_wd}"/releasetags "${fi_repo_url}" | head -n1 | sed 's/v//g')
|
fi_new_version=$("${script_wd}"/releasetags "${fi_repo_url}" | head -n1 | sed 's/v//g')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue