mirror of
https://github.com/serghey-rodin/vesta.git
synced 2024-12-03 19:00:24 -08:00
d386c3598c
Thanks to @hestiacp and @jaapmarcus for fix.
59 lines
1.5 KiB
Bash
Executable File
59 lines
1.5 KiB
Bash
Executable File
#!/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 definition
|
|
key=$(echo "$1" | tr '[:lower:]' '[:upper:]' )
|
|
value=$2
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '2' "$#" 'KEY VALUE'
|
|
is_format_valid 'key'
|
|
|
|
format_no_quotes "$value" 'value'
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Updating conf
|
|
check_ckey=$(grep "^$key='" $VESTA/conf/vesta.conf)
|
|
if [ -z "$check_ckey" ]; then
|
|
echo "$key='$value'" >> $VESTA/conf/vesta.conf
|
|
else
|
|
sed -i "s|$key=.*|$key='$value'|g" $VESTA/conf/vesta.conf
|
|
fi
|
|
|
|
if [ "$key" = "BACKUP" ] && [ "$value" != '/backup' ]; then
|
|
rm /backup
|
|
ln -s $value /backup
|
|
fi
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Logging
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|