|
@@ -62,11 +62,15 @@ check_hestia_demo_mode
|
|
|
# Action #
|
|
# Action #
|
|
|
#----------------------------------------------------------#
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
+# Make sure the variable for the optional parameter TTL is empty before parsing
|
|
|
|
|
+# We depend on that later on
|
|
|
|
|
+unset TTL
|
|
|
|
|
+
|
|
|
# Parsing domain config
|
|
# Parsing domain config
|
|
|
line=$(grep "ID='$id'" $USER_DATA/dns/$domain.conf)
|
|
line=$(grep "ID='$id'" $USER_DATA/dns/$domain.conf)
|
|
|
parse_object_kv_list "$line"
|
|
parse_object_kv_list "$line"
|
|
|
|
|
|
|
|
-if [ -z $type ]; then
|
|
|
|
|
|
|
+if [ -z "$type" ]; then
|
|
|
type=$TYPE
|
|
type=$TYPE
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
@@ -87,8 +91,11 @@ fi
|
|
|
is_dns_fqnd "$TYPE" "$dvalue"
|
|
is_dns_fqnd "$TYPE" "$dvalue"
|
|
|
is_dns_nameserver_valid "$domain" "$TYPE" "$dvalue"
|
|
is_dns_nameserver_valid "$domain" "$TYPE" "$dvalue"
|
|
|
|
|
|
|
|
-# Deleting old record
|
|
|
|
|
-sed -i "/^ID='$id'/d" "$USER_DATA/dns/$domain.conf"
|
|
|
|
|
|
|
+if [[ "$RECORD" == "$record" ]] && [[ "$TYPE" == "$type" ]] && [[ "$PRIORITY" -eq "$priority" ]] \
|
|
|
|
|
+ && [[ "$VALUE" == "$dvalue" ]] && [[ "$SUSPENDED" == 'no' ]] && [[ "$TTL" -eq "$ttl" ]]; then
|
|
|
|
|
+ echo "No pending changes in DNS entry."
|
|
|
|
|
+ exit "$E_EXSIST"
|
|
|
|
|
+fi
|
|
|
|
|
|
|
|
# Generating timestamp
|
|
# Generating timestamp
|
|
|
time_n_date=$(date +'%T %F')
|
|
time_n_date=$(date +'%T %F')
|
|
@@ -99,6 +106,9 @@ date=$(echo "$time_n_date" |cut -f 2 -d \ )
|
|
|
dns_rec="ID='$id' RECORD='$record' TYPE='$type' PRIORITY='$priority'"
|
|
dns_rec="ID='$id' RECORD='$record' TYPE='$type' PRIORITY='$priority'"
|
|
|
dns_rec="$dns_rec VALUE='$dvalue' SUSPENDED='no' TIME='$time' DATE='$date'"
|
|
dns_rec="$dns_rec VALUE='$dvalue' SUSPENDED='no' TIME='$time' DATE='$date'"
|
|
|
[ -n "$ttl" ] && dns_rec="$dns_rec TTL='$ttl'"
|
|
[ -n "$ttl" ] && dns_rec="$dns_rec TTL='$ttl'"
|
|
|
|
|
+# Deleting old record
|
|
|
|
|
+sed -i "/^ID='$id'/d" $USER_DATA/dns/$domain.conf
|
|
|
|
|
+# Add new entry
|
|
|
echo "$dns_rec" >> $USER_DATA/dns/$domain.conf
|
|
echo "$dns_rec" >> $USER_DATA/dns/$domain.conf
|
|
|
|
|
|
|
|
# Sorting records
|
|
# Sorting records
|