fix: pkg name in var
This commit is contained in:
parent
208acd2555
commit
839146e48b
@ -1,8 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CURRENT_VERSION=$(dpkg -s gitlab-ce | grep Version | sed 's/Version: //')
|
PKG_NAME="gitlab-ce"
|
||||||
MINOR_PREFIX=$(dpkg -s gitlab-ce | grep Version | sed 's/Version: //' | awk -F "." '{print $1 "." $2}')
|
|
||||||
UPDATE_TO=$(apt-cache madison gitlab-ce | grep $CURRENT_VERSION -B5 | awk -F "|" '{print $2}' | sed 's/ //' | grep $MINOR_PREFIX | head -n1)
|
CURRENT_VERSION=$(dpkg -s $PKG_NAME | grep Version | sed 's/Version: //')
|
||||||
|
MINOR_PREFIX=$(dpkg -s $PKG_NAME | grep Version | sed 's/Version: //' | awk -F "." '{print $1 "." $2}')
|
||||||
|
UPDATE_TO=$(apt-cache madison $PKG_NAME | grep $CURRENT_VERSION -B5 | awk -F "|" '{print $2}' | sed 's/ //' | grep $MINOR_PREFIX | head -n1)
|
||||||
|
|
||||||
DATE=$(date +'%Y-%m-%d %H:%M:%S')
|
DATE=$(date +'%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
@ -17,7 +19,7 @@ if [[ "$CURRENT_VERSION" == "$UPDATE_TO" ]]; then
|
|||||||
echo "$DATE | $CURRENT_VERSION | no new minor version is available" >> /var/log/gitlab-auto-update.log
|
echo "$DATE | $CURRENT_VERSION | no new minor version is available" >> /var/log/gitlab-auto-update.log
|
||||||
else
|
else
|
||||||
echo "$DATE | $CURRENT_VERSION | updating to $UPDATE_TO" >> /var/log/gitlab-auto-update.log
|
echo "$DATE | $CURRENT_VERSION | updating to $UPDATE_TO" >> /var/log/gitlab-auto-update.log
|
||||||
sudo apt install -y "gitlab-ce-$UPDATE_TO" 2>"$ERROR_LOG"
|
sudo apt install -y "$PKG_NAME-$UPDATE_TO" 2>"$ERROR_LOG"
|
||||||
|
|
||||||
# Check if there were any errors
|
# Check if there were any errors
|
||||||
if [ -s "$ERROR_LOG" ]; then
|
if [ -s "$ERROR_LOG" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user