public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
* [git.ipfire.org] IPFire 2.x development tree branch, master, updated. 3ee6ac9dad4896e624d4776409e6a07e335e0e55
@ 2020-01-28 20:01 Arne Fitzenreiter
  0 siblings, 0 replies; only message in thread
From: Arne Fitzenreiter @ 2020-01-28 20:01 UTC (permalink / raw)
  To: ipfire-scm

[-- Attachment #1: Type: text/plain, Size: 4980 bytes --]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".

The branch, master has been updated
       via  3ee6ac9dad4896e624d4776409e6a07e335e0e55 (commit)
       via  5d6ccc7a43d0f262a26dea4c510407861b9d9640 (commit)
       via  d3236de23a139dbcf5b66f0ed1d6731801a9c106 (commit)
       via  358bcfdb2993f5fa884e2928b6dbd1d82bf89f8b (commit)
      from  932cee06f17fd900f21582ff652ffc9ec89d06f0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3ee6ac9dad4896e624d4776409e6a07e335e0e55
Author: Arne Fitzenreiter <arne_f(a)ipfire.org>
Date:   Tue Jan 28 19:38:16 2020 +0000

    convert-dns-settings: Remove DNS variable from PPP profiles
    
    Signed-off-by: Arne Fitzenreiter <arne_f(a)ipfire.org>

commit 5d6ccc7a43d0f262a26dea4c510407861b9d9640
Author: Arne Fitzenreiter <arne_f(a)ipfire.org>
Date:   Tue Jan 28 19:34:56 2020 +0000

    convert-dns-settings: Refactor reading old configuration
    
    This patch makes the code a lot shorter by removing special
    cases for all sorts of files when they can all be treaded
    equally.
    
    Signed-off-by: Arne Fitzenreiter <arne_f(a)ipfire.org>

commit d3236de23a139dbcf5b66f0ed1d6731801a9c106
Author: Arne Fitzenreiter <arne_f(a)ipfire.org>
Date:   Tue Jan 28 19:19:06 2020 +0000

    convert-dns-settings: Fix call for chmod
    
    Signed-off-by: Arne Fitzenreiter <arne_f(a)ipfire.org>

commit 358bcfdb2993f5fa884e2928b6dbd1d82bf89f8b
Author: Stefan Schantl <stefan.schantl(a)ipfire.org>
Date:   Tue Jan 28 16:14:35 2020 +0100

    convert-dns-settings: Fix check to prevent doubble-adding the same server
    
    Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
    Signed-off-by: Arne Fitzenreiter <arne_f(a)ipfire.org>

-----------------------------------------------------------------------

Summary of changes:
 src/scripts/convert-dns-settings | 61 +++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 38 deletions(-)

Difference in files:
diff --git a/src/scripts/convert-dns-settings b/src/scripts/convert-dns-settings
index e9d4de86b..1d9b22dcd 100755
--- a/src/scripts/convert-dns-settings
+++ b/src/scripts/convert-dns-settings
@@ -23,48 +23,33 @@ main() {
 	# Do not convert anything if we already have some servers set
 	if [ ! -s "/var/ipfire/dns/servers" ]; then
 		# Array to store all found DNS servers.
-		SERVERS=()
-
-		# Try to get the DNS servers from ethernet settings file.
-		local DNS1 DNS2
-		eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
-
-		# Add the grabbed DNS servers to the servers array.
-		SERVERS+=($DNS1 $DNS2)
-
-		# Check if the ppp settings file is not empty.
-		if [ -s "/var/ipfire/ppp/settings" ]; then
-			# Loop though all profile files.
-			for file in /var/ipfire/ppp/settings*; do
-				local DNS1 DNS2
-				eval $(/usr/local/bin/readhash $file)
-
-				# Add the DNS servers to the array of SERVERS.
-				for var in DNS1 DNS2; do
-					local server="${!var}"
-
-					# Check if the current server is allready part
-					# of the array.
-					for element in "${SERVERS[@]}"; do
-						[[ $element == $server ]] && continue
-					done
-
-					SERVERS+=($server)
+		local SERVERS=()
+
+		# Loop through all PPP profiles
+		local file
+		for file in /var/ipfire/ethernet/settings /var/ipfire/dns/settings /var/ipfire/ppp/settings-*; do
+			if [ -s "${file}" ]; then
+				local DNS0 DNS1 DNS2
+				eval $(/usr/local/bin/readhash "${file}")
+
+				# Add the DNS servers to the array of SERVERS
+				local var
+				for var in DNS0 DNS1 DNS2; do
+					SERVERS+=( "${!var}" )
 				done
 
-				# Remove DNS1 and DNS2 settings from profile file.
-				sed -i "/^DNS[12]?=/d" $file
-			done
-
-		elif [ -s "/var/ipfire/dns/settings" ]; then
-			eval $(/usr/local/bin/readhash /var/ipfire/dns/settings)
-		fi
+				# Remove DNS, DNS0, DNS1 and DNS2 settings from profile file
+				sed -Ei "/^DNS[012]?=/d" "${file}"
+			fi
+		done
 
 		local server
 		local i=3
-		for server in "${SERVERS[@]}"; do
-			echo "${i},${server},,enabled,"
-			(( i++ ))
+		for server in $(printf "%s\n" "${SERVERS[@]}" | sort -u); do
+			if [ -n "${server}" ]; then
+				echo "${i},${server},,enabled,"
+				(( i++ ))
+			fi
 		done > /var/ipfire/dns/servers
 
 		# Empty the old settings file
@@ -113,7 +98,7 @@ main() {
 	chown nobody:nobody /var/ipfire/dns/servers
 
 	# Make DHCP leases readable for nobody
-	chown 644 /etc/unbound/dhcp-leases.conf
+	chmod 644 /etc/unbound/dhcp-leases.conf
 }
 
 main "$@" || exit $?


hooks/post-receive
--
IPFire 2.x development tree

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-28 20:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-28 20:01 [git.ipfire.org] IPFire 2.x development tree branch, master, updated. 3ee6ac9dad4896e624d4776409e6a07e335e0e55 Arne Fitzenreiter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox