mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 05:44:08 -07:00
replaced underscore with dash in api syscalls
This commit is contained in:
parent
7ed705cee7
commit
b6b7eacadb
283 changed files with 438 additions and 412 deletions
113
bin/v-update-sys-vesta
Executable file
113
bin/v-update-sys-vesta
Executable file
|
@ -0,0 +1,113 @@
|
|||
#!/bin/bash
|
||||
# info: update vesta after rpm update
|
||||
# options: version
|
||||
#
|
||||
# The function is runs as rpm update trigger. It pulls shell script from vesta
|
||||
# server and runs it.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
version=$1
|
||||
updates=''
|
||||
|
||||
# Importing system enviroment
|
||||
source /etc/profile
|
||||
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Checking arg number
|
||||
check_args '1' "$#" 'version'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Compare versions
|
||||
if [ "$version" != "$VERSION" ]; then
|
||||
# Downloading version tree
|
||||
upd_host="yum.vestacp.com"
|
||||
wget -O "/tmp/versions" http://$V_UPD_HOST/upd_scripts/version_tree.txt \
|
||||
&>/dev/null
|
||||
|
||||
# Checking download result
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "Error: version tree update failed"
|
||||
log_event "$E_UPDATE" "$EVENT"
|
||||
exit $E_UPDATE
|
||||
fi
|
||||
|
||||
# Deviding version
|
||||
v1=$(echo "$version" |cut -f 1 -d '.')
|
||||
v2=$(echo "$version" |cut -f 2 -d '.')
|
||||
v3=$(echo "$version" |cut -f 3 -d '.')
|
||||
V1=$(echo "$VERSION" |cut -f 1 -d '.')
|
||||
V2=$(echo "$VERSION" |cut -f 2 -d '.')
|
||||
V3=$(echo "$VERSION" |cut -f 3 -d '.')
|
||||
|
||||
|
||||
# Checking difference between versions
|
||||
# Too nested tests, sory about complexity
|
||||
if [ "$V1" -lt "$v1" ]; then
|
||||
for ver in $(seq $V1 $v1); do
|
||||
updates="$updates $(grep "^$ver." /tmp/versions|grep ":1$"|\
|
||||
cut -f 1 -d :)"
|
||||
done
|
||||
else
|
||||
if [ "$V2" -lt "$v2" ]; then
|
||||
for ver in $(seq $V2 $v2); do
|
||||
updates="$updates $(grep "^$v1.$ver." /tmp/versions |\
|
||||
grep ":1$"|cut -f 1 -d :)"
|
||||
done
|
||||
else
|
||||
V4=$((V3 + 1))
|
||||
for ver in $(seq $V4 $v3); do
|
||||
updates="$updates $(grep "^$v1.$v2.$ver" /tmp/versions |\
|
||||
grep ":1$"|cut -f 1 -d :)"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Executing update scripts
|
||||
if [ ! -z "$updates" ]; then
|
||||
mkdir $BIN/updates &>/dev/null
|
||||
|
||||
for update in $updates; do
|
||||
wget -O $BIN/updates/$update.sh \
|
||||
http://$V_UPD_HOST/upd_scripts/$update.sh &>/dev/null
|
||||
|
||||
# Checking download result
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "Error: version tree update failed"
|
||||
log_event "$E_UPDATE" "$EVENT"
|
||||
exit $E_UPDATE
|
||||
fi
|
||||
bash $BIN/updates/$update.sh
|
||||
done
|
||||
rm -rf $BIN/updates
|
||||
fi
|
||||
|
||||
# Updating config version
|
||||
sed -i "s/VERSION='$VERSION'/VERSION='$version'/g" $VESTA/conf/vesta.conf
|
||||
fi
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue