mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-20 21:34:11 -07:00
dpkg-query support
This commit is contained in:
parent
82a746959e
commit
4c4433916c
1 changed files with 43 additions and 15 deletions
|
@ -29,16 +29,24 @@ tmp_file=$(mktemp)
|
||||||
# Check latest version
|
# Check latest version
|
||||||
wget -q -T 1 -t 1 http://c.vestacp.com/latest.txt -O $tmp_file
|
wget -q -T 1 -t 1 http://c.vestacp.com/latest.txt -O $tmp_file
|
||||||
|
|
||||||
# Define rpm query format
|
|
||||||
rpm_format="VERSION='%{VERSION}'"
|
|
||||||
rpm_format="$rpm_format RELEASE='%{RELEASE}'"
|
|
||||||
rpm_format="$rpm_format ARCH='%{ARCH}'"
|
|
||||||
rpm_format="$rpm_format UTIME='%{INSTALLTIME}'\n"
|
|
||||||
|
|
||||||
# Check vesta version
|
# Check vesta version
|
||||||
eval $(rpm --queryformat="$rpm_format" -q vesta)
|
if [ -e "/etc/redhat-release" ]; then
|
||||||
DATE=$(date -d @$UTIME +%F)
|
rpm_format="VERSION='%{VERSION}'"
|
||||||
TIME=$(date -d @$UTIME +%T)
|
rpm_format="$rpm_format RELEASE='%{RELEASE}'"
|
||||||
|
rpm_format="$rpm_format ARCH='%{ARCH}'"
|
||||||
|
rpm_format="$rpm_format UTIME='%{INSTALLTIME}'\n"
|
||||||
|
eval $(rpm --queryformat="$rpm_format" -q vesta)
|
||||||
|
DATE=$(date -d @$UTIME +%F)
|
||||||
|
TIME=$(date -d @$UTIME +%T)
|
||||||
|
else
|
||||||
|
dpkg_data=$(dpkg-query -s vesta)
|
||||||
|
pkg_date=$(stat -c "%Y" /var/lib/dpkg/info/vesta.list)
|
||||||
|
ARCH=$(echo "$dpkg_data"|grep Architecture | cut -f 2 -d ' ')
|
||||||
|
VERSION=$(echo "$dpkg_data"|grep Version |cut -f 2 -d ' '|cut -f 1 -d \-)
|
||||||
|
RELEASE=$(echo "$dpkg_data"|grep Version |cut -f 2 -d ' '|cut -f 2 -d \-)
|
||||||
|
DATE=$(date -d @$pkg_date +"%F")
|
||||||
|
TIME=$(date -d @$pkg_date +"%T")
|
||||||
|
fi
|
||||||
latest=$(grep vesta $tmp_file)
|
latest=$(grep vesta $tmp_file)
|
||||||
UPDATED='yes'
|
UPDATED='yes'
|
||||||
if [ ! -z "$latest" ] && [ "$latest" != "vesta-$VERSION-$RELEASE" ]; then
|
if [ ! -z "$latest" ] && [ "$latest" != "vesta-$VERSION-$RELEASE" ]; then
|
||||||
|
@ -49,9 +57,19 @@ str="NAME='vesta' VERSION='$VERSION' RELEASE='$RELEASE' ARCH='$ARCH'"
|
||||||
str="$str UPDATED='$UPDATED' DESCR='core package' TIME='$TIME' DATE='$DATE'"
|
str="$str UPDATED='$UPDATED' DESCR='core package' TIME='$TIME' DATE='$DATE'"
|
||||||
|
|
||||||
# Check vesta-php version
|
# Check vesta-php version
|
||||||
eval $(rpm --queryformat="$rpm_format" -q vesta-php)
|
if [ -e "/etc/redhat-release" ]; then
|
||||||
DATE=$(date -d @$UTIME +%F)
|
eval $(rpm --queryformat="$rpm_format" -q vesta-php)
|
||||||
TIME=$(date -d @$UTIME +%T)
|
DATE=$(date -d @$UTIME +%F)
|
||||||
|
TIME=$(date -d @$UTIME +%T)
|
||||||
|
else
|
||||||
|
dpkg_data=$(dpkg-query -s vesta-php)
|
||||||
|
pkg_date=$(stat -c "%Y" /var/lib/dpkg/info/vesta-php.list)
|
||||||
|
ARCH=$(echo "$dpkg_data"|grep Architecture | cut -f 2 -d ' ')
|
||||||
|
VERSION=$(echo "$dpkg_data"|grep Version |cut -f 2 -d ' '|cut -f 1 -d \-)
|
||||||
|
RELEASE=$(echo "$dpkg_data"|grep Version |cut -f 2 -d ' '|cut -f 2 -d \-)
|
||||||
|
DATE=$(date -d @$pkg_date +"%F")
|
||||||
|
TIME=$(date -d @$pkg_date +"%T")
|
||||||
|
fi
|
||||||
latest=$(grep php $tmp_file)
|
latest=$(grep php $tmp_file)
|
||||||
UPDATED='yes'
|
UPDATED='yes'
|
||||||
if [ ! -z "$latest" ] && [ "$latest" != "php-$VERSION-$RELEASE" ]; then
|
if [ ! -z "$latest" ] && [ "$latest" != "php-$VERSION-$RELEASE" ]; then
|
||||||
|
@ -63,9 +81,19 @@ str="$str UPDATED='$UPDATED' DESCR='php interpreter' TIME='$TIME'"
|
||||||
str="$str DATE='$DATE'"
|
str="$str DATE='$DATE'"
|
||||||
|
|
||||||
# Check vesta-nginx version
|
# Check vesta-nginx version
|
||||||
eval $(rpm --queryformat="$rpm_format" -q vesta-nginx)
|
if [ -e "/etc/redhat-release" ]; then
|
||||||
DATE=$(date -d @$UTIME +%F)
|
eval $(rpm --queryformat="$rpm_format" -q vesta-nginx)
|
||||||
TIME=$(date -d @$UTIME +%T)
|
DATE=$(date -d @$UTIME +%F)
|
||||||
|
TIME=$(date -d @$UTIME +%T)
|
||||||
|
else
|
||||||
|
dpkg_data=$(dpkg-query -s vesta-nginx)
|
||||||
|
pkg_date=$(stat -c "%Y" /var/lib/dpkg/info/vesta-nginx.list)
|
||||||
|
ARCH=$(echo "$dpkg_data"|grep Architecture | cut -f 2 -d ' ')
|
||||||
|
VERSION=$(echo "$dpkg_data"|grep Version |cut -f 2 -d ' '|cut -f 1 -d \-)
|
||||||
|
RELEASE=$(echo "$dpkg_data"|grep Version |cut -f 2 -d ' '|cut -f 2 -d \-)
|
||||||
|
DATE=$(date -d @$pkg_date +"%F")
|
||||||
|
TIME=$(date -d @$pkg_date +"%T")
|
||||||
|
fi
|
||||||
latest=$(grep nginx $tmp_file)
|
latest=$(grep nginx $tmp_file)
|
||||||
UPDATED='yes'
|
UPDATED='yes'
|
||||||
if [ ! -z "$latest" ] && [ "$latest" != "nginx-$VERSION-$RELEASE" ]; then
|
if [ ! -z "$latest" ] && [ "$latest" != "nginx-$VERSION-$RELEASE" ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue