mirror of
https://github.com/serghey-rodin/vesta.git
synced 2026-09-09 04:29:47 +02:00
63 lines
1.5 KiB
Bash
Executable File
63 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: update vesta package/configs
|
|
# options: PACKAGE [VERSION]
|
|
#
|
|
# The function runs as rpm update trigger. It pulls shell script from vesta
|
|
# server and runs it.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument defenition
|
|
package=$1
|
|
version=$2
|
|
release=$3
|
|
|
|
# Importing system enviroment
|
|
source /etc/profile
|
|
|
|
# Includes
|
|
source $VESTA/conf/vesta.conf
|
|
source $VESTA/func/main.sh
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
# Checking arg number
|
|
check_args '1' "$#" 'PACKAGE [VERSION] [RELEASE]'
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Clean yum chache
|
|
yum -q clean all
|
|
|
|
# Define yum cmd
|
|
yum="yum -q -y --noplugins --disablerepo=* --enablerepo=vesta"
|
|
|
|
# Update vesta package
|
|
if [ -z "$version" ]; then
|
|
$yum update $package > /dev/null 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
echo "Error: $package update failed"
|
|
log_event "$E_UPDATE" "$EVENT"
|
|
exit $E_UPDATE
|
|
fi
|
|
fi
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Logging
|
|
log_event "$OK" "$EVENT"
|
|
|
|
exit
|