Created
May 30, 2020 10:02
-
-
Save yakaviuk/2c8d3d136fb7822628284816fb1fda69 to your computer and use it in GitHub Desktop.
check_vestcp_version.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#vestapc version checker | |
#beta script | |
# Checking installed vesta version | |
if [ -d "/etc/sysconfig" ]; then | |
rpm_format="VERSION='%{VERSION}'" | |
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 | |
echo $VERSION-$RELEASE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment