#!/bin/bash # info: change sysconfig value # options: KEY VALUE # # The function is for changing main config settings such as COMPANY_NAME or # COMPANY_EMAIL and so on. #----------------------------------------------------------# # Variable&Function # #----------------------------------------------------------# # Argument defenition key=$(echo "$1" | tr '[:lower:]' '[:upper:]' ) value=$2 # Includes source $VESTA/func/main.sh source $VESTA/conf/vesta.conf #----------------------------------------------------------# # Verifications # #----------------------------------------------------------# check_args '2' "$#" 'KEY VALUE' validate_format 'key' check_ckey=$(grep "^$key='" $VESTA/conf/vesta.conf) if [ -z "$check_ckey" ]; then echo "Error: key $key not found" log_event "$E_INVALID" "$EVENT" exit $E_INVALID fi #----------------------------------------------------------# # Action # #----------------------------------------------------------# # Updating conf sed -i "s/$key=.*/$key='$value'/g" $VESTA/conf/vesta.conf #----------------------------------------------------------# # Vesta # #----------------------------------------------------------# # Logging log_event "$OK" "$EVENT" exit