From a05ca1fc13338045c3d531615b868510ce062078 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Tue, 3 Jan 2023 14:02:37 +0100
Subject: [PATCH] migrate server scripts to python 3

---
 server-scripts/checkip |  8 ++++----
 server-scripts/update  | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/server-scripts/checkip b/server-scripts/checkip
index d4eec23..55ff343 100755
--- a/server-scripts/checkip
+++ b/server-scripts/checkip
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # Copyright (c) 2014, Ralf Jung <post@ralfj.de>
 # All rights reserved.
 # 
@@ -25,8 +25,8 @@
 import os
 
 # print headers
-print "Content-Type: text/plain"
-print ""
+print("Content-Type: text/plain")
+print("")
 
 # print content
-print os.environ["REMOTE_ADDR"]
+print(os.environ["REMOTE_ADDR"])
diff --git a/server-scripts/update b/server-scripts/update
index 183f2db..48c791c 100755
--- a/server-scripts/update
+++ b/server-scripts/update
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # Copyright (c) 2014, Ralf Jung <post@ralfj.de>
 # All rights reserved.
 # 
@@ -26,12 +26,12 @@ import cgi, os, sys, subprocess
 form = cgi.FieldStorage(keep_blank_values=True)
 
 # print headers
-print "Content-Type: text/plain"
-print ""
+print("Content-Type: text/plain")
+print("")
 
 # get input
 if "password" not in form or "domain" not in form or ("ip" not in form and "ipv6" not in form):
-    print "Mandatory argument missing: You must supply all of 'password', 'domain' and at least either 'ip' or 'ipv6'"
+    print("Mandatory argument missing: You must supply all of 'password', 'domain' and at least either 'ip' or 'ipv6'")
     sys.exit()
 
 domain = form.getfirst("domain")
@@ -53,13 +53,13 @@ p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 # check what it did
 if p.returncode or stderr or stdout:
     # error :/
-    print "There was an error while updating the DNS: Return code %d" % p.returncode
-    if stdout: print stdout
-    if stderr: print stderr
+    print("There was an error while updating the DNS: Return code %d" % p.returncode)
+    if stdout: print(stdout)
+    if stderr: print(stderr)
 else:
     out = "good"
     if ip is not None:
         out += " "+ip
     if ipv6 is not None:
         out += " "+ipv6
-    print out
+    print(out)
-- 
2.39.5