minor fixes

This commit is contained in:
Blackyfff 2021-01-15 17:20:50 +01:00
parent a797b50fc4
commit 2d0d225a0e
5 changed files with 17 additions and 17 deletions

View File

@ -92,11 +92,11 @@ GetServernameSEDEntry() {
}
GetOwnGlueRecords() {
ServerName="$DNSSCRIPT_SERVER_NAME"
if [ ! -z "${ServerName##*$1}" ]; then
if [ -n "${ServerName##*$1}" ]; then
ServerName="$ServerName""$1"
fi
ServerName="$ServerName""."
echo "$(sed -ne 's/^\s*'"$(GetServernameSEDEntry "$1")"'\(\s\+[Ii][Nn]\s\+\([Aa]\|[Aa]\{4\}\)\s\+.*\)$/'"$ServerName"'\2/p' "$2")"
sed -ne 's/^\s*'"$(GetServernameSEDEntry "$1")"'\(\s\+[Ii][Nn]\s\+\([Aa]\|[Aa]\{4\}\)\s\+.*\)$/'"$ServerName"'\2/p' "$2"
}
GetOwnHoods() {
Entries="$(sed -ne "s/^\s*\(\S*\).*\s\+[Ii][Nn]\s\+[Nn][Ss]\s\+""$(GetServernameSEDEntry "$1")""\s*;\s*Subnets:\s*\([^;]*\)/\1 \3/p" "$2")"

View File

@ -38,8 +38,8 @@ cd "$UpdateScriptsFolder"
. ./dns-functions.sh
MasterFile="$ZoneFilesFolder""db.""$CommunityDomain"
BindInternalFile="$BindIncludeFileFolder""$CommunityDomain""-internal.conf"
BindExternalFile="$BindIncludeFileFolder""$CommunityDomain""-external.conf"
BindInternalConf="$BindIncludeFileFolder""$CommunityDomain""-internal.conf"
BindExternalConf="$BindIncludeFileFolder""$CommunityDomain""-external.conf"
BindIcvpnAcl="$BindIncludeFileFolder""icvpn-acl.conf"
PreFetchMasterSerial="$(GetZoneFileSerial "$MasterFile")"
@ -50,15 +50,15 @@ if [ $((PostFetchMasterSerial)) -gt $((PreFetchMasterSerial)) ]; then
ReloadZone "$CommunityDomain" "$InternalViews"
fi
[ -f "$BindExternalFile"".tmp" ] && rm "$BindExternalFile"".tmp"
[ -f "$BindInternalFile"".tmp" ] && rm "$BindInternalFile"".tmp"
InsertZoneToIncludeFile "$CommunityDomain" "$ZoneFilesFolder""db.""$CommunityDomain" "$BindExternalFile"".tmp"
rm -f "$BindExternalConf"".tmp"
rm -f "$BindInternalConf"".tmp"
InsertZoneToIncludeFile "$CommunityDomain" "$ZoneFilesFolder""db.""$CommunityDomain" "$BindExternalConf"".tmp"
for Subnet in $CommunitySubnets; do
ReverseDomains="$(GetReverseDomains "$Subnet")"
for RDomain in $ReverseDomains; do
./update-rdnszone.sh "$RDomain" "$ForwardZones" "$ZoneFilesFolder" "$TTLReReExMi" "$InternalViews"
InsertZoneToIncludeFile "$RDomain" "$ZoneFilesFolder""$(GetReverseZoneFileFromZone "${RDomain%*.}")" "$BindInternalFile"".tmp"
InsertZoneToIncludeFile "$RDomain" "$ZoneFilesFolder""$(GetReverseZoneFileFromZone "${RDomain%*.}")" "$BindInternalConf"".tmp"
done
done
@ -83,14 +83,14 @@ for Hood in $Hoods; do
echo "$(GetOwnGlueRecords "$CommunityDomain" "$MasterFile")" >> "$HoodZoneFile"
fi
./update-hoodzone.sh "$HoodZoneFile" "$HoodSubDomain"".""$CommunityDomain" "$Subnets" "$InternalViews"
InsertZoneToIncludeFile "$HoodSubDomain"".""$CommunityDomain" "$ZoneFilesFolder""db.""$HoodSubDomain"".""$CommunityDomain" "$BindExternalFile"".tmp"
InsertZoneToIncludeFile "$HoodSubDomain"".""$CommunityDomain" "$ZoneFilesFolder""db.""$HoodSubDomain"".""$CommunityDomain" "$BindExternalConf"".tmp"
HoodForwardZones="$ForwardZones $HoodSubDomain"".""$CommunityDomain""/""$ZoneFilesFolder""db.""$HoodSubDomain"".""$CommunityDomain"
for Subnet in $Subnets; do
ReverseDomains="$(GetReverseDomains "$Subnet")"
for RDomain in $ReverseDomains; do
./update-rdnszone.sh "$RDomain" "$HoodForwardZones" "$ZoneFilesFolder" "$TTLReReExMi" "$InternalViews"
InsertZoneToIncludeFile "$RDomain" "$ZoneFilesFolder""$(GetReverseZoneFileFromZone "${RDomain%*.}")" "$BindInternalFile"".tmp"
InsertZoneToIncludeFile "$RDomain" "$ZoneFilesFolder""$(GetReverseZoneFileFromZone "${RDomain%*.}")" "$BindInternalConf"".tmp"
done
done
@ -100,7 +100,7 @@ for Hood in $Hoods; do
./update-extzone.sh "$InternFile" "$ExternFile" "$Domain" "$ExternalView"
done
sed -i "1i include \"""$BindExternalFile""\";\n" "$BindInternalFile"".tmp"
sed -i "1i include \"""$BindExternalConf""\";\n" "$BindInternalConf"".tmp"
./update-public-acl.sh "$BindIcvpnAcl"".tmp"
@ -115,8 +115,8 @@ UpdateBindConfig() {
}
UpdateBindConfig "$BindIcvpnAcl"
UpdateBindConfig "$BindInternalFile"
UpdateBindConfig "$BindExternalFile"
UpdateBindConfig "$BindInternalConf"
UpdateBindConfig "$BindExternalConf"
if [ $ReConfigBind -eq 0 ]; then
if [ $DNSSCRIPT_BIND_RELOAD_VER -eq 0 ]; then

View File

@ -24,7 +24,7 @@ OldLeases="$(sed -e '/^;### Leases ###/,$!d' "$HoodZoneFile" | sed 1d)"
if [ -f "/tmp/dhcp.leases" ]; then
DnsmasqLeases="$(sed -ne 's/^\s*\(\S\+\s\+\)\{2\}\(\S\+\)\s\+\([_0-9a-zA-Z-]\+\)\s\+.*/\3 IN A \2/p' "/tmp/dhcp.leases")"
for Subnet in $Subnets; do
IsValidIPv4Subnet "$Subnet" && NewLeases="$(echo "$NewLeases";echo "$(GetLeaseEntriesInSubnet "$DnsmasqLeases" "$Subnet")")"
IsValidIPv4Subnet "$Subnet" && NewLeases="$(echo "$NewLeases"; GetLeaseEntriesInSubnet "$DnsmasqLeases" "$Subnet")"
done
fi

View File

@ -23,9 +23,9 @@ GetIPEntries() {
ReverseEntry() {
if [ -z "$RZoneIsIPv6" ]; then
echo "$(GetReverseDomains "$1""/32")"
GetReverseDomains "$1""/32"
else
echo "$(GetReverseDomains "$1""/128")"
GetReverseDomains "$1""/128"
fi
}

View File

@ -5,6 +5,6 @@ for File in /wwwup/*; do
LastFile="$File"
done
cat "$LastFile" | sed -e 's/%\([0-9A-F][0-9A-F]\)/\\\\x\1/g' | xargs echo -e > /tmp/hosts/remote.leases
sed -e 's/%\([0-9A-F][0-9A-F]\)/\\\\x\1/g' "$LastFile" | xargs echo -e > /tmp/hosts/remote.leases
rm /wwwup/*