| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #!/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
- # Importing system enviroment
- source /etc/profile
- # Includes
- source $VESTA/func/main.sh
- source $VESTA/conf/vesta.conf
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- # Checking arg number
- check_args '1' "$#" 'PACKAGE'
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- if [ -e "/etc/redhat-release" ]; then
- # Clean yum chache
- yum -q clean all
- # Define yum cmd
- yum="yum -q -y --noplugins --disablerepo=* --enablerepo=vesta"
- # Update vesta package
- $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
- else
- # Update repo
- apt-get update -o Dir::Etc::sourcelist="sources.list.d/vesta.list" \
- -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -qq
- # Update vesta package
- apt-get install $package -qq > /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
|