Skip to content

Commit 2c42044

Browse files
committed
adding some flexibilty
1 parent 61fe8fc commit 2c42044

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

bin/v-change-sys-config-value

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,24 @@ source $VESTA/conf/vesta.conf
2525

2626
check_args '2' "$#" 'KEY VALUE'
2727
validate_format 'key'
28-
check_ckey=$(grep "^$key='" $VESTA/conf/vesta.conf)
29-
if [ -z "$check_ckey" ]; then
30-
echo "Error: key $key not found"
31-
log_event "$E_INVALID" "$EVENT"
32-
exit $E_INVALID
33-
fi
3428

3529

3630
#----------------------------------------------------------#
3731
# Action #
3832
#----------------------------------------------------------#
3933

4034
# Updating conf
41-
sed -i "s/$key=.*/$key='$value'/g" $VESTA/conf/vesta.conf
35+
check_ckey=$(grep "^$key='" $VESTA/conf/vesta.conf)
36+
if [ -z "$check_ckey" ]; then
37+
echo "$key='$value'" >> $VESTA/conf/vesta.conf
38+
else
39+
sed -i "s|$key=.*|$key='$value'|g" $VESTA/conf/vesta.conf
40+
fi
41+
42+
if [ "$key" = "BACKUP" ] && [ "$value" != '/backup' ]; then
43+
rm /backup
44+
ln -s $value /backup
45+
fi
4246

4347

4448
#----------------------------------------------------------#

0 commit comments

Comments
 (0)