#!/bin/sh
#
# Tos command
# g_CAPD_SRDC_OS@tencent.com
#
. /usr/lib/tencentos-tools/tos-lib.sh
scriptversion=1.2;
scriptdate=2019-11-25;

usage="\
tos version $scriptversion
Usage:
	tos TencentOS Server System Management Toolset
	tos -u|-U| update [rpm_name]	Update the system 
	tos -i|-I| install rpm_name	install rpms
	tos -s|-S| show			Show the system version
	tos -c|-C| check [rpm_name]	Check the modified rpms
	tos -f yum | fix yum		Fix yum problems
	tos -f dns | fix dns		Fix DNS problems
	tos set dns			Set DNS
	tos set irq			Set irqaffinity, restart irqaffinity service
	tos -cu| check-update		Check available package updates
	tos -b|-B| backup		Backup the system
	tos -h|-H| help			Show this usage
	tos -v|-V| version		Show the script version

"

if [ $# -eq 0 ]; then
    echo "$usage"
    tos_show;
fi

while test $# -ne 0; do
    case $1 in
        -u | -U | update) shift
                          tos_update $@
                          break;;
        -i | -I | install) shift
                          tos_install $@
                          break;;
        -s | -S | show)  tos_show;;
        -b | -B | backup) tos_backup
                          break;;
        -c | -C | check) tos_check $2
                         shift;;
        -cu | check-update) tos_check_update;;
        -f | fix) tos_fix $2
	          shift;;
	set)  tos_set $2
	      shift;;
        -h | -H | help) echo "$usage"; exit $?;;
        -v | -V | version) echo "$scriptversion";;
        --) shift
            break;;
        *) echo "$0: invalid option: $1" >&2
            echo "$usage"
            exit 1;;
     esac
     shift
done


